[
https://issues.apache.org/jira/browse/CAMEL-22328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
James Netherton resolved CAMEL-22328.
-------------------------------------
Resolution: Fixed
> camel-langchain4j-tools: Avoid using JsonNode for parameter header values
> -------------------------------------------------------------------------
>
> Key: CAMEL-22328
> URL: https://issues.apache.org/jira/browse/CAMEL-22328
> Project: Camel
> Issue Type: Improvement
> Components: camel-langchain4j-tools
> Reporter: James Netherton
> Assignee: James Netherton
> Priority: Minor
> Fix For: 4.14.0
>
>
> I followed this example as the basis for some langchain4j-tools testing in
> Camel Quarkus:
> https://camel.apache.org/components/next/langchain4j-tools-component.html#_parameters
> With an H2 database I get:
> {code:java}
> Caused by: org.h2.jdbc.JdbcSQLDataException: Data conversion error converting
> "JAVA_OBJECT to BIGINT"; SQL statement:
> SELECT first_name, last_name FROM users WHERE id = ?{code}
> It happens because LangChain4jToolsProducer sets the header for the parameter
> value to a Jackson JsonNode.
> https://github.com/apache/camel/blob/main/components/camel-ai/camel-langchain4j-tools/src/main/java/org/apache/camel/component/langchain4j/tools/LangChain4jToolsProducer.java#L153-L156
> So I had to manually deal with it like this:
> https://github.com/apache/camel-quarkus/blob/main/integration-tests/langchain4j-tools/src/main/java/org/apache/camel/quarkus/component/langchain4j/tools/it/Langchain4jToolsRoutes.java#L35-L43
> We could do this automatically in LangChain4jToolsProducer by checking the
> type of JsonNode and using camel-jackson type converters to get the
> underlying value (where possible).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)