Skip to content

Conversation

@nmaguiar
Copy link
Collaborator

@nmaguiar nmaguiar commented Dec 30, 2025

Motivation

  • Gemini 2.5/3 can return tool calls as functionCall parts and sometimes encodes args as JSON strings, so the tool-calling loop must handle both shapes.
  • Tool declarations may be passed as names or objects, so normalization is required before sending to the API.
  • Avoid duplicating or corrupting the conversation state when inserting tool call and response parts.

Description

  • Updated js/owrap.ai.js to normalize aTools (accept arrays of tool names) and resolve them to declared tool objects before sending functionDeclarations to Gemini.
  • Cleaned tool schemas by removing fn and $id/$schema entries via traverse before including them in body.tools to prevent invalid schema errors.
  • Adjusted Gemini tool-calling flow to detect functionCall parts, parse args when they are JSON strings, execute the registered tool function, and append a functionResponse part on a follow-up user message.
  • Fixed recursion behavior to avoid re-processing appended parts by invoking rawPrompt with an empty prompt when continuing the conversation, and added inline comments explaining Gemini 2.5/3 tool-calling nuances.
  • Updated docs/ow-ai-gpttypes.md with a Gemini 2.5/3 notes section explaining functionCall/functionResponse flow and JSON response schema guidance.

Testing

  • No automated tests were executed as part of this change.
  • Manual validation steps were not recorded in the commit.
  • Documentation was updated to reflect the new behavior in docs/ow-ai-gpttypes.md.
  • No breaking changes are expected for existing providers.

@nmaguiar nmaguiar self-assigned this Jan 2, 2026
@nmaguiar nmaguiar marked this pull request as ready for review January 2, 2026 18:10
@nmaguiar nmaguiar merged commit f208b66 into t8 Jan 2, 2026
2 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Continuous Enhancement Jan 2, 2026
@nmaguiar nmaguiar deleted the codex/verify-and-update-gemini-implementation branch January 2, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants