gansheer commented on PR #30391:
URL: https://github.com/apache/camel/pull/30391#issuecomment-7189056038

   A use case for @jamesnetherton's blocking item 2 
([review](https://github.com/apache/camel/pull/30391#pullrequestreview-5975344258)),
 and something to add on top of the fix.
   
    Once `InvocationParameters` arguments are accepted, a route still has no 
way to supply them: the component binds `CamelLangChain4jServiceVariables` to 
`@V` and `CamelLangChain4jServiceMemoryId` to `@MemoryId`, but no header 
reaches an `InvocationParameters` parameter.
   
   That matters for RAG. LangChain4j passes the invocation parameters to 
retrieval as `Query.metadata().invocationParameters()`, and that is the only 
channel a retriever has for the caller's identity.  `CamelContentRetriever` 
(CAMEL-27544, in progress) turns a Camel route into a LangChain4j 
`ContentRetriever`, and it exposes those parameters to the retrieval route as 
the `CamelLangChain4jRetrieverParams` exchange property, so the route can scope 
its query to the caller (tenant, customer id). The prompt text is untrusted, so 
it is never used for that.
   
   Without a header, an AI Service invoked from a route cannot scope its 
retrieval:
   ```
         from("kafka:inbox")
             .setHeader("CamelLangChain4jServiceInvocationParameters", ...)   
// missing today
             .to("langchain4j-service:assistant?method=chat");
   ```
   Suggestion: a `CamelLangChain4jServiceInvocationParameters` header, a 
`Map<String, Object>`, bound to an `InvocationParameters` parameter. The chain 
then works end to end: header → `InvocationParameters` →
     query metadata → retrieval route. The memory id already flows the same way 
(`CamelLangChain4jServiceMemoryId` → `@MemoryId` → 
`CamelLangChain4jRetrieverMemoryId`).
   
   Like the memory id, the header carries identity, so the 
`removeHeaders("Camel*")` hardening from the design doc's Security section 
applies.
   
   _Generated with [Claude Code](https://claude.com/claude-code) on behalf of 
@gansheer_


-- 
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