zbendhiba commented on code in PR #14928:
URL: https://github.com/apache/camel/pull/14928#discussion_r1691256526


##########
components/camel-ai/camel-langchain4j-web-search/src/main/java/org/apache/camel/component/langchain4j/web/search/LangChain4jWebSearchConfiguration.java:
##########
@@ -0,0 +1,199 @@
+/*
+ * 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.util.Map;
+
+import dev.langchain4j.web.search.WebSearchEngine;
+import dev.langchain4j.web.search.WebSearchRequest;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.Configurer;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
+
+@Configurer
+@UriParams
+public class LangChain4jWebSearchConfiguration implements Cloneable {
+
+    @Metadata(required = true, autowired = true)
+    @UriParam
+    private WebSearchEngine webSearchEngine;
+
+    @Metadata(required = true, defaultValue = "CONTENT")
+    @UriParam
+    private LangChain4jWebSearchResultType resultType = 
LangChain4jWebSearchResultType.CONTENT;
+
+    @Metadata(required = true, defaultValue = "1")
+    @UriParam
+    private Integer maxResults = 1;
+    @UriParam
+    private String language;
+    @UriParam
+    private String geoLocation;
+    @UriParam
+    private Integer startPage;
+    @UriParam
+    private Integer startIndex;
+    @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() {
+        return webSearchEngine;
+    }
+
+    /**
+     * The {@link WebSearchEngine} engine to use. This is mandatory. Use one 
of the implementations from Langchain4j web
+     * search engines.
+     */
+    public void setWebSearchEngine(WebSearchEngine webSearchEngine) {
+        this.webSearchEngine = webSearchEngine;
+    }
+
+    public LangChain4jWebSearchResultType getResultType() {
+        return resultType;
+    }
+
+    /**
+     * 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_ORGNAIC_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.
+     */
+    public void setResultType(LangChain4jWebSearchResultType resultType) {
+        this.resultType = resultType;
+    }
+
+    /**
+     * The {@link #maxResults} is the expected number of results to be found 
if the search request were made. Each
+     * search engine may have a different limit for the maximum number of 
results that can be returned.
+     *
+     * @return
+     */
+    public Integer getMaxResults() {
+        return maxResults;
+    }
+
+    public void setMaxResults(Integer maxResults) {
+        this.maxResults = maxResults;
+    }
+
+    /**
+     * The {@link #language} is the desired language for search results is a 
string that indicates that the search
+     * client desires search results in the specified language. Each search 
engine may have a different set of supported
+     * languages.
+     *
+     * @return
+     */
+    public String getLanguage() {
+        return language;
+    }
+
+    public void setLanguage(String language) {
+        this.language = language;
+    }
+
+    public String getGeoLocation() {
+        return geoLocation;
+    }
+
+    /**
+     * The {@link #geoLocation} is the desired geolocation for search results 
is a string that indicates that the search
+     * client desires search results in the specified geolocation. Each search 
engine may have a different set of
+     * supported geolocations.
+     */
+    public void setGeoLocation(String geoLocation) {
+        this.geoLocation = geoLocation;
+    }
+
+    public Integer getStartPage() {
+        return startPage;
+    }
+
+    /**
+     * The {@link #startPage} is the start page number for search results is 
the page number of the set of search
+     * results desired by the search user
+     */
+    public void setStartPage(Integer startPage) {
+        this.startPage = startPage;
+    }
+
+    public Integer getStartIndex() {
+        return startIndex;
+    }
+
+    /**
+     * The {@link #startIndex} is the start index for search results is the 
index of the first search result desired by
+     * the search user. Each search engine may have a different set of 
supported start indexes in combination with the
+     * start page number.
+     */
+    public void setStartIndex(Integer startIndex) {
+        this.startIndex = startIndex;
+    }
+
+    public Boolean getSafeSearch() {
+        return safeSearch;
+    }
+
+    /**
+     * The {@link #safeSearch} is the safe search flag is a boolean that 
indicates that the search client desires search
+     * results with safe search enabled or disabled.
+     */
+    public void setSafeSearch(Boolean safeSearch) {
+        this.safeSearch = safeSearch;
+    }
+
+    public Map<String, Object> getAdditionalParams() {
+        return additionalParams;
+    }
+
+    /**
+     * The {@link #additionalParams} is the additional parameters for the 
search request are a map of key-value pairs
+     * that represent additional parameters for the search request. It's a way 
to be flex and add custom param for each

Review Comment:
   My bad, I copied text from Langchain4j javadoc. I had improved the text a 
bit. Let me know if that looks good to you.



-- 
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: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to