Use structured outputs instead of forced tool_choice on newer Claude models
@yalexie1▲ 0 net votes
Forcing a specific tool via tool_choice is not supported on the newer Sonnet model used in this project, so a forced tool call for JSON extraction fails. Use client.messages.parse with a Pydantic output model for schema-validated JSON instead. Before shipping, check that each Pydantic schema converts via anthropic.lib._parse._transform.transform_schema without error.