You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
feat(interactions): add previous_interaction_id for multi-turn conversations (#5669)
# What does this PR do?
Adds `previous_interaction_id` support to the Google Interactions API,
enabling server-side conversation state for multi-turn interactions.
Without this, every request starts fresh and ADK agents cannot maintain
context across turns.
When a request includes `previous_interaction_id`, the server fetches
the stored conversation history from the SQL backend, prepends it
(including the model's prior response) to the new input, and calls
inference with the full context. Both streaming and non-streaming
responses are persisted for future chaining.
Key additions:
- `InteractionsStore` class (`src/ogx/providers/utils/interactions/`)
following the `ResponsesStore` pattern with `AuthorizedSqlStore` and
access control policy
- `InteractionsConfig` with `SqlStoreReference` for configurable SQL
backend (SQLite/Postgres)
- `_build_messages()` method for conversation history reconstruction,
supporting multi-hop chaining
- Updated Google Interactions API conformance score (39.0% → 40.2%)
## Test Plan
55 unit tests pass (37 existing + 5 new `previous_interaction_id` + 13
shape/passthrough tests). All 39 pre-commit hooks pass.
```bash
# Unit tests
uv run pytest tests/unit/providers/inline/interactions/ -x --tb=short -q
# End-to-end validation with Google GenAI SDK
OLLAMA_URL=http://localhost:11434/v1 uv run --extra starter ogx stack run starter --port 8321
uv run scripts/test_interactions_api.py --base-url http://localhost:8321 --model ollama/llama3.2:3b
```
Test 5 validates conversation chaining: creates a first interaction
establishing context ("My name is Alice"), then chains from it with
`previous_interaction_id` and verifies the model remembers the name.
---------
Signed-off-by: Sébastien Han <seb@redhat.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Francisco Javier Arceo <arceofrancisco@gmail.com>
Co-authored-by: Charlie Doern <cdoern@redhat.com>
Copy file name to clipboardExpand all lines: docs/docs/providers/interactions/inline_builtin.mdx
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,18 @@ title: inline::builtin
10
10
11
11
Serves the Google Interactions API (POST /v1alpha/interactions) so that Google GenAI SDK and ADK clients can call OGX without code changes. Requests are translated to OpenAI Chat Completions and routed to whichever inference provider is configured (vLLM, Ollama, OpenAI, Bedrock, etc.). When the provider is Gemini, non-streaming requests are forwarded directly to the native /v1beta/interactions endpoint, avoiding double translation.
12
12
13
+
## Configuration
14
+
15
+
| Field | Type | Required | Default | Description |
|`store`|`SqlStoreReference`| No | table_name='interactions' backend='sql_default' | SQL store for persisting interaction state (conversation chaining). |
18
+
|`store.table_name`|`str`| No || Name of the table to use for the SqlStore |
19
+
|`store.backend`|`str`| No || Name of backend from storage.backends |
0 commit comments