[ 
https://issues.apache.org/jira/browse/CAMEL-26203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136904#comment-18136904
 ] 

Claus Ibsen commented on CAMEL-26203:
-------------------------------------

PR: https://github.com/apache/camel/pull/29028

1. webSearchRequest is no longer autowired. The same for additionalParams (a 
Map), which took the only Map bean of the registry. An endpoint uses them only 
when it refers to them.
2. With resultType=CONTENT a result without content now gives its snippet, for 
a single result and in a List. Google Custom Search never gives content, and 
Tavily only with includeRawContent, so the default gave null for every found 
result.

Both are in the 4.24 upgrade guide.

_Claude Code on behalf of Claus Ibsen (davsclaus)_

> camel-langchain4j-web-search - a WebSearchRequest bean in the registry 
> replaces the message body on every endpoint
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26203
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26203
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-langchain4j-web-search
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Found while adding the catalog body types of langchain4j-web-search 
> (CAMEL-24961, PR #28401).
> h4. 1. A single WebSearchRequest bean in the registry silently replaces the 
> body on every endpoint
> The {{webSearchRequest}} option of {{LangChain4jWebSearchConfiguration}} 
> (main 2a465aa4814c, line 59) is {{autowired = true}}. With one 
> {{WebSearchRequest}} bean in the registry every langchain4j-web-search 
> endpoint uses it, and {{LangChain4jWebSearchProducer}} (lines 46-49) builds 
> the request from the body only when that option is null, so the search terms 
> in the body are ignored. The bean's {{maxResults}} is then used too (line 
> 70): unless it is 1 (it is null when not set) the output becomes a List 
> instead of a single result (line 95). Checked on 4.24.0-SNAPSHOT with a fake 
> {{WebSearchEngine}}.
> Proposed: do not autowire {{webSearchRequest}} (it is an advanced, 
> per-endpoint option).
> h4. 2. With maxResults=1 a result without content gives null, like no result
> With {{maxResults=1}} and {{resultType=CONTENT}} (the default), 
> {{computeResponse}} (line 98) sets the body to {{content()}} of the first 
> result, which is null when the engine returns only a title, link and snippet. 
> The route cannot tell this from "no result" (line 90 also sets null). Checked 
> on 4.24.0-SNAPSHOT with a fake {{WebSearchEngine}}.
> Proposed: fall back to the snippet when the content is null, or document that 
> CONTENT may be null for a found result.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to