LangChain4j Web Search
Search the web with a LangChain4j web search engine, such as Tavily or Google Custom Search.
What’s inside
-
LangChain4j Web Search component, URI syntax:
langchain4j-web-search:searchId
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-langchain4j-web-search-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 14 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.langchain4j-web-search.additional-params | More parameters for the search engine, as a Map of names to values, such as the parameters of the search API that no option covers. Which names are used depends on the engine, and the Tavily engine ignores them. | Object> | |
camel.component.langchain4j-web-search.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.langchain4j-web-search.configuration | The configuration that each endpoint starts from. Options set on the endpoint override it. The option is a org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration type. | LangChain4jWebSearchConfiguration | |
camel.component.langchain4j-web-search.enabled | Whether to enable auto configuration of the langchain4j-web-search component. This is enabled by default. | Boolean | |
camel.component.langchain4j-web-search.geo-location | The geographic location of the search results, such as a country code, in the format that the search engine expects. The Tavily engine ignores it. | String | |
camel.component.langchain4j-web-search.language | The language of the search results, in the format that the search engine expects. The Tavily engine ignores it. | String | |
camel.component.langchain4j-web-search.lazy-start-producer | 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 producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.langchain4j-web-search.max-results | The number of results that the producer asks the search engine for. With 1 the body is a single result, otherwise a List. An engine can return fewer results and can have its own maximum. | 1 | Integer |
camel.component.langchain4j-web-search.result-type | What the producer returns for each result: CONTENT its content as a String, or its snippet when the result has no content (as some engines give none), SNIPPET its snippet, or LANGCHAIN4J_WEB_SEARCH_ORGANIC_RESULT the dev.langchain4j.web.search.WebSearchOrganicResult. The body is a single value when the request asks for one result, otherwise a List, and null when there is no result. | content | LangChain4jWebSearchResultType |
camel.component.langchain4j-web-search.safe-search | Whether the search engine filters explicit content out of the results. If not set, LangChain4j uses true. The Tavily engine ignores it. | Boolean | |
camel.component.langchain4j-web-search.start-index | The index of the first search result to return, in the numbering that the search engine uses. The Tavily engine ignores it. | Integer | |
camel.component.langchain4j-web-search.start-page | The page number of the search results to return. If not set, LangChain4j uses 1. The Tavily engine ignores it. | Integer | |
camel.component.langchain4j-web-search.web-search-engine | The dev.langchain4j.web.search.WebSearchEngine that runs the search, for example a TavilyWebSearchEngine or a GoogleCustomWebSearchEngine of the LangChain4j web search engine modules. It can be set on the endpoint or on the component. If neither sets it, the single instance in the registry is used, and the producer fails to start when there is none. The option is a dev.langchain4j.web.search.WebSearchEngine type. | WebSearchEngine | |
camel.component.langchain4j-web-search.web-search-request | A dev.langchain4j.web.search.WebSearchRequest that the producer sends as it is. When set, the producer does not read the message body and does not use the other search options, and only a maxResults of 1 in this request gives a single result instead of a List. The option is a dev.langchain4j.web.search.WebSearchRequest type. | WebSearchRequest |