diff --git a/dspy/clients/lm.py b/dspy/clients/lm.py index 66cd7ea2cb..931540fa7e 100644 --- a/dspy/clients/lm.py +++ b/dspy/clients/lm.py @@ -123,6 +123,7 @@ def __call__(self, prompt=None, messages=None, **kwargs): timestamp=datetime.now().isoformat(), uuid=str(uuid.uuid4()), model=self.model, + response_model=response["model"], model_type=self.model_type, ) self.history.append(entry) diff --git a/dspy/predict/react.py b/dspy/predict/react.py index 2690d066af..8c61f2b5f9 100644 --- a/dspy/predict/react.py +++ b/dspy/predict/react.py @@ -68,9 +68,18 @@ def __init__(self, signature, tools: list[Callable], max_iters=5): react_signature = ( dspy.Signature({**signature.input_fields}, "\n".join(instr)) .append("trajectory", dspy.InputField(), type_=str) - .append("next_thought", dspy.OutputField(), type_=str) - .append("next_tool_name", dspy.OutputField(), type_=Literal[tuple(tools.keys())]) - .append("next_tool_args", dspy.OutputField(), type_=dict[str, Any]) + .append("next_thought", dspy.OutputField( + desc="The next thought to consider in the trajectory." + " Make sure the key is exactly 'next_thought'" + ), type_=str) + .append("next_tool_name", dspy.OutputField( + desc="The next tool to use in the trajectory." + " Make sure the key is exactly 'next_tool_name'" + ), type_=Literal[tuple(tools.keys())]) + .append("next_tool_args", dspy.OutputField( + desc="The arguments to pass to the next tool in the trajectory." + " Make sure the key is exactly 'next_tool_args'" + ), type_=dict[str, Any]) ) fallback_signature = dspy.Signature(