#Structured outputs with anthropic/claude-3.5-sonnet:beta not working

1 messages · Page 1 of 1 (latest)

spare juniper
#

I am unable to get structred outputs working using the openai python library, with openrouter as the backend and anthropic/claude-3-opus:beta as the selected model
it just responds in plain text, causing the structured output parsing to fail, whereas if I switch the model to gpt4o, structured outputs work
according to the openrouter website, anthropic/claude-3.5-sonnet:beta should support tool calling

balmy onyx
#

Can you share your prompt

agile sorrel
#

hi, you can't use the structured output feature with anthropic/claude-3.5-sonnet:beta yet (the upstream doesn't support the similar schema / method overall). it's only available for openai models.

spare juniper
#

why does the openrouter website say that claude3.5 supports tool calling then?

#

is anthropic tool calling via openrouter incompatible with the openai python module due to anthropic using a different tool calling interface to openai?

agile sorrel
#

tool calling and structured output is partially different features.

#

claude 3.5 supports tool calling as you've mentioned, however it does not allow you to specify output types or schema (using zod or pydantic)

spare juniper
#

ah ok thx I see.

#

in the context of openai models, is it recommended to use tool calling whenever using structured outputs? or can structured outputs be used independently?

agile sorrel