Repository navigation
join assistant text with tool calls for configured Chat models - #260
Closed
polyominal wants to merge 3 commits into
Closed
polyominal wants to merge 3 commits into
polyominal wants to merge 3 commits into
Conversation
Allow a model that serves Responses through Chat to accept one assistant text message between a group of function calls and their matching results. Keep existing content and each text part in order on the calling turn. Preserve the result order and require a result for each call ID before forwarding the request. Record the applied repair with the actual upstream exchange so an operator can distinguish a transformed history from an ordinary one. AI-assisted: gpt-6.2-astra
Group replayed output from one Chat response before checking for the configured history repair. A replay with its original item IDs then takes the same path for a strict model and one with the repair enabled. Exercise a repaired call alongside an ordinary call in a budgeted route. Keep the actual upstream bodies, the applied repair on its exchange, and the reported cache reads and writes in the route's spend. AI-assisted: gpt-6.2-astra
Read the repair from the completed conversion before handing the exchange to its record, alongside the actual upstream protocol and dropped headers. AI-assisted: gpt-6.2-astra
polyominal
marked this pull request as ready for review
November 18, 2026 21:31
polyominal
marked this pull request as draft
November 22, 2026 08:16
Collaborator
Author
|
Closing at the owner's request: depends on #259, closed with it; to be redone together when a task needs a Chat-only model. AI-assisted: claude-opus-5.5 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Some Chat deployments need the assistant's text and function calls together and every tool result immediately afterward. A Responses history can place text between the calls and their results. An operator can now select
request_repair = "join_assistant_tool_text"on a model withresponses_via_chat = true. Replaying output with the bridge’s own item IDs uses ordinary conversion, even on a model with this repair. Each repaired group keeps its text parts, call IDs, and result order. An ambiguous group is refused before a provider request is sent.The configuration gains the optional model field
request_repair. A run'smodel_answeredline gains the optional fieldkept.request_repaironly when the outgoing history changed. The record continues to store the actual Chat exchange. Therouteowns the enum shared by machine configuration and the record writer. It adds a direct dependency on the workspace's already-pinnedserdecrate so both use the same spelling.Keep::upstreamreceives the applied repair together with the upstream protocol and header names.The repair looks one item ahead in the existing translation pass. Joining text takes time and space proportional to the joined content. The exchange still makes one upstream request, with its original entry's admission, prices and budget. The applied marker adds one string to its existing log line.
Loopback tests compare the archived Chat request with the bytes received upstream, including a pair of count calls answered in reverse order. A budgeted simulated run records two Chat forwards, one repaired, and a third request refused before forwarding. The Responses route totals 20 input tokens (including 6 cache reads and 8 cache writes), 2 output tokens and $0.000066 in spend. Only the repaired exchange carries the marker. Native and strict models, ordinary histories, malformed groups and the configuration requirement are covered. The public Chat message types and LiteLLM's conversion informed the text-part handling. OpenAI Chat assistant message · LiteLLM history conversion
cargo xtask cipassed all 380 selected tests, including the existing budget exhaustion test, and the workspace documentation checks.Addresses the model-specific repair in #73.
AI-assisted: gpt-6.2-astra