You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Zineb Bendhiba (Jira)" <ji...@apache.org> on 2026/04/15 15:13:00 UTC

[jira] [Created] (CAMEL-23327) Summary: Add jsonSchema parameter to camel-langchain4j-agent for structured output

Zineb Bendhiba created CAMEL-23327:
--------------------------------------

             Summary: Summary: Add jsonSchema parameter to camel-langchain4j-agent for structured output
                 Key: CAMEL-23327
                 URL: https://issues.apache.org/jira/browse/CAMEL-23327
             Project: Camel
          Issue Type: New Feature
          Components: camel-langchain4j-agent
            Reporter: Zineb Bendhiba
            Assignee: Zineb Bendhiba
             Fix For: 4.20.0


The camel-openai component supports a jsonSchema endpoint parameter that enables Structured Outputs. This guarantees the LLM response conforms to a provided JSON Schema, with no prompt engineering needed for output formatting.

LangChain4j already supports the same feature through JsonRawSchema.from(schemaString) and the ResponseFormat API. Supported     providers include for now Amazon Bedrock, Azure OpenAI, Google AI Gemini, Mistral, Ollama and OpenAI.

The camel-langchain4j-agent component should expose a jsonSchema (String) endpoint parameter, consistent with camel-openai. When set, the producer would build the ResponseFormat using JsonRawSchema.

The parameter should follow same pattern as camel-openai and support resource:classpath: for loading schema files, so the usage in YAML DSL would be:  

 
{code:java}
- to: 
      uri: langchain4j-agent:myAgent
      parameters:
           jsonSchema: "resource:classpath:my-schema.json"


{code}
 

This would allow users to share the same JSON schema file across camel-openai and camel-langchain4j-agent routes.

References:                                                                                                                       
 * [LangChain4j Structured Outputs docs[|https://docs.langchain4j.dev/tutorials/structured-outputs/|https://docs.langchain4j.dev/tutorials/structured-outputs]]
 * camel-openai jsonSchema parameter (introduced in 4.18)    



--
This message was sent by Atlassian Jira
(v8.20.10#820010)