Croway commented on code in PR #23793:
URL: https://github.com/apache/camel/pull/23793#discussion_r3363284264


##########
components/camel-ai/camel-langchain4j-agent/src/main/java/org/apache/camel/component/langchain4j/agent/LangChain4jAgentProducer.java:
##########
@@ -294,6 +303,48 @@ private Map<String, CamelToolSpecification> 
discoverToolsByName(String tags) {
         return toolsByName;
     }
 
+    /**
+     * Resolves the jsonSchema endpoint property: loads from 
classpath/filesystem if it is a resource URI, otherwise
+     * treats it as inline JSON. Converts the raw JSON string into a 
langchain4j ResponseFormat and sets it on the
+     * agent. Only called when the agent is created internally from 
agentConfiguration.
+     */
+    private void resolveAndApplyJsonSchema() throws Exception {
+        String jsonSchema = endpoint.getConfiguration().getJsonSchema();
+        if (ObjectHelper.isEmpty(jsonSchema)) {
+            return;
+        }
+
+        String resolved = 
endpoint.getCamelContext().resolvePropertyPlaceholders(jsonSchema);
+
+        String content = resolveResourceContent(resolved);
+        if (content != null) {

Review Comment:
   what happen if a non existent json file is passed? ala 
`jsonSchema=non-existent.json`.
   
   Maybe overkill, what happen if the passed file is not a json?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to