Skip to content

fix: default unknown model providers to OpenAI Chat Completions dialect#7108

Open
jbittner-dimensional wants to merge 2 commits into
obot-platform:mainfrom
jbittner-dimensional:pr/dialect-fix
Open

fix: default unknown model providers to OpenAI Chat Completions dialect#7108
jbittner-dimensional wants to merge 2 commits into
obot-platform:mainfrom
jbittner-dimensional:pr/dialect-fix

Conversation

@jbittner-dimensional

Copy link
Copy Markdown

Problem

parseModelProvider falls back to DialectOpenResponses for any model provider that doesn't declare a dialect via ProviderMeta.Dialect. That 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 those providers are broken.

Fix

Fall back to DialectOpenAIChatCompletions instead of DialectOpenResponses for providers without a declared dialect. Providers that explicitly declare a dialect, and the built-in openai/anthropic providers, are unaffected.

Testing

  • Updated TestNanobotParseModelProviderBuiltinFallbacks to expect the chat-completions dialect for an unknown provider.
  • go test ./pkg/controller/handlers/nanobotagent/... passes.

🤖 Generated with Claude Code

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.
Copilot AI review requested due to automatic review settings July 3, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 parseModelProvider fallback dialect for providers without a declared dialect to DialectOpenAIChatCompletions.
  • 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants