[ 
https://issues.apache.org/jira/browse/CAMEL-23327?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zineb Bendhiba updated CAMEL-23327:
-----------------------------------
    Description: 
Updated the issue due to investigation, check comments below.

-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/]-
 * -camel-openai jsonSchema parameter (introduced in 4.18)-    

  was:
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)    


> Langchain4j: document and test 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
>            Priority: Major
>             Fix For: 4.20.0
>
>
> Updated the issue due to investigation, check comments below.
> -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/]-
>  * -camel-openai jsonSchema parameter (introduced in 4.18)-    



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

Reply via email to