Skip to content

OpenRouter Anthropic model doesn't support structured output #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
riywo opened this issue May 10, 2025 · 0 comments
Open

OpenRouter Anthropic model doesn't support structured output #18

riywo opened this issue May 10, 2025 · 0 comments

Comments

@riywo
Copy link
Contributor

riywo commented May 10, 2025

[2025-05-09 17:46:15.797 -0700] INFO: Test result: FAIL, Summary:
Error: Failed to parse. Text: "". Error: SyntaxError: Unexpected end of JSON input

Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE/

[2025-05-09 17:46:15.799 -0700] INFO: LLM usage: OpenRouter/anthropic/claude-3.7-sonnet ($0.18955) Total input: $0.18289/60,964tk output: $0.00666/444tk cachedRead: $0.00000/0tk cachedWrite: $0.00000/0tk

Because response_format isn't supported: https://openrouter.ai/models?fmt=cards&supported_parameters=response_format&arch=Claude

So, we must fail earlier if Anthropic models are specified on OPENROUTER_MODEL.

When selecting a model, we should hit this API and check the capabilities: https://openrouter.ai/docs/api-reference/list-endpoints-for-a-model

Note: Directly using Anthropic models i.e. ANTRHOPIC_MODEL is fine. This is only an issue with OpenRouter and Anthropic.

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

No branches or pull requests

1 participant