diff --git a/.changeset/fresh-mangos-fail.md b/.changeset/fresh-mangos-fail.md new file mode 100644 index 0000000..ef79537 --- /dev/null +++ b/.changeset/fresh-mangos-fail.md @@ -0,0 +1,5 @@ +--- +"@inngest/agent-kit": patch +--- + +fix(adapters/openai): safely parse non-strong tool return value for Function calling diff --git a/src/adapters/openai.ts b/src/adapters/openai.ts index 4e9a975..97412c6 100644 --- a/src/adapters/openai.ts +++ b/src/adapters/openai.ts @@ -51,7 +51,11 @@ export const requestParser: AgenticModel.RequestParser = ( 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["messages"],