fix: default unknown model providers to OpenAI Chat Completions dialect#7108
Open
jbittner-dimensional wants to merge 2 commits into
Open
fix: default unknown model providers to OpenAI Chat Completions dialect#7108jbittner-dimensional wants to merge 2 commits into
jbittner-dimensional wants to merge 2 commits into
Conversation
parseModelProvider fell back to DialectOpenResponses for providers that don't declare a dialect, which makes nanobot POST to /v1/responses on the proxied endpoint. Most "OpenAI compatible" services (LM-Studio, Ollama, vLLM, llama.cpp) and Obot's own generic-openai-model-provider only implement /v1/chat/completions, so any provider without a declared dialect was broken. Fall back to OpenAI Chat Completions instead.
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts nanobot’s default LLM provider dialect selection so “unknown”/undeclared providers use the more widely supported OpenAI Chat Completions API, preventing nanobot from attempting /v1/responses against OpenAI-compatible backends that only expose /v1/chat/completions.
Changes:
- Changed
parseModelProviderfallback dialect for providers without a declared dialect toDialectOpenAIChatCompletions. - Updated the corresponding unit test to assert the new fallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/controller/handlers/nanobotagent/nanobotagent.go | Changes the default dialect fallback for undeclared providers to Chat Completions and updates the inline rationale. |
| pkg/controller/handlers/nanobotagent/nanobotagent_test.go | Updates fallback expectations in TestNanobotParseModelProviderBuiltinFallbacks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+409
to
+413
| // If the provider has declared a dialect via ProviderMeta.Dialect, that dialect | ||
| // is used and the base URL is derived from it. Otherwise the known built-in | ||
| // providers (openai, anthropic) supply both; everything else falls back to | ||
| // OpenResponses via the generic /api/llm-proxy dispatch. | ||
| // OpenAI Chat Completions via the generic /api/llm-proxy dispatch, since most | ||
| // "OpenAI compatible" services only implement /v1/chat/completions. |
…dialect Addresses review feedback: the fallback reads resolvedLLMModel.ProviderDialect (from the model manifest's Dialect field), not ProviderMeta.Dialect.
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.
Problem
parseModelProviderfalls back toDialectOpenResponsesfor any model provider that doesn't declare a dialect viaProviderMeta.Dialect. That makes nanobot POST to/v1/responseson the proxied endpoint. Most "OpenAI compatible" services — LM-Studio, Ollama, vLLM, llama.cpp — and Obot's owngeneric-openai-model-provideronly implement/v1/chat/completions, so those providers are broken.Fix
Fall back to
DialectOpenAIChatCompletionsinstead ofDialectOpenResponsesfor providers without a declared dialect. Providers that explicitly declare a dialect, and the built-in openai/anthropic providers, are unaffected.Testing
TestNanobotParseModelProviderBuiltinFallbacksto expect the chat-completions dialect for an unknown provider.go test ./pkg/controller/handlers/nanobotagent/...passes.🤖 Generated with Claude Code