feat(interactions): add Gemini tool-calling and passthrough support#5572
feat(interactions): add Gemini tool-calling and passthrough support#5572leseb wants to merge 3 commits intoogx-ai:mainfrom
Conversation
✱ Stainless preview buildsThis PR will update the Edit this comment to update it. It will appear in the SDK's changelogs. ✅ llama-stack-client-openapi studio · code · diff
✅ llama-stack-client-python studio · conflict
✅ llama-stack-client-go studio · conflict
✅ llama-stack-client-node studio · conflict
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
3fe208f to
fb35a34
Compare
skamenan7
left a comment
There was a problem hiding this comment.
Thanks for adding this support.
| client_kwargs = self._build_passthrough_client_kwargs(passthrough) | ||
|
|
||
| if request.stream: | ||
| return self._passthrough_stream(url, body, client_kwargs) | ||
|
|
||
| async with httpx.AsyncClient(**client_kwargs) as client: | ||
| resp = await client.post(url, json=body) | ||
| resp.raise_for_status() | ||
| return GoogleInteractionResponse(**resp.json()) | ||
| if resp.status_code >= 400: |
There was a problem hiding this comment.
I noticed the new passthrough branch is calling resp.json() unconditionally on both the success and error path, and the 4xx/5xx log line now includes resp.text[:500]. Would it make sense to guard the JSON decode and avoid logging the raw body here? That would keep proxy or HTML failures from turning into secondary exceptions and would reduce the chance of logging provider payloads.
| messages.append( | ||
| { | ||
| "role": "tool", | ||
| "tool_call_id": item.call_id or item.id or "", |
There was a problem hiding this comment.
_convert_turn_with_function_responses() falls back to "" for tool_call_id when both call_id and id are missing. The new recordings already show Gemini rejects that shape as Missing call_id in content of type function_result, so could we raise ValueError here instead? If a function_result can't be associated with a prior tool call, the request is invalid, and a clean 400 at the API boundary feels better than forwarding tool_call_id="" into the OpenAI adapter
This comment was marked as spam.
This comment was marked as spam.
1 similar comment
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Signed-off-by: Sébastien Han <seb@redhat.com>
fb35a34 to
9143c94
Compare
What does this PR do?
This PR adds Google Interactions tool-calling support end-to-end, including request/response models, translation to and from Chat Completions, streaming
function_calldeltas, and passthrough tool-shape normalization. It extends Gemini native passthrough support with OAuth/access-token authentication headers and raw passthrough JSON/SSE handling, plus router/protocol updates for those response types. It also hardens SQL store authorization behavior for update/delete and adds race-condition coverage tests. Generated API specs, coverage docs, CI/distribution setup, and integration recordings were updated to match the new behavior.Test Plan
uv run pytest tests/unit/providers/inline/interactions/test_impl.py -x --tb=shortuv run pytest tests/unit/utils/test_authorized_sqlstore.py -x --tb=shortuv run mypy src/llama_stack/core/storage/sqlstore/authorized_sqlstore.py src/llama_stack/providers/remote/inference/gemini/config.py src/llama_stack/providers/inline/interactions/impl.py src/llama_stack_api/interactions/api.py src/llama_stack_api/interactions/fastapi_routes.pygit push -u origin leseb/rhaistrat-1348-v3(pre-push hooks + codegen/spec/coverage checks)Output: