Skip to content

Commit

Permalink
hack
Browse files Browse the repository at this point in the history
  • Loading branch information
chenmoneygithub committed Jan 28, 2025
1 parent 0ad665e commit 1c1d88d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dspy/predict/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,14 @@ def forward(self, **kwargs):
return Prediction(**pred_dict)
parsed_tool_calls = []
for tool_call in tool_calls:
tool_name = tool_call.function["name"]
tool_args = json.loads(tool_call.function["arguments"])
tool_name = (
tool_call.function["name"] if hasattr(tool_call, "function") else tool_call["function"]["name"]
)
tool_args = (
json.loads(tool_call.function["arguments"])
if hasattr(tool_call, "function")
else tool_call["function"]["arguments"]
)
parsed_tool_calls.append(dict(tool_name=tool_name, tool_args=tool_args))
pred_dict["tool_calls"] = parsed_tool_calls
pred = Prediction(**pred_dict)
Expand Down

0 comments on commit 1c1d88d

Please sign in to comment.