feat(agent): Responses API transport for Responses-only models - #267
Open
darylfung96 wants to merge 3 commits into
Open
darylfung96 wants to merge 3 commits into
darylfung96 wants to merge 3 commits into
Conversation
…efix) Some gateways serve models exclusively on /v1/responses and 503 /v1/chat/completions. A KB can now opt in with e.g. model: openai-responses/muse-spark-1.3-contributor. - New openkb/responses.py: message/tool/response_format translation, Chat-Completions-shaped adapter, Agents-SDK OpenAIResponsesModel builder - compiler: route _llm_call/_llm_call_async through litellm.responses - query/chat/lint/skills/decks: Agent constructors + run-config builder use the Responses model (creds from bundle, else env) - indexer: clear error for long-PDF PageIndex path (needs completions) - Docs + 12 unit tests
…through - Trim module/function docstrings to the why; fix stale blocks claim - Extract _translate_content shared by both message paths (also fixes untranslated blocks on assistant+tool_calls messages) - _to_dict: explicit continue on failed coercion - Top-level third-party imports (no cycle); SDK wiring test
The openai-responses/ prefix works with any model id on any OpenAI-compatible Responses endpoint; examples now use neutral placeholders instead of a specific model.
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.
native OpenAI Responses API transport via openai-responses/ model prefix
Problem
Some gateways serve certain models exclusively on /v1/responses and answer /v1/chat/completions with 503 Endpoint is unavailable.
OpenKB talks to LLMs only through LiteLLM Chat Completions, so those models are completely unusable — compile, query, chat, lint, and
skills all fail.
Solution
Opt-in native Responses API transport. Prefixing the model id routes every agent call through the Responses API instead:
The prefix is OpenKB-only (stripped before anything reaches LiteLLM). Responses are adapted back to the Chat Completions shape, so all
existing call sites work unchanged — including tool calls and run_streamed sessions.
What's changed
OpenAIResponsesModel builder (per-KB creds, env fallback for CLI)
model; Chat Completions behavior untouched
Usage
Credentials work as usual (LLM_API_KEY + OPENAI_API_BASE, plus litellm.extra_headers if the gateway needs routing headers).
Limitations
untested
Testing