Skip to content

fix: add provider-safe structured output mode - #123

Merged
radu-mocanu merged 1 commit into
mainfrom
fix/provider-safe-structured-output
Aug 6, 2026
Merged

fix: add provider-safe structured output mode#123
radu-mocanu merged 1 commit into
mainfrom
fix/provider-safe-structured-output

Conversation

@radu-mocanu

Copy link
Copy Markdown
Collaborator

Summary

  • add opt-in method="auto" structured output for the normalized chat client
  • use JSON mode for Anthropic models and sequential function calling for other providers
  • preserve every explicit method and the existing function_calling default
  • make include_raw=True work with standard LangChain message-list inputs

Why

The normalized API unifies transport, but providers still differ in structured-output capabilities: Gemini rejects the OpenAI response formats used by JSON mode and JSON schema, while Claude Haiku can return an incomplete schema through function calling even when parallel calls are disabled. Centralizing the capability choice in this client keeps Health Score and other consumers provider-independent.

Validation

  • uv run ruff check
  • uv run ruff format --check
  • uv run pyright .
  • normalized client unit tests: 17 passed, 1 skipped, 1 expected xpass
  • live Alpha validation: 6/6 passed with Haiku, Gemini 2.5 Flash, and GPT-4o across both agentsplaygrounddataresidency and agentsplaygroundfallback

@radu-mocanu
radu-mocanu merged commit ee7a21b into main Aug 6, 2026
11 checks passed
@radu-mocanu
radu-mocanu deleted the fix/provider-safe-structured-output branch August 6, 2026 13:50
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.

3 participants