Support Azure AI Foundry OpenAI models via the Responses API (Fixes #47)#48
Merged
Conversation
Azure AI Foundry now serves OpenAI deployments (e.g. gpt-5.x) through the OpenAI Responses API at /openai/v1/responses. That API replaces the Chat Completions "messages" field with "input" and returns an "output" array instead of "choices", so PiPiMink's Chat Completions path failed with HTTP 400 "Unsupported parameter: 'messages'" and auto-disabled the model. Backend: - New provider type "openai-responses" plus auto-detection when a chat_path targets "/responses" (forward compatibility with future migrations). - New ProviderConfig helpers UsesResponsesAPI() and ResponsesURL(). - New internal/llm/responses.go: buildResponsesInput/buildResponsesPayload, extractResponsesContent (output->message->output_text, with error and incomplete_details handling), and a shared send helper. - Wired the Responses path into tagging, chat, model selection, and the benchmark judge. temperature and max_output_tokens are omitted by default so reasoning models are not rejected. Frontend: - Added "openai-responses" to the ProviderType union, the provider and per-model type selectors, a provider-list badge, and a chat-path hint. Docs & config: - README, SETUP (new endpoint pattern), CHANGELOG, AGENTS, copilot-instructions, providers.example.json, and .env.example. Tests: - config: UsesResponsesAPI/ResponsesURL/ForModel override. - llm: buildResponsesInput/Payload and extractResponsesContent cases; end-to-end chat test asserting the /responses endpoint and "input" body. Fixes #47
… /openai/v1/responses
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.
What
Adds support for Azure AI Foundry OpenAI models served through the OpenAI Responses API (
/openai/v1/responses).Fixes #47.
Why
Azure AI Foundry now serves OpenAI deployments (e.g.
gpt-5.x) via the Responses API, which replaces the Chat Completionsmessagesfield withinputand returns anoutputarray instead ofchoices. PiPiMink only spoke Chat Completions, so tagging/chat/routing/benchmarking failed with:…and the model was auto-disabled.
How
Backend
openai-responses, plus auto-detection when achat_pathtargets/responses(so existing path-only overrides work and future migrations keep working).ProviderConfig.UsesResponsesAPI()andResponsesURL()helpers.internal/llm/responses.go: request builder (input) and a robust response parser (output→message→output_text, witherrorandincomplete_detailshandling).temperatureandmax_output_tokensare omitted by default so reasoning models (o-series, gpt-5.x) are not rejected and manage their own output budget.Frontend
openai-responsesadded to the type union, the provider and per-model type selectors, a provider-list badge, and a chat-path hint.Docs & config
providers.example.json,.env.example.Testing
go build ./...,go test -short ./...— all pass.UsesResponsesAPI/ResponsesURL/ForModeloverride;buildResponsesInput/buildResponsesPayload/extractResponsesContent; an end-to-end chat test asserting the/responsesendpoint is hit and the body usesinput(notmessages).tsc --noEmit,vitest run(22 passed),npm run build— all pass.markdownlint-cli2— 0 errors.How to configure
{ "name": "gpt-5", "type": "openai-responses", "chat_path": "/openai/v1/responses", "api_key_env": "AZURE_FOUNDRY_GPT5_API_KEY" }