Add Gemini 3 models with thought-signature support

Signatures ride the assistant message as a _gemini sidecar and are reattached in tool loops.
Thought-flagged parts are filtered from answer text; foreign sidecars stripped on the OpenAI wire.
Live-verified both Gemini 3 models end-to-end; without the echo they 400 on every tool loop.
This commit is contained in:
Rohit C Prasad
2026-07-22 14:05:23 -07:00
committed by Rohit P
parent 878b858ece
commit a63710ecfe
9 changed files with 247 additions and 22 deletions
+16
View File
@@ -415,3 +415,19 @@ def test_reseller_descriptors_and_matrix_stay_in_lockstep():
# full ids in the matrix must round-trip: prefix + bare == matrix key
base = next(f for f in d.fields if f.key == "base_url")
assert base.default.startswith("https://")
def test_foreign_sidecars_stripped_from_outbound_messages():
"""Provider-private sidecars (`_gemini` thought signatures et al) must never reach the
OpenAI wire — it and its compat servers reject unknown message fields."""
client = _FakeClient(_response(content="ok"))
provider = OpenAIProvider(client=client)
provider.complete(
model="gpt-5.5",
messages=[
{"role": "user", "content": "hi"},
{"role": "assistant", "content": "prev", "_gemini": {"call_sigs": ["x"]}},
],
)
sent = client.chat.completions.calls[0]["messages"]
assert sent[1] == {"role": "assistant", "content": "prev"}