Skip to content

[Feature] Render a flat RowTypeInfo output schema as JSON Schema #1256

Open

Description

@weiqingy

Search before asking

  • I searched in the issues and found nothing similar.

Description

@wenjin272 suggested this on #1129.

A RowTypeInfo output schema never gets native structured output today:

  • The native connections accept only a POJO class (Java) or a pydantic model (Python), so they skip a RowTypeInfo.
  • The prompt path describes the schema with the type's string form (toString() in Java, str() in Python), not JSON Schema.
  • The Java BaseChatModelConnection.chat Javadoc calls the skip a permanent fallback.

Proposal: render a flat RowTypeInfo (basic field types only) as a JSON Schema object, in both languages:

  • every field required
  • additionalProperties: false

Use it in two steps:

  1. In the prompt, in place of the string form.
  2. As the native schema, so AUTO and NATIVE work for a RowTypeInfo. The connections currently take a class, so this step needs them to accept a schema document as well.

A nested or non-basic RowTypeInfo keeps today's behavior. The guide and the Javadoc above are updated to match.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added
    feature[Issue Type] New features or improvements to existing features.
    priority/majorDefault priority of the PR or issue.
    on Oct 14, 2026
  2. weiqingy commented on Oct 16, 2026

    @weiqingy
    CollaboratorAuthor

    @sangkyoonnam Thanks for taking this. Your two-step split matches the issue. GitHub only lets me assign people who have commented on the issue, so please leave a comment here and I'll assign it to you.

    Pointers for the first step:

    • The prompt text is built in ReActAgent (Java, outputSchema.toString()) and react_agent.py (Python, str(output_schema)). The same string feeds both the schema prompt and the native-schema prompt.
    • Please render the same JSON Schema for the same row type in both languages, with a test on each side.
    • The response becomes a Row in ChatModelAction.generateStructuredOutput (Java) and _generate_structured_output (Python). Both copy the JSON values without converting them to the field types, and a missing field gives null in Java but a KeyError in Python. That can stay out of scope, but a test that checks field types may run into it.

    For the second step: #1266 moves the six Python _native_output_model copies into one helper, and the native step changes that same check. Whichever lands first, the other can rebase onto it.

    Happy to review.

  3. sangkyoonnam commented on Oct 16, 2026

    @sangkyoonnam
    Contributor

    Commenting here so you can assign it to me, @weiqingy. Thanks for the pointers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature[Issue Type] New features or improvements to existing features.priority/majorDefault priority of the PR or issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions