-
-
Notifications
You must be signed in to change notification settings - Fork 201
feat(ai-gemini): add geminiTextInteractions() adapter for stateful Interactions API #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tombeckenham
wants to merge
16
commits into
TanStack:main
Choose a base branch
from
tombeckenham:501-feat-ai-gemini-expose-stateful-interactions-api-previous-interaction-id
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
40c1753
feat(ai-gemini): add geminiTextInteractions() adapter for stateful Inβ¦
tombeckenham 64a1706
ci: apply automated fixes
autofix-ci[bot] dae238d
refactor(ai-gemini): surface interactionId via CUSTOM event, drop corβ¦
tombeckenham 69e27d0
fix(ai-gemini): address CodeRabbit review feedback on Interactions adβ¦
tombeckenham f64703c
ci: apply automated fixes
autofix-ci[bot] 7ea0664
fix(ai-gemini): emit RUN_ERROR with spec-compliant flat message/code
tombeckenham 88bba03
feat(examples): wire Gemini Interactions into ts-react-chat, refresh β¦
tombeckenham be2cae5
test(ai-gemini): route adapter tests through public core APIs
tombeckenham 4c6fc30
feat(ai-gemini): built-in tools on geminiTextInteractions()
tombeckenham a0029f3
ci: apply automated fixes
autofix-ci[bot] 2ad5949
ci: apply automated fixes (attempt 2/3)
autofix-ci[bot] b3e470c
refactor(ai-gemini)!: gate `geminiTextInteractions` behind `/experimeβ¦
tombeckenham a68ad12
chore(ai-gemini): consolidate `geminiTextInteractions` changesets
tombeckenham 958b506
Marked gemini interactions as experimental in example
tombeckenham 34a87ae
test(e2e): wire up stateful-interactions spec for geminiTextInteractions
tombeckenham eaee03f
Merge pull request #4 from tombeckenham:501-e2e-stateful-interactions
tombeckenham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| '@tanstack/ai-gemini': minor | ||
| --- | ||
|
|
||
| feat(ai-gemini): add experimental `geminiTextInteractions()` adapter for Gemini's stateful Interactions API (Beta) | ||
|
|
||
| Routes through `client.interactions.create` instead of `client.models.generateContent`, so callers can pass `previous_interaction_id` via `modelOptions` and let the server retain conversation history. On each run, the returned interaction id is surfaced via an AG-UI `CUSTOM` event (`name: 'gemini.interactionId'`) emitted just before `RUN_FINISHED` β feed it back on the next turn via `modelOptions.previous_interaction_id`. | ||
|
|
||
| Exported from a dedicated `@tanstack/ai-gemini/experimental` subpath so the experimental status is load-bearing in your editor and bundle: | ||
|
|
||
| ```ts | ||
| import { geminiTextInteractions } from '@tanstack/ai-gemini/experimental' | ||
| ``` | ||
|
|
||
| Scope: text/chat output with function tools, plus the built-in tools `google_search`, `code_execution`, `url_context`, `file_search`, and `computer_use`. Built-in tool activity is surfaced as AG-UI `CUSTOM` events named `gemini.googleSearchCall` / `gemini.googleSearchResult` (and the matching `codeExecutionCall`/`Result`, `urlContextCall`/`Result`, `fileSearchCall`/`Result` variants), carrying the raw Interactions delta payload. Function-tool `TOOL_CALL_*` events are unchanged, and `finishReason` stays `stop` when only built-in tools ran β the core chat loop has nothing to execute. | ||
|
|
||
| `google_search_retrieval`, `google_maps`, and `mcp_server` are not supported on this adapter and throw a targeted error explaining the alternative. Image/audio output via Interactions is also not routed through this adapter β use `geminiText()`, `geminiImage`, or `geminiSpeech` for those. | ||
|
|
||
| Marked `@experimental` β the underlying Interactions API is Beta and Google explicitly flags possible breaking changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.