Skip to content

feat(claude): add structured output support#709

Open
marwan38 wants to merge 1 commit intocloudwego:mainfrom
marwan38:claude-json-schema
Open

feat(claude): add structured output support#709
marwan38 wants to merge 1 commit intocloudwego:mainfrom
marwan38:claude-json-schema

Conversation

@marwan38
Copy link
Copy Markdown

@marwan38 marwan38 commented Mar 3, 2026

What type of PR is this?

feat: claude structured json output

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
zh(optional):

(Optional) Which issue(s) this PR fixes:

(optional) The PR that updates user documentation:

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 3, 2026

CLA assistant check
All committers have signed the CLA.

@marwan38 marwan38 force-pushed the claude-json-schema branch from 7ea8ccb to cce4365 Compare March 3, 2026 13:06
// ResponseFormat configures structured JSON output using a JSON schema.
type ResponseFormat struct {
// Schema is the JSON schema that the model's response must conform to.
Schema *jsonschema.Schema `json:"schema"`
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I was hesitant on providing a wrapper for ResponseFormat, but this is consistent in how all the other models define it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I wasn't sure if example > readme.
I found the readme helpful on the documentation website when I initially started using eino.
examples/ are better for more complex use cases, and I don't think this is one.

@marwan38 marwan38 force-pushed the claude-json-schema branch from cce4365 to 1b8f987 Compare March 3, 2026 13:39
@vika2603
Copy link
Copy Markdown

vika2603 commented Mar 5, 2026

I need this feature. Thank you

@marwan38 marwan38 force-pushed the claude-json-schema branch 4 times, most recently from ba26990 to b74103f Compare March 11, 2026 14:02
@marwan38
Copy link
Copy Markdown
Author

Sorry, not sure who I can tag @hi-pender.
I don't want this to go stale.

@marwan38 marwan38 force-pushed the claude-json-schema branch from b74103f to 0ca1d91 Compare March 18, 2026 08:33
@marwan38
Copy link
Copy Markdown
Author

Seems like Anthropics structured output API does not work like I expected.

During agentic runs (ReAct), claude would ALWAYS short circuit and stop with reason: end_turn and set a placeholder output. Perhaps my ignorance in LLM, or rather the mess of it, made me expect something but get another.

or perhaps there's something wrong on my end..

@marwan38 marwan38 force-pushed the claude-json-schema branch from 0ca1d91 to 8311c67 Compare March 24, 2026 07:35
@marwan38 marwan38 force-pushed the claude-json-schema branch from 8311c67 to c75251f Compare March 24, 2026 07:37
@shentongmartin shentongmartin added C-enhancement This is a PR that adds a new feature or fixes a bug. D-chatmodel-impl Domain: This is an issue related to particular ChatModel implementation labels Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement This is a PR that adds a new feature or fixes a bug. D-chatmodel-impl Domain: This is an issue related to particular ChatModel implementation

Development

Successfully merging this pull request may close these issues.

4 participants