add support for extra_content in chat response tool calls returned by Gemini models#768
Conversation
|
You'll need to type the array shape of this since we are in highest PHPStan mode. Also could we get some tests to confirm OpenAI who doesn't send this doesn't have it returned? Then likewise a test for when its included that it comes back in |
|
Hey @iBotPeaches alright - I'm on it :) |
|
Sooo... After quite some back- and forth I managed to satisfy all linters and type-checkers (sorry, I noticed to late that this stuff can be checked locally - I'm more used to githooks that do this before committing). I also added one more test and verified in the existing test that the new "extra_content" would not appear |
|
Hey @iBotPeaches could you (re-) check the current state? Should I improve something more 🤔 ? |
iBotPeaches
left a comment
There was a problem hiding this comment.
I don't love the expanse because its for another model, but on the flip side. Most folks using pure OpenAI have moved onto to Response API, so to add something that no one will notice unless using Gemini seems fine.
What:
Description:
This is a newer fix, based on #718 in order to fix the Gemini reponse. Gemini sends 'extra_content' when using tools in order to transfer the
thought_signature. This is how it looks in the raw response:{ "choices": [ { "finish_reason": "tool_calls", "index": 0, "message": { "role": "assistant", "tool_calls": [ { "extra_content": { "google": { "thought_signature": "<token>" } }, "function": { "arguments": "{}", "name": "function-name" }, "id": "<id>", "type": "function" }, // ... ] } } ], // ...Related:
See other PR #718 - this one should take care of failed checks
closes: #718