Skip to content

Commit

Permalink
fix(adapters/openai): safely parse non-strong tool return value for F…
Browse files Browse the repository at this point in the history
…unction calling
  • Loading branch information
charlypoly committed Jan 16, 2025
1 parent 60579b6 commit b5048f0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/adapters/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ export const requestParser: AgenticModel.RequestParser<OpenAi.AiModel> = (
case "tool_result":
return {
role: "tool",
content: m.content,
tool_call_id: m.tool.id,
content:
typeof m.content === "string"
? m.content
: JSON.stringify(m.content),
};
}
}) as AiAdapter.Input<OpenAi.AiModel>["messages"],
Expand Down

0 comments on commit b5048f0

Please sign in to comment.