This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new a8cd7c27ff07 CAMEL-26203: camel-langchain4j-web-search - do not
autowire webSearchRequest and additionalParams, and give the snippet of a
result without content (#29028)
a8cd7c27ff07 is described below
commit a8cd7c27ff07e22f79c76b27a82d0ee2a0fd1fe6
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Nov 3 11:45:20 2026 +0100
CAMEL-26203: camel-langchain4j-web-search - do not autowire
webSearchRequest and additionalParams, and give the snippet of a result without
content (#29028)
…Request and additionalParams, and give the snippet of a result without
content
The webSearchRequest and additionalParams options were autowired, so the
only
WebSearchRequest bean of the registry replaced the search terms of the body
on
every endpoint (and its maxResults decided between a single result and a
List),
and the only Map bean of the registry was sent as the additional parameters
of
every search. They are no longer autowired; an endpoint uses them only when
it
refers to them.
With resultType=CONTENT a result without content gave null, the same as no
result. Google Custom Search never gives content, and Tavily only with
includeRawContent, so the default gave null for every found result. A result
without content now gives its snippet, as LangChain4j does when it turns a
result into text.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../catalog/components/langchain4j-web-search.json | 8 +-
.../docs/langchain4j-web-search-component.adoc | 18 +++--
.../LangChain4jWebSearchEndpointConfigurer.java | 2 +-
.../web/search/langchain4j-web-search.json | 8 +-
.../docs/langchain4j-web-search-component.adoc | 18 +++--
.../search/LangChain4jWebSearchConfiguration.java | 10 +--
.../web/search/LangChain4jWebSearchEndpoint.java | 6 +-
.../web/search/LangChain4jWebSearchProducer.java | 13 +++-
.../LangChain4jWebSearchAdditionalParamsTest.java | 87 +++++++++++++++++++++
.../search/LangChain4jWebSearchAutowireTest.java | 90 ++++++++++++++++++++++
.../search/LangChain4jWebSearchContentTest.java | 77 ++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 11 +++
...LangChain4jWebSearchEndpointBuilderFactory.java | 18 +++--
13 files changed, 325 insertions(+), 41 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/langchain4j-web-search.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/langchain4j-web-search.json
index 958cb858d59e..22a9cbe1a52b 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/langchain4j-web-search.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/langchain4j-web-search.json
@@ -29,20 +29,20 @@
},
"bodyTypes": {
"producerIn": { "carriers": [ "any" ], "description": "The search terms as
text; another body is converted to text, so a Map or a POJO is searched as its
toString(), and no body fails. With webSearchRequest the body is not read" },
- "producerOut": { "carriers": [ "text", "null" ], "dependsOn": [
"maxResults", "webSearchRequest" ], "byOption": [ { "option": "resultType",
"value": "LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT", "carriers": [ "pojo", "null"
] } ], "description": "The content of the first result as text (its snippet
with resultType SNIPPET, the WebSearchOrganicResult with
LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT), or null when there is no result or the
engine gives no content. With maxResults above 1 it is a [...]
+ "producerOut": { "carriers": [ "text", "null" ], "dependsOn": [
"maxResults", "webSearchRequest" ], "byOption": [ { "option": "resultType",
"value": "LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT", "carriers": [ "pojo", "null"
] } ], "description": "The content of the first result as text (its snippet
with resultType SNIPPET, the WebSearchOrganicResult with
LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT), or null when there is no result. A
result without content gives its snippet. With maxResults abo [...]
},
"properties": {
"searchId": { "index": 0, "kind": "path", "displayName": "Search Id",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "The id" },
- "additionalParams": { "index": 1, "kind": "parameter", "displayName":
"Additional Params", "group": "producer", "label": "", "required": false,
"type": "object", "javaType": "java.util.Map<java.lang.String,
java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired":
true, "secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The additionalPar [...]
+ "additionalParams": { "index": 1, "kind": "parameter", "displayName":
"Additional Params", "group": "producer", "label": "", "required": false,
"type": "object", "javaType": "java.util.Map<java.lang.String,
java.lang.Object>", "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The additionalParams is
the additional [...]
"geoLocation": { "index": 2, "kind": "parameter", "displayName": "Geo
Location", "group": "producer", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The geoLocation is the
desired geolocation for search results. Each search engine [...]
"language": { "index": 3, "kind": "parameter", "displayName": "Language",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The language is the
desired language for search results. The expected values may vary dep [...]
"maxResults": { "index": 4, "kind": "parameter", "displayName": "Max
Results", "group": "producer", "label": "", "required": true, "type":
"integer", "javaType": "java.lang.Integer", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue": 1,
"configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The maxResults is the
expected number of [...]
- "resultType": { "index": 5, "kind": "parameter", "displayName": "Result
Type", "group": "producer", "label": "", "required": true, "type": "enum",
"javaType":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchResultType",
"enum": [ "LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT", "CONTENT", "SNIPPET" ],
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "defaultValue": "CONTENT", "configurationClass":
"org.apache.camel.component.langchain4j. [...]
+ "resultType": { "index": 5, "kind": "parameter", "displayName": "Result
Type", "group": "producer", "label": "", "required": true, "type": "enum",
"javaType":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchResultType",
"enum": [ "LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT", "CONTENT", "SNIPPET" ],
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "defaultValue": "CONTENT", "configurationClass":
"org.apache.camel.component.langchain4j. [...]
"safeSearch": { "index": 6, "kind": "parameter", "displayName": "Safe
Search", "group": "producer", "label": "", "required": false, "type":
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The safeSearch is the
safe search flag, indicating whether [...]
"startIndex": { "index": 7, "kind": "parameter", "displayName": "Start
Index", "group": "producer", "label": "", "required": false, "type": "integer",
"javaType": "java.lang.Integer", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The startIndex is the
start index for search results, which may vary depending on [...]
"startPage": { "index": 8, "kind": "parameter", "displayName": "Start
Page", "group": "producer", "label": "", "required": false, "type": "integer",
"javaType": "java.lang.Integer", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The startPage is the
start page number for search results" },
"webSearchEngine": { "index": 9, "kind": "parameter", "displayName": "Web
Search Engine", "group": "producer", "label": "", "required": true, "type":
"object", "javaType": "dev.langchain4j.web.search.WebSearchEngine",
"deprecated": false, "deprecationNote": "", "autowired": true, "secret": false,
"configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The WebSearchEngine
engine [...]
"lazyStartProducer": { "index": 10, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
- "webSearchRequest": { "index": 11, "kind": "parameter", "displayName":
"Web Search Request", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"dev.langchain4j.web.search.WebSearchRequest", "deprecated": false,
"deprecationNote": "", "autowired": true, "secret": false,
"configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The webSearch [...]
+ "webSearchRequest": { "index": 11, "kind": "parameter", "displayName":
"Web Search Request", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"dev.langchain4j.web.search.WebSearchRequest", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The webSearchRequest is
the custom [...]
}
}
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-web-search-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-web-search-component.adoc
index b9fa7bd06f8b..df75602d3848 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-web-search-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-web-search-component.adoc
@@ -77,7 +77,7 @@ WebSearchEngine tavilyWebSearchEngine =
TavilyWebSearchEngine.builder()
.build();
----
-The web search engine will be autowired automatically if its bound name is
`web-search-engine`. Otherwise, it should be added as a configured parameter to
the Camel route.
+The web search engine is autowired when it is the only `WebSearchEngine` in
the registry. Otherwise, it should be added as a configured parameter to the
Camel route.
.Example:
[tabs]
@@ -87,7 +87,7 @@ Java::
[source,java]
----
from("direct:web-search")
- .to("langchain4j-web-search:test?webSearchEngine=#web-search-engine-test");
+ .to("langchain4j-web-search:test?webSearchEngine=#web-search-engine");
----
XML::
@@ -96,7 +96,7 @@ XML::
----
<route>
<from uri="direct:web-search"/>
- <to
uri="langchain4j-web-search:test?webSearchEngine=#web-search-engine-test"/>
+ <to uri="langchain4j-web-search:test?webSearchEngine=#web-search-engine"/>
</route>
----
@@ -111,7 +111,7 @@ YAML::
- to:
uri: langchain4j-web-search:test
parameters:
- webSearchEngine: "#web-search-engine-test"
+ webSearchEngine: "#web-search-engine"
----
====
@@ -148,6 +148,8 @@ List<String> responses =
template.requestBody("langchain4j-web-search:test?maxRe
You can get different types of Results.
+With the default `resultType` = CONTENT, a result without content returns its
snippet instead. Some engines give no content: Google Custom Search never does,
and Tavily only with `includeRawContent(true)`.
+
When `resultType` = SNIPPET, you will get a single or list (depending on
`maxResults` value) of Strings containing the snippets.
When `resultType` = LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT, you will get a
single or list (depending on `maxResults` value) of Objects of type
`WebSearchOrganicResult` containing all the response created under the hood by
Langchain4j Web Search.
@@ -173,7 +175,7 @@ WebSearchRequest request = WebSearchRequest.builder()
.build();
----
-The request will be autowired automatically if its bound name is
`web-search-request`. Otherwise, it should be added as a configured parameter
to the Camel route.
+The request is not autowired: set it on each endpoint that should use it with
the `webSearchRequest` option.
.Example of route:
[tabs]
@@ -183,7 +185,7 @@ Java::
[source,java]
----
from("direct:web-search")
- .to("langchain4j-web-search:test?webSearchRequest=#searchRequestTest");
+ .to("langchain4j-web-search:test?webSearchRequest=#web-search-request");
----
XML::
@@ -192,7 +194,7 @@ XML::
----
<route>
<from uri="direct:web-search"/>
- <to uri="langchain4j-web-search:test?webSearchRequest=#searchRequestTest"/>
+ <to uri="langchain4j-web-search:test?webSearchRequest=#web-search-request"/>
</route>
----
@@ -207,6 +209,6 @@ YAML::
- to:
uri: langchain4j-web-search:test
parameters:
- webSearchRequest: "#searchRequestTest"
+ webSearchRequest: "#web-search-request"
----
====
diff --git
a/components/camel-ai/camel-langchain4j-web-search/src/generated/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchEndpointConfigurer.java
b/components/camel-ai/camel-langchain4j-web-search/src/generated/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchEndpointConfigurer.java
index 62a2112752af..1cca53d8ccd9 100644
---
a/components/camel-ai/camel-langchain4j-web-search/src/generated/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchEndpointConfigurer.java
+++
b/components/camel-ai/camel-langchain4j-web-search/src/generated/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchEndpointConfigurer.java
@@ -51,7 +51,7 @@ public class LangChain4jWebSearchEndpointConfigurer extends
PropertyConfigurerSu
@Override
public String[] getAutowiredNames() {
- return new String[]{"additionalParams", "webSearchEngine",
"webSearchRequest"};
+ return new String[]{"webSearchEngine"};
}
@Override
diff --git
a/components/camel-ai/camel-langchain4j-web-search/src/generated/resources/META-INF/org/apache/camel/component/langchain4j/web/search/langchain4j-web-search.json
b/components/camel-ai/camel-langchain4j-web-search/src/generated/resources/META-INF/org/apache/camel/component/langchain4j/web/search/langchain4j-web-search.json
index 958cb858d59e..22a9cbe1a52b 100644
---
a/components/camel-ai/camel-langchain4j-web-search/src/generated/resources/META-INF/org/apache/camel/component/langchain4j/web/search/langchain4j-web-search.json
+++
b/components/camel-ai/camel-langchain4j-web-search/src/generated/resources/META-INF/org/apache/camel/component/langchain4j/web/search/langchain4j-web-search.json
@@ -29,20 +29,20 @@
},
"bodyTypes": {
"producerIn": { "carriers": [ "any" ], "description": "The search terms as
text; another body is converted to text, so a Map or a POJO is searched as its
toString(), and no body fails. With webSearchRequest the body is not read" },
- "producerOut": { "carriers": [ "text", "null" ], "dependsOn": [
"maxResults", "webSearchRequest" ], "byOption": [ { "option": "resultType",
"value": "LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT", "carriers": [ "pojo", "null"
] } ], "description": "The content of the first result as text (its snippet
with resultType SNIPPET, the WebSearchOrganicResult with
LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT), or null when there is no result or the
engine gives no content. With maxResults above 1 it is a [...]
+ "producerOut": { "carriers": [ "text", "null" ], "dependsOn": [
"maxResults", "webSearchRequest" ], "byOption": [ { "option": "resultType",
"value": "LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT", "carriers": [ "pojo", "null"
] } ], "description": "The content of the first result as text (its snippet
with resultType SNIPPET, the WebSearchOrganicResult with
LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT), or null when there is no result. A
result without content gives its snippet. With maxResults abo [...]
},
"properties": {
"searchId": { "index": 0, "kind": "path", "displayName": "Search Id",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "The id" },
- "additionalParams": { "index": 1, "kind": "parameter", "displayName":
"Additional Params", "group": "producer", "label": "", "required": false,
"type": "object", "javaType": "java.util.Map<java.lang.String,
java.lang.Object>", "deprecated": false, "deprecationNote": "", "autowired":
true, "secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The additionalPar [...]
+ "additionalParams": { "index": 1, "kind": "parameter", "displayName":
"Additional Params", "group": "producer", "label": "", "required": false,
"type": "object", "javaType": "java.util.Map<java.lang.String,
java.lang.Object>", "deprecated": false, "autowired": false, "secret": false,
"configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The additionalParams is
the additional [...]
"geoLocation": { "index": 2, "kind": "parameter", "displayName": "Geo
Location", "group": "producer", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The geoLocation is the
desired geolocation for search results. Each search engine [...]
"language": { "index": 3, "kind": "parameter", "displayName": "Language",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The language is the
desired language for search results. The expected values may vary dep [...]
"maxResults": { "index": 4, "kind": "parameter", "displayName": "Max
Results", "group": "producer", "label": "", "required": true, "type":
"integer", "javaType": "java.lang.Integer", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue": 1,
"configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The maxResults is the
expected number of [...]
- "resultType": { "index": 5, "kind": "parameter", "displayName": "Result
Type", "group": "producer", "label": "", "required": true, "type": "enum",
"javaType":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchResultType",
"enum": [ "LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT", "CONTENT", "SNIPPET" ],
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "defaultValue": "CONTENT", "configurationClass":
"org.apache.camel.component.langchain4j. [...]
+ "resultType": { "index": 5, "kind": "parameter", "displayName": "Result
Type", "group": "producer", "label": "", "required": true, "type": "enum",
"javaType":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchResultType",
"enum": [ "LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT", "CONTENT", "SNIPPET" ],
"deprecated": false, "deprecationNote": "", "autowired": false, "secret":
false, "defaultValue": "CONTENT", "configurationClass":
"org.apache.camel.component.langchain4j. [...]
"safeSearch": { "index": 6, "kind": "parameter", "displayName": "Safe
Search", "group": "producer", "label": "", "required": false, "type":
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The safeSearch is the
safe search flag, indicating whether [...]
"startIndex": { "index": 7, "kind": "parameter", "displayName": "Start
Index", "group": "producer", "label": "", "required": false, "type": "integer",
"javaType": "java.lang.Integer", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The startIndex is the
start index for search results, which may vary depending on [...]
"startPage": { "index": 8, "kind": "parameter", "displayName": "Start
Page", "group": "producer", "label": "", "required": false, "type": "integer",
"javaType": "java.lang.Integer", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The startPage is the
start page number for search results" },
"webSearchEngine": { "index": 9, "kind": "parameter", "displayName": "Web
Search Engine", "group": "producer", "label": "", "required": true, "type":
"object", "javaType": "dev.langchain4j.web.search.WebSearchEngine",
"deprecated": false, "deprecationNote": "", "autowired": true, "secret": false,
"configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The WebSearchEngine
engine [...]
"lazyStartProducer": { "index": 10, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
- "webSearchRequest": { "index": 11, "kind": "parameter", "displayName":
"Web Search Request", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"dev.langchain4j.web.search.WebSearchRequest", "deprecated": false,
"deprecationNote": "", "autowired": true, "secret": false,
"configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The webSearch [...]
+ "webSearchRequest": { "index": 11, "kind": "parameter", "displayName":
"Web Search Request", "group": "advanced", "label": "advanced", "required":
false, "type": "object", "javaType":
"dev.langchain4j.web.search.WebSearchRequest", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration",
"configurationField": "configuration", "description": "The webSearchRequest is
the custom [...]
}
}
diff --git
a/components/camel-ai/camel-langchain4j-web-search/src/main/docs/langchain4j-web-search-component.adoc
b/components/camel-ai/camel-langchain4j-web-search/src/main/docs/langchain4j-web-search-component.adoc
index b9fa7bd06f8b..df75602d3848 100644
---
a/components/camel-ai/camel-langchain4j-web-search/src/main/docs/langchain4j-web-search-component.adoc
+++
b/components/camel-ai/camel-langchain4j-web-search/src/main/docs/langchain4j-web-search-component.adoc
@@ -77,7 +77,7 @@ WebSearchEngine tavilyWebSearchEngine =
TavilyWebSearchEngine.builder()
.build();
----
-The web search engine will be autowired automatically if its bound name is
`web-search-engine`. Otherwise, it should be added as a configured parameter to
the Camel route.
+The web search engine is autowired when it is the only `WebSearchEngine` in
the registry. Otherwise, it should be added as a configured parameter to the
Camel route.
.Example:
[tabs]
@@ -87,7 +87,7 @@ Java::
[source,java]
----
from("direct:web-search")
- .to("langchain4j-web-search:test?webSearchEngine=#web-search-engine-test");
+ .to("langchain4j-web-search:test?webSearchEngine=#web-search-engine");
----
XML::
@@ -96,7 +96,7 @@ XML::
----
<route>
<from uri="direct:web-search"/>
- <to
uri="langchain4j-web-search:test?webSearchEngine=#web-search-engine-test"/>
+ <to uri="langchain4j-web-search:test?webSearchEngine=#web-search-engine"/>
</route>
----
@@ -111,7 +111,7 @@ YAML::
- to:
uri: langchain4j-web-search:test
parameters:
- webSearchEngine: "#web-search-engine-test"
+ webSearchEngine: "#web-search-engine"
----
====
@@ -148,6 +148,8 @@ List<String> responses =
template.requestBody("langchain4j-web-search:test?maxRe
You can get different types of Results.
+With the default `resultType` = CONTENT, a result without content returns its
snippet instead. Some engines give no content: Google Custom Search never does,
and Tavily only with `includeRawContent(true)`.
+
When `resultType` = SNIPPET, you will get a single or list (depending on
`maxResults` value) of Strings containing the snippets.
When `resultType` = LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT, you will get a
single or list (depending on `maxResults` value) of Objects of type
`WebSearchOrganicResult` containing all the response created under the hood by
Langchain4j Web Search.
@@ -173,7 +175,7 @@ WebSearchRequest request = WebSearchRequest.builder()
.build();
----
-The request will be autowired automatically if its bound name is
`web-search-request`. Otherwise, it should be added as a configured parameter
to the Camel route.
+The request is not autowired: set it on each endpoint that should use it with
the `webSearchRequest` option.
.Example of route:
[tabs]
@@ -183,7 +185,7 @@ Java::
[source,java]
----
from("direct:web-search")
- .to("langchain4j-web-search:test?webSearchRequest=#searchRequestTest");
+ .to("langchain4j-web-search:test?webSearchRequest=#web-search-request");
----
XML::
@@ -192,7 +194,7 @@ XML::
----
<route>
<from uri="direct:web-search"/>
- <to uri="langchain4j-web-search:test?webSearchRequest=#searchRequestTest"/>
+ <to uri="langchain4j-web-search:test?webSearchRequest=#web-search-request"/>
</route>
----
@@ -207,6 +209,6 @@ YAML::
- to:
uri: langchain4j-web-search:test
parameters:
- webSearchRequest: "#searchRequestTest"
+ webSearchRequest: "#web-search-request"
----
====
diff --git
a/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchConfiguration.java
b/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchConfiguration.java
index 46a18746c11c..7843fd4176f3 100644
---
a/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchConfiguration.java
+++
b/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchConfiguration.java
@@ -52,11 +52,9 @@ public class LangChain4jWebSearchConfiguration implements
Cloneable {
@UriParam
private Boolean safeSearch;
@UriParam
- @Metadata(autowired = true)
private Map<String, Object> additionalParams;
@UriParam(label = "advanced")
- @Metadata(autowired = true)
private WebSearchRequest webSearchRequest;
public WebSearchEngine getWebSearchEngine() {
@@ -79,8 +77,9 @@ public class LangChain4jWebSearchConfiguration implements
Cloneable {
* The {@link #resultType} is the result type of the request. Valid values
are
* LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT, CONTENT, or SNIPPET. CONTENT is
the default value; it will return a list
* of String . You can also specify to return either the Langchain4j Web
Search Organic Result object (using
- * `LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT`) or snippet (using `SNIPPET`)
for each result. If {@link #maxResults} is
- * equal to 1, the response will be a single object instead of a list.
+ * `LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT`) or snippet (using `SNIPPET`)
for each result. With CONTENT, a result
+ * without content returns its snippet, as some engines give no content.
If {@link #maxResults} is equal to 1, the
+ * response will be a single object instead of a list.
*/
public void setResultType(LangChain4jWebSearchResultType resultType) {
this.resultType = resultType;
@@ -176,7 +175,8 @@ public class LangChain4jWebSearchConfiguration implements
Cloneable {
}
/**
- * The {@link #webSearchRequest} is the custom WebSearchRequest - advanced
+ * The {@link #webSearchRequest} is the custom WebSearchRequest -
advanced. When set, the message body and the other
+ * search options are not used.
*/
public void setWebSearchRequest(WebSearchRequest webSearchRequest) {
this.webSearchRequest = webSearchRequest;
diff --git
a/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchEndpoint.java
b/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchEndpoint.java
index 0e63f22959f1..28fc5f0e8b89 100644
---
a/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchEndpoint.java
+++
b/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchEndpoint.java
@@ -47,9 +47,9 @@ import org.apache.camel.support.DefaultEndpoint;
carriers = {
Carrier.POJO, Carrier.NULL }),
description = "The content of the first
result as text (its snippet with resultType"
+ " SNIPPET, the
WebSearchOrganicResult with"
- + "
LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT), or null when there is no result"
- + " or the engine gives no
content. With maxResults above 1 it is a List of"
- + " them, which can hold
nulls"))
+ + "
LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT), or null when there is no result."
+ + " A result without content
gives its snippet. With maxResults above 1 it"
+ + " is a List of them, which
can hold nulls"))
public class LangChain4jWebSearchEndpoint extends DefaultEndpoint {
@Metadata(required = true)
diff --git
a/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchProducer.java
b/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchProducer.java
index 9e8c3faf3f29..538fdcb500f9 100644
---
a/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchProducer.java
+++
b/components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchProducer.java
@@ -95,14 +95,14 @@ public class LangChain4jWebSearchProducer extends
DefaultProducer {
if (maxResults != null && maxResults == 1) {
switch (getEndpoint().getConfiguration().getResultType()) {
case LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT ->
exchange.getIn().setBody(webSearchOrganicResults.get(0));
- case CONTENT ->
exchange.getIn().setBody(webSearchOrganicResults.get(0).content());
+ case CONTENT ->
exchange.getIn().setBody(contentOrSnippet(webSearchOrganicResults.get(0)));
case SNIPPET ->
exchange.getIn().setBody(webSearchOrganicResults.get(0).snippet());
}
} else { // return a List of Objects as a response
switch (getEndpoint().getConfiguration().getResultType()) {
case LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT ->
exchange.getIn().setBody(webSearchOrganicResults);
case CONTENT -> exchange.getIn()
-
.setBody(webSearchOrganicResults.stream().map(WebSearchOrganicResult::content)
+
.setBody(webSearchOrganicResults.stream().map(LangChain4jWebSearchProducer::contentOrSnippet)
.collect(Collectors.toList()));
case SNIPPET -> exchange.getIn()
.setBody(webSearchOrganicResults.stream().map(WebSearchOrganicResult::snippet)
@@ -110,4 +110,13 @@ public class LangChain4jWebSearchProducer extends
DefaultProducer {
}
}
}
+
+ /**
+ * The content of the result, or its snippet when the engine gives no
content (Google Custom Search never does, and
+ * Tavily only with includeRawContent), as LangChain4j does when it turns
a result into a text segment.
+ */
+ private static String contentOrSnippet(WebSearchOrganicResult result) {
+ String content = result.content();
+ return ObjectHelper.isEmpty(content) ? result.snippet() : content;
+ }
}
diff --git
a/components/camel-ai/camel-langchain4j-web-search/src/test/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchAdditionalParamsTest.java
b/components/camel-ai/camel-langchain4j-web-search/src/test/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchAdditionalParamsTest.java
new file mode 100644
index 000000000000..5eb1e2d27bbe
--- /dev/null
+++
b/components/camel-ai/camel-langchain4j-web-search/src/test/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchAdditionalParamsTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.langchain4j.web.search;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import dev.langchain4j.web.search.WebSearchEngine;
+import dev.langchain4j.web.search.WebSearchInformationResult;
+import dev.langchain4j.web.search.WebSearchOrganicResult;
+import dev.langchain4j.web.search.WebSearchRequest;
+import dev.langchain4j.web.search.WebSearchResults;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * A Map bean in the registry must not be sent as the additionalParams of an
endpoint that does not refer to it.
+ */
+public class LangChain4jWebSearchAdditionalParamsTest extends CamelTestSupport
{
+
+ private final AtomicReference<WebSearchRequest> capturedRequest = new
AtomicReference<>();
+
+ private final WebSearchEngine capturingEngine = request -> {
+ capturedRequest.set(request);
+ return WebSearchResults.from(
+ WebSearchInformationResult.from(1L),
+ List.of(WebSearchOrganicResult.from("Title",
URI.create("https://example.com"), "snippet", "content")));
+ };
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ context.getRegistry().bind("engine", capturingEngine);
+ // the only Map of the registry, which only the params endpoint refers
to
+ context.getRegistry().bind("params", Map.of("country", "dk"));
+
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:search")
+
.to("langchain4j-web-search:test?webSearchEngine=#engine");
+
+ from("direct:params")
+
.to("langchain4j-web-search:params?webSearchEngine=#engine&additionalParams=#params");
+ }
+ };
+ }
+
+ @Test
+ void doesNotSendAMapBeanOfTheRegistry() {
+ template.requestBody("direct:search", "apache camel");
+
+ WebSearchRequest request = capturedRequest.get();
+ assertNotNull(request);
+ assertTrue(request.additionalParams() == null ||
request.additionalParams().isEmpty(),
+ "additionalParams must not be taken from the registry: " +
request.additionalParams());
+ }
+
+ @Test
+ void sendsTheAdditionalParamsItRefersTo() {
+ template.requestBody("direct:params", "apache camel");
+
+ WebSearchRequest request = capturedRequest.get();
+ assertNotNull(request);
+ assertEquals(Map.of("country", "dk"), request.additionalParams());
+ }
+}
diff --git
a/components/camel-ai/camel-langchain4j-web-search/src/test/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchAutowireTest.java
b/components/camel-ai/camel-langchain4j-web-search/src/test/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchAutowireTest.java
new file mode 100644
index 000000000000..727f8c90f495
--- /dev/null
+++
b/components/camel-ai/camel-langchain4j-web-search/src/test/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchAutowireTest.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.langchain4j.web.search;
+
+import java.net.URI;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+
+import dev.langchain4j.web.search.WebSearchEngine;
+import dev.langchain4j.web.search.WebSearchInformationResult;
+import dev.langchain4j.web.search.WebSearchOrganicResult;
+import dev.langchain4j.web.search.WebSearchRequest;
+import dev.langchain4j.web.search.WebSearchResults;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/**
+ * A WebSearchRequest bean in the registry must not be used by an endpoint
that does not refer to it.
+ */
+public class LangChain4jWebSearchAutowireTest extends CamelTestSupport {
+
+ private final AtomicReference<WebSearchRequest> capturedRequest = new
AtomicReference<>();
+
+ private final WebSearchEngine capturingEngine = request -> {
+ capturedRequest.set(request);
+ return WebSearchResults.from(
+ WebSearchInformationResult.from(2L),
+ List.of(WebSearchOrganicResult.from("Title",
URI.create("https://example.com"), "snippet", "content"),
+ WebSearchOrganicResult.from("Title 2",
URI.create("https://example.org"), "snippet 2",
+ "content 2")));
+ };
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ context.getRegistry().bind("engine", capturingEngine);
+ // a bean that is meant for something else: the only WebSearchRequest
of the registry
+ context.getRegistry().bind("otherRequest",
+ WebSearchRequest.builder().searchTerms("from the
registry").maxResults(5).build());
+
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:search")
+
.to("langchain4j-web-search:test?webSearchEngine=#engine");
+
+ from("direct:custom")
+
.to("langchain4j-web-search:custom?webSearchEngine=#engine&webSearchRequest=#otherRequest");
+ }
+ };
+ }
+
+ @Test
+ void searchesTheBodyWhenAWebSearchRequestBeanIsInTheRegistry() {
+ Object body = template.requestBody("direct:search", "apache camel");
+
+ WebSearchRequest request = capturedRequest.get();
+ assertNotNull(request);
+ assertEquals("apache camel", request.searchTerms());
+ assertEquals(1, request.maxResults());
+ assertEquals("content", body);
+ }
+
+ @Test
+ void usesTheWebSearchRequestItRefersTo() {
+ Object body = template.requestBody("direct:custom", "apache camel");
+
+ WebSearchRequest request = capturedRequest.get();
+ assertNotNull(request);
+ assertEquals("from the registry", request.searchTerms());
+ assertEquals(List.of("content", "content 2"), body);
+ }
+}
diff --git
a/components/camel-ai/camel-langchain4j-web-search/src/test/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchContentTest.java
b/components/camel-ai/camel-langchain4j-web-search/src/test/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchContentTest.java
new file mode 100644
index 000000000000..030a26e48e86
--- /dev/null
+++
b/components/camel-ai/camel-langchain4j-web-search/src/test/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchContentTest.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.langchain4j.web.search;
+
+import java.net.URI;
+import java.util.List;
+
+import dev.langchain4j.web.search.WebSearchEngine;
+import dev.langchain4j.web.search.WebSearchInformationResult;
+import dev.langchain4j.web.search.WebSearchOrganicResult;
+import dev.langchain4j.web.search.WebSearchResults;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+/**
+ * Engines such as Google Custom Search give a snippet but no content: the
CONTENT result type then gives the snippet.
+ */
+public class LangChain4jWebSearchContentTest extends CamelTestSupport {
+
+ private final WebSearchEngine engine = request -> WebSearchResults.from(
+ WebSearchInformationResult.from(3L),
+ List.of(WebSearchOrganicResult.from("Title",
URI.create("https://example.com"), "snippet", null),
+ WebSearchOrganicResult.from("Title 2",
URI.create("https://example.org"), "snippet 2", "content 2"),
+ WebSearchOrganicResult.from("Title 3",
URI.create("https://example.net"), "snippet 3", " ")));
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ context.getRegistry().bind("engine", engine);
+
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:content")
+
.to("langchain4j-web-search:test?webSearchEngine=#engine");
+
+ from("direct:contents")
+
.to("langchain4j-web-search:test?webSearchEngine=#engine&maxResults=3");
+
+ from("direct:snippets")
+
.to("langchain4j-web-search:test?webSearchEngine=#engine&maxResults=3&resultType=SNIPPET");
+ }
+ };
+ }
+
+ @Test
+ void singleResultWithoutContentGivesItsSnippet() {
+ assertEquals("snippet", template.requestBody("direct:content", "apache
camel"));
+ }
+
+ @Test
+ void listGivesTheSnippetOfEachResultWithoutContent() {
+ assertEquals(List.of("snippet", "content 2", "snippet 3"),
template.requestBody("direct:contents", "apache camel"));
+ }
+
+ @Test
+ void snippetResultTypeIsUnchanged() {
+ assertEquals(List.of("snippet", "snippet 2", "snippet 3"),
+ template.requestBody("direct:snippets", "apache camel"));
+ }
+}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 5583d4f1d573..7e9a617b9da7 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -5672,6 +5672,17 @@ polled folder failed again on every poll. The exchange
now completes, so a file
file into `.camel` instead of leaving it in place. A hint is logged at INFO. A
document whose type is known but is not a
medium, or is one the embedding model does not support, still fails the
exchange.
+=== camel-langchain4j-web-search - webSearchRequest and additionalParams are
not autowired, CONTENT falls back to the snippet
+
+The `webSearchRequest` and `additionalParams` options are no longer autowired.
Before, the only `WebSearchRequest` bean
+of the registry was used by every `langchain4j-web-search` endpoint, so the
search terms in the message body were
+ignored, and the only `Map` bean of the registry was sent as the additional
parameters of every search. Refer to such a
+bean on the endpoints that should use it, for example
`webSearchRequest=#myRequest`.
+
+With `resultType=CONTENT` (the default), a result without content now gives
its snippet instead of null. Google Custom
+Search never gives content, and Tavily only with `includeRawContent(true)`, so
with these engines the body was null
+for a found result (or a list of nulls with `maxResults` above 1).
+
=== camel-jbang - camel export boots the integration in the same JVM, no
longer through camel run
To find the dependencies, `camel export` boots the integration silently, as
before, but no longer goes through
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LangChain4jWebSearchEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LangChain4jWebSearchEndpointBuilderFactory.java
index 9edac10c246e..16c080fc0040 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LangChain4jWebSearchEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LangChain4jWebSearchEndpointBuilderFactory.java
@@ -152,8 +152,10 @@ public interface
LangChain4jWebSearchEndpointBuilderFactory {
* is the default value; it will return a list of String . You can also
* specify to return either the Langchain4j Web Search Organic Result
* object (using LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT) or snippet
- * (using SNIPPET) for each result. If maxResults is equal to 1, the
- * response will be a single object instead of a list.
+ * (using SNIPPET) for each result. With CONTENT, a result without
+ * content returns its snippet, as some engines give no content. If
+ * maxResults is equal to 1, the response will be a single object
+ * instead of a list.
*
* The option is a:
*
<code>org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchResultType</code>
type.
@@ -175,8 +177,10 @@ public interface
LangChain4jWebSearchEndpointBuilderFactory {
* is the default value; it will return a list of String . You can also
* specify to return either the Langchain4j Web Search Organic Result
* object (using LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT) or snippet
- * (using SNIPPET) for each result. If maxResults is equal to 1, the
- * response will be a single object instead of a list.
+ * (using SNIPPET) for each result. With CONTENT, a result without
+ * content returns its snippet, as some engines give no content. If
+ * maxResults is equal to 1, the response will be a single object
+ * instead of a list.
*
* The option will be converted to a
*
<code>org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchResultType</code>
type.
@@ -378,7 +382,8 @@ public interface LangChain4jWebSearchEndpointBuilderFactory
{
return this;
}
/**
- * The webSearchRequest is the custom WebSearchRequest - advanced.
+ * The webSearchRequest is the custom WebSearchRequest - advanced. When
+ * set, the message body and the other search options are not used.
*
* The option is a:
* <code>dev.langchain4j.web.search.WebSearchRequest</code> type.
@@ -393,7 +398,8 @@ public interface LangChain4jWebSearchEndpointBuilderFactory
{
return this;
}
/**
- * The webSearchRequest is the custom WebSearchRequest - advanced.
+ * The webSearchRequest is the custom WebSearchRequest - advanced. When
+ * set, the message body and the other search options are not used.
*
* The option will be converted to a
* <code>dev.langchain4j.web.search.WebSearchRequest</code> type.