[
https://issues.apache.org/jira/browse/CAMEL-26411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Federico Mariani reassigned CAMEL-26411:
----------------------------------------
Assignee: Federico Mariani
> camel-jbang - AI tools: camel_eval_expression evaluates a JSON body as parsed
> data, and its answers name a missing body or an unset header
> ------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26411
> URL: https://issues.apache.org/jira/browse/CAMEL-26411
> Project: Camel
> Issue Type: Improvement
> Components: camel-jbang, camel-jbang-mcp
> Reporter: Claus Ibsen
> Assignee: Federico Mariani
> Priority: Minor
> Fix For: 4.24.0
>
>
> A follow-up to CAMEL-26400, from the local-model benchmark (qwen3.6:35b on
> Ollama, run r24 on Oct 29-30 2026).
> The model used camel_eval_expression more than before: 63 calls, against 24
> in the run before. No step of the series failed because of CAMEL-26400. But
> some answers sent the model the wrong way:
> * *A JSON body is text.* With the JSON passed as body,
> {{$\{body[lines].size()\}}} fails with "the body is text (a String):
> unmarshal it first (unmarshal: json) to read its fields". That is right for a
> route, but the model cannot unmarshal inside the tool, so it cannot test the
> expression the way the route will see the body after unmarshal: json. In
> route-filter-and-multicast step 2, it sent the same call 10 times in a row.
> * *body.lines on text.* {{$\{body.lines.size()\}}} on a JSON text body calls
> String.lines(), and the answer is "Method with name: size() not found on
> bean: java.util.stream.ReferencePipeline$Head".
> * *jsonpath with no body.* The answer is "java.lang.IllegalArgumentException:
> json string can not be null or empty" (3 calls). It does not say that the
> JSON goes in body.
> * *No body is empty text, not null.* {{$\{body} == null}} answers false, also
> with "body": null. A route before any step has a null body.
> * *An unset Camel header.* {{$\{header.CamelRedeliveryCounter\}}} gives
> nullResult with the note "a header, property or variable that is not set".
> The model then tried {{$\{exchangeProperty.CamelRedeliveryCounter\}}}, which
> is also null. The note could say that the header is not set in the test
> exchange, and that the headers argument sets it.
> Proposal:
> * A way to evaluate against a JSON body as parsed data (a Map or a List, as
> after unmarshal: json), for example when the expression reads fields of a
> body that is JSON text. The answer says that it did so.
> * Name the missing body for jsonpath (and the other languages that need one).
> * Evaluate with a null body when no body is given, or say in the note that
> the body is empty text.
> * For an unset header, point to the headers argument.
> * Note an identical repeated call ("same call as before, same answer").
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)