Skip to content

feat(interactions): add Gemini tool-calling and passthrough support#5572

Open
leseb wants to merge 3 commits intoogx-ai:mainfrom
leseb:leseb/rhaistrat-1348-v3
Open

feat(interactions): add Gemini tool-calling and passthrough support#5572
leseb wants to merge 3 commits intoogx-ai:mainfrom
leseb:leseb/rhaistrat-1348-v3

Conversation

@leseb
Copy link
Copy Markdown
Collaborator

@leseb leseb commented Apr 16, 2026

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_call deltas, 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=short
  • uv run pytest tests/unit/utils/test_authorized_sqlstore.py -x --tb=short
  • uv 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.py
  • git push -u origin leseb/rhaistrat-1348-v3 (pre-push hooks + codegen/spec/coverage checks)

Output:

tests/unit/providers/inline/interactions/test_impl.py: 26 passed
tests/unit/utils/test_authorized_sqlstore.py: 13 passed
mypy: Success: no issues found in 5 source files
pre-push checks: Passed

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 16, 2026
@leseb leseb enabled auto-merge April 16, 2026 15:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

✱ Stainless preview builds

This PR will update the llama-stack-client SDKs with the following commit message.

feat(interactions): add Gemini tool-calling and passthrough support

Edit this comment to update it. It will appear in the SDK's changelogs.

llama-stack-client-openapi studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️

llama-stack-client-python studio · conflict

Your SDK build resulted in a merge conflict between your custom code and the newly generated changes, but this did not represent a regression.

llama-stack-client-go studio · conflict

Your SDK build resulted in a merge conflict between your custom code and the newly generated changes, but this did not represent a regression.

llama-stack-client-node studio · conflict

Your SDK build resulted in a merge conflict between your custom code and the newly generated changes, but this did not represent a regression.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-04-28 14:46:05 UTC

@leseb leseb force-pushed the leseb/rhaistrat-1348-v3 branch from 3fe208f to fb35a34 Compare April 17, 2026 10:39
Copy link
Copy Markdown
Contributor

@skamenan7 skamenan7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 "",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_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

@nidhishgajjar

This comment was marked as spam.

1 similar comment
@nidhishgajjar

This comment was marked as spam.

@nidhishgajjar

This comment was marked as spam.

@nidhishgajjar

This comment was marked as spam.

Signed-off-by: Sébastien Han <seb@redhat.com>
@leseb leseb force-pushed the leseb/rhaistrat-1348-v3 branch from fb35a34 to 9143c94 Compare April 26, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants