This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 461af7ee21dfc90092463d9e57eb92a8d0467636 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Tue Sep 3 15:14:09 2024 +0200 CAMEL-21153: added camel-langchain4j-tools and other missing components - CAMEL-20986: camel-langchain4j-tokenizer - CAMEL-20935: camel-langchain4j-web-search --- .../org/apache/camel/catalog/components.properties | 2 + .../catalog/components/langchain4j-tools.json | 44 ++ .../catalog/components/langchain4j-web-search.json | 43 ++ .../org/apache/camel/catalog/others.properties | 1 + .../catalog/others/langchain4j-tokenizer.json | 15 + .../org/apache/camel/main/components.properties | 2 + .../component/ComponentsBuilderFactory.java | 26 + .../Langchain4jToolsComponentBuilderFactory.java | 191 ++++++++ ...angchain4jWebSearchComponentBuilderFactory.java | 120 +++++ .../builder/endpoint/EndpointBuilderFactory.java | 2 + .../camel/builder/endpoint/EndpointBuilders.java | 2 + .../builder/endpoint/StaticEndpointBuilders.java | 80 +++ .../LangChain4jToolsEndpointBuilderFactory.java | 545 +++++++++++++++++++++ ...LangChain4jWebSearchEndpointBuilderFactory.java | 461 +++++++++++++++++ .../camel-component-known-dependencies.properties | 2 + .../kotlin/components/Langchain4jToolsUriDsl.kt | 157 ++++++ .../components/Langchain4jWebSearchUriDsl.kt | 189 +++++++ .../apache/camel/maven/packaging/MojoHelper.java | 4 +- 18 files changed, 1885 insertions(+), 1 deletion(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties index 91e42cf7f34..2d1b62d5628 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components.properties @@ -207,6 +207,8 @@ kubernetes-services kudu langchain4j-chat langchain4j-embeddings +langchain4j-tools +langchain4j-web-search language ldap ldif diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/langchain4j-tools.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/langchain4j-tools.json new file mode 100644 index 00000000000..ac048ded5de --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/langchain4j-tools.json @@ -0,0 +1,44 @@ +{ + "component": { + "kind": "component", + "name": "langchain4j-tools", + "title": "LangChain4j Tools", + "description": "LangChain4j Tools and Function Calling Features", + "deprecated": false, + "firstVersion": "4.8.0", + "label": "ai", + "javaType": "org.apache.camel.component.langchain4j.tools.LangChain4jToolsComponent", + "supportLevel": "Experimental", + "groupId": "org.apache.camel", + "artifactId": "camel-langchain4j-tools", + "version": "4.8.0-SNAPSHOT", + "scheme": "langchain4j-tools", + "extendsScheme": "", + "syntax": "langchain4j-tools:toolId", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": false, + "lenientProperties": false, + "remote": true + }, + "componentProperties": { + "configuration": { "index": 0, "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The configuration." }, + "bridgeErrorHandler": { "index": 1, "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the like [...] + "lazyStartProducer": { "index": 2, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "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 producer may otherwise fail [...] + "autowiredEnabled": { "index": 3, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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 t [...] + "chatModel": { "index": 4, "kind": "property", "displayName": "Chat Model", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "dev.langchain4j.model.chat.ChatLanguageModel", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration", "configurationField": "configuration", "description": "Chat Language Model of type dev.langch [...] + }, + "properties": { + "toolId": { "index": 0, "kind": "path", "displayName": "Tool Id", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The tool name" }, + "tags": { "index": 1, "kind": "parameter", "displayName": "Tags", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The tags for the tools" }, + "description": { "index": 2, "kind": "parameter", "displayName": "Description", "group": "consumer", "label": "consumer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Tool description" }, + "parameters": { "index": 3, "kind": "parameter", "displayName": "Parameters", "group": "consumer", "label": "consumer", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.String>", "enum": [ "string", "integer", "number", "object", "array", "boolean", "null" ], "prefix": "parameter.", "multiValue": true, "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "List of Tool parameters in the form of param [...] + "bridgeErrorHandler": { "index": 4, "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming [...] + "camelToolParameter": { "index": 5, "kind": "parameter", "displayName": "Camel Tool Parameter", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.component.langchain4j.tools.spec.CamelSimpleToolParameter", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Tool's Camel Parameters, programmatically define Tool description and parameters" }, + "exceptionHandler": { "index": 6, "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By def [...] + "exchangePattern": { "index": 7, "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, + "lazyStartProducer": { "index": 8, "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 produc [...] + "chatModel": { "index": 9, "kind": "parameter", "displayName": "Chat Model", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "dev.langchain4j.model.chat.ChatLanguageModel", "deprecated": false, "deprecationNote": "", "autowired": true, "secret": false, "configurationClass": "org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration", "configurationField": "configuration", "description": "Chat Language Model of type dev.langc [...] + } +} 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 new file mode 100644 index 00000000000..f882cf829f5 --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/langchain4j-web-search.json @@ -0,0 +1,43 @@ +{ + "component": { + "kind": "component", + "name": "langchain4j-web-search", + "title": "LangChain4j Web Search", + "description": "LangChain4j Web Search Engine", + "deprecated": false, + "firstVersion": "4.8.0", + "label": "ai", + "javaType": "org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchComponent", + "supportLevel": "Preview", + "groupId": "org.apache.camel", + "artifactId": "camel-langchain4j-web-search", + "version": "4.8.0-SNAPSHOT", + "scheme": "langchain4j-web-search", + "extendsScheme": "", + "syntax": "langchain4j-web-search:searchId", + "async": false, + "api": false, + "consumerOnly": false, + "producerOnly": true, + "lenientProperties": false, + "remote": true + }, + "componentProperties": { + "lazyStartProducer": { "index": 0, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "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 producer may otherwise fail [...] + "autowiredEnabled": { "index": 1, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "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 t [...] + }, + "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 [...] + "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 o [...] + "resultType": { "index": 5, "kind": "parameter", "displayName": "Result Type", "group": "producer", "label": "", "required": true, "type": "object", "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.langchain4 [...] + "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, "configurationClass": "org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchConfiguration", "configurationField": "configuration", "description": "The safeSearch is the safe search flag, indicating whether to enable or disable sa [...] + "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 [...] + } +} diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties index 15e1b4bcb33..31d97b45c11 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties @@ -24,6 +24,7 @@ jta kamelet-main kotlin-api kotlin-dsl +langchain4j-tokenizer leveldb lra mail-microsoft-oauth diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/langchain4j-tokenizer.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/langchain4j-tokenizer.json new file mode 100644 index 00000000000..d7a9eba6cfd --- /dev/null +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/langchain4j-tokenizer.json @@ -0,0 +1,15 @@ +{ + "other": { + "kind": "other", + "name": "langchain4j-tokenizer", + "title": "LangChain4j Tokenizer", + "description": "LangChain4j Tokenizer", + "deprecated": false, + "firstVersion": "4.8.0", + "label": "ai", + "supportLevel": "Experimental", + "groupId": "org.apache.camel", + "artifactId": "camel-langchain4j-tokenizer", + "version": "4.8.0-SNAPSHOT" + } +} diff --git a/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties b/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties index 91e42cf7f34..2d1b62d5628 100644 --- a/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties +++ b/core/camel-main/src/generated/resources/org/apache/camel/main/components.properties @@ -207,6 +207,8 @@ kubernetes-services kudu langchain4j-chat langchain4j-embeddings +langchain4j-tools +langchain4j-web-search language ldap ldif diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java index 23ea29f7ec8..032b54cc6d1 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/ComponentsBuilderFactory.java @@ -2825,6 +2825,32 @@ public interface ComponentsBuilderFactory { static Langchain4jEmbeddingsComponentBuilderFactory.Langchain4jEmbeddingsComponentBuilder langchain4jEmbeddings() { return Langchain4jEmbeddingsComponentBuilderFactory.langchain4jEmbeddings(); } + /** + * LangChain4j Tools (camel-langchain4j-tools) + * LangChain4j Tools and Function Calling Features + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-tools + * + * @return the dsl builder + */ + static Langchain4jToolsComponentBuilderFactory.Langchain4jToolsComponentBuilder langchain4jTools() { + return Langchain4jToolsComponentBuilderFactory.langchain4jTools(); + } + /** + * LangChain4j Web Search (camel-langchain4j-web-search) + * LangChain4j Web Search Engine + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-web-search + * + * @return the dsl builder + */ + static Langchain4jWebSearchComponentBuilderFactory.Langchain4jWebSearchComponentBuilder langchain4jWebSearch() { + return Langchain4jWebSearchComponentBuilderFactory.langchain4jWebSearch(); + } /** * Language (camel-language) * Execute scripts in any of the languages supported by Camel. diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Langchain4jToolsComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Langchain4jToolsComponentBuilderFactory.java new file mode 100644 index 00000000000..a21e53cd7a7 --- /dev/null +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Langchain4jToolsComponentBuilderFactory.java @@ -0,0 +1,191 @@ +/* Generated by camel build tools - do NOT edit this file! */ +/* + * 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.builder.component.dsl; + +import javax.annotation.processing.Generated; +import org.apache.camel.Component; +import org.apache.camel.builder.component.AbstractComponentBuilder; +import org.apache.camel.builder.component.ComponentBuilder; +import org.apache.camel.component.langchain4j.tools.LangChain4jToolsComponent; + +/** + * LangChain4j Tools and Function Calling Features + * + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.ComponentDslMojo") +public interface Langchain4jToolsComponentBuilderFactory { + + /** + * LangChain4j Tools (camel-langchain4j-tools) + * LangChain4j Tools and Function Calling Features + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-tools + * + * @return the dsl builder + */ + static Langchain4jToolsComponentBuilder langchain4jTools() { + return new Langchain4jToolsComponentBuilderImpl(); + } + + /** + * Builder for the LangChain4j Tools component. + */ + interface Langchain4jToolsComponentBuilder extends ComponentBuilder<LangChain4jToolsComponent> { + + /** + * The configuration. + * + * The option is a: + * <code>org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration</code> type. + * + * Group: common + * + * @param configuration the value to set + * @return the dsl builder + */ + default Langchain4jToolsComponentBuilder configuration(org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration configuration) { + doSetProperty("configuration", configuration); + return this; + } + + + /** + * Allows for bridging the consumer to the Camel routing Error Handler, + * which mean any exceptions (if possible) occurred while the Camel + * consumer is trying to pickup incoming messages, or the likes, will + * now be processed as a message and handled by the routing Error + * Handler. Important: This is only possible if the 3rd party component + * allows Camel to be alerted if an exception was thrown. Some + * components handle this internally only, and therefore + * bridgeErrorHandler is not possible. In other situations we may + * improve the Camel component to hook into the 3rd party component and + * make this possible for future releases. By default the consumer will + * use the org.apache.camel.spi.ExceptionHandler to deal with + * exceptions, that will be logged at WARN or ERROR level and ignored. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: consumer + * + * @param bridgeErrorHandler the value to set + * @return the dsl builder + */ + default Langchain4jToolsComponentBuilder bridgeErrorHandler(boolean bridgeErrorHandler) { + doSetProperty("bridgeErrorHandler", bridgeErrorHandler); + return this; + } + + + /** + * 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. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default Langchain4jToolsComponentBuilder lazyStartProducer(boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + + + /** + * 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. + * + * The option is a: <code>boolean</code> type. + * + * Default: true + * Group: advanced + * + * @param autowiredEnabled the value to set + * @return the dsl builder + */ + default Langchain4jToolsComponentBuilder autowiredEnabled(boolean autowiredEnabled) { + doSetProperty("autowiredEnabled", autowiredEnabled); + return this; + } + + /** + * Chat Language Model of type + * dev.langchain4j.model.chat.ChatLanguageModel. + * + * The option is a: + * <code>dev.langchain4j.model.chat.ChatLanguageModel</code> + * type. + * + * Group: advanced + * + * @param chatModel the value to set + * @return the dsl builder + */ + default Langchain4jToolsComponentBuilder chatModel(dev.langchain4j.model.chat.ChatLanguageModel chatModel) { + doSetProperty("chatModel", chatModel); + return this; + } + } + + class Langchain4jToolsComponentBuilderImpl + extends AbstractComponentBuilder<LangChain4jToolsComponent> + implements Langchain4jToolsComponentBuilder { + @Override + protected LangChain4jToolsComponent buildConcreteComponent() { + return new LangChain4jToolsComponent(); + } + private org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration getOrCreateConfiguration(LangChain4jToolsComponent component) { + if (component.getConfiguration() == null) { + component.setConfiguration(new org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration()); + } + return component.getConfiguration(); + } + @Override + protected boolean setPropertyOnComponent( + Component component, + String name, + Object value) { + switch (name) { + case "configuration": ((LangChain4jToolsComponent) component).setConfiguration((org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration) value); return true; + case "bridgeErrorHandler": ((LangChain4jToolsComponent) component).setBridgeErrorHandler((boolean) value); return true; + case "lazyStartProducer": ((LangChain4jToolsComponent) component).setLazyStartProducer((boolean) value); return true; + case "autowiredEnabled": ((LangChain4jToolsComponent) component).setAutowiredEnabled((boolean) value); return true; + case "chatModel": getOrCreateConfiguration((LangChain4jToolsComponent) component).setChatModel((dev.langchain4j.model.chat.ChatLanguageModel) value); return true; + default: return false; + } + } + } +} \ No newline at end of file diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Langchain4jWebSearchComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Langchain4jWebSearchComponentBuilderFactory.java new file mode 100644 index 00000000000..627b9c7c24e --- /dev/null +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Langchain4jWebSearchComponentBuilderFactory.java @@ -0,0 +1,120 @@ +/* Generated by camel build tools - do NOT edit this file! */ +/* + * 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.builder.component.dsl; + +import javax.annotation.processing.Generated; +import org.apache.camel.Component; +import org.apache.camel.builder.component.AbstractComponentBuilder; +import org.apache.camel.builder.component.ComponentBuilder; +import org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchComponent; + +/** + * LangChain4j Web Search Engine + * + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.ComponentDslMojo") +public interface Langchain4jWebSearchComponentBuilderFactory { + + /** + * LangChain4j Web Search (camel-langchain4j-web-search) + * LangChain4j Web Search Engine + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-web-search + * + * @return the dsl builder + */ + static Langchain4jWebSearchComponentBuilder langchain4jWebSearch() { + return new Langchain4jWebSearchComponentBuilderImpl(); + } + + /** + * Builder for the LangChain4j Web Search component. + */ + interface Langchain4jWebSearchComponentBuilder extends ComponentBuilder<LangChain4jWebSearchComponent> { + + + /** + * 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. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default Langchain4jWebSearchComponentBuilder lazyStartProducer(boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + + + /** + * 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. + * + * The option is a: <code>boolean</code> type. + * + * Default: true + * Group: advanced + * + * @param autowiredEnabled the value to set + * @return the dsl builder + */ + default Langchain4jWebSearchComponentBuilder autowiredEnabled(boolean autowiredEnabled) { + doSetProperty("autowiredEnabled", autowiredEnabled); + return this; + } + } + + class Langchain4jWebSearchComponentBuilderImpl + extends AbstractComponentBuilder<LangChain4jWebSearchComponent> + implements Langchain4jWebSearchComponentBuilder { + @Override + protected LangChain4jWebSearchComponent buildConcreteComponent() { + return new LangChain4jWebSearchComponent(); + } + @Override + protected boolean setPropertyOnComponent( + Component component, + String name, + Object value) { + switch (name) { + case "lazyStartProducer": ((LangChain4jWebSearchComponent) component).setLazyStartProducer((boolean) value); return true; + case "autowiredEnabled": ((LangChain4jWebSearchComponent) component).setAutowiredEnabled((boolean) value); return true; + default: return false; + } + } + } +} \ No newline at end of file diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java index 45e836b4c7d..ad787aa9239 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilderFactory.java @@ -218,6 +218,8 @@ public interface EndpointBuilderFactory org.apache.camel.builder.endpoint.dsl.Lambda2EndpointBuilderFactory.Lambda2Builders, org.apache.camel.builder.endpoint.dsl.LangChain4jChatEndpointBuilderFactory.LangChain4jChatBuilders, org.apache.camel.builder.endpoint.dsl.LangChain4jEmbeddingsEndpointBuilderFactory.LangChain4jEmbeddingsBuilders, + org.apache.camel.builder.endpoint.dsl.LangChain4jToolsEndpointBuilderFactory.LangChain4jToolsBuilders, + org.apache.camel.builder.endpoint.dsl.LangChain4jWebSearchEndpointBuilderFactory.LangChain4jWebSearchBuilders, org.apache.camel.builder.endpoint.dsl.LanguageEndpointBuilderFactory.LanguageBuilders, org.apache.camel.builder.endpoint.dsl.LdapEndpointBuilderFactory.LdapBuilders, org.apache.camel.builder.endpoint.dsl.LdifEndpointBuilderFactory.LdifBuilders, diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java index 5cbd5bbf508..1627c340c53 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/EndpointBuilders.java @@ -215,6 +215,8 @@ public interface EndpointBuilders org.apache.camel.builder.endpoint.dsl.Lambda2EndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.LangChain4jChatEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.LangChain4jEmbeddingsEndpointBuilderFactory, + org.apache.camel.builder.endpoint.dsl.LangChain4jToolsEndpointBuilderFactory, + org.apache.camel.builder.endpoint.dsl.LangChain4jWebSearchEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.LanguageEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.LdapEndpointBuilderFactory, org.apache.camel.builder.endpoint.dsl.LdifEndpointBuilderFactory, diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index d6e1005a683..f85b3118630 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -9384,6 +9384,86 @@ public class StaticEndpointBuilders { public static LangChain4jEmbeddingsEndpointBuilderFactory.LangChain4jEmbeddingsEndpointBuilder langchain4jEmbeddings(String componentName, String path) { return LangChain4jEmbeddingsEndpointBuilderFactory.endpointBuilder(componentName, path); } + /** + * LangChain4j Tools (camel-langchain4j-tools) + * LangChain4j Tools and Function Calling Features + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-tools + * + * Syntax: <code>langchain4j-tools:toolId</code> + * + * Path parameter: toolId (required) + * The tool name + * + * @param path toolId + * @return the dsl builder + */ + public static LangChain4jToolsEndpointBuilderFactory.LangChain4jToolsEndpointBuilder langchain4jTools(String path) { + return langchain4jTools("langchain4j-tools", path); + } + /** + * LangChain4j Tools (camel-langchain4j-tools) + * LangChain4j Tools and Function Calling Features + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-tools + * + * Syntax: <code>langchain4j-tools:toolId</code> + * + * Path parameter: toolId (required) + * The tool name + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path toolId + * @return the dsl builder + */ + public static LangChain4jToolsEndpointBuilderFactory.LangChain4jToolsEndpointBuilder langchain4jTools(String componentName, String path) { + return LangChain4jToolsEndpointBuilderFactory.endpointBuilder(componentName, path); + } + /** + * LangChain4j Web Search (camel-langchain4j-web-search) + * LangChain4j Web Search Engine + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-web-search + * + * Syntax: <code>langchain4j-web-search:searchId</code> + * + * Path parameter: searchId (required) + * The id + * + * @param path searchId + * @return the dsl builder + */ + public static LangChain4jWebSearchEndpointBuilderFactory.LangChain4jWebSearchEndpointBuilder langchain4jWebSearch(String path) { + return langchain4jWebSearch("langchain4j-web-search", path); + } + /** + * LangChain4j Web Search (camel-langchain4j-web-search) + * LangChain4j Web Search Engine + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-web-search + * + * Syntax: <code>langchain4j-web-search:searchId</code> + * + * Path parameter: searchId (required) + * The id + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path searchId + * @return the dsl builder + */ + public static LangChain4jWebSearchEndpointBuilderFactory.LangChain4jWebSearchEndpointBuilder langchain4jWebSearch(String componentName, String path) { + return LangChain4jWebSearchEndpointBuilderFactory.endpointBuilder(componentName, path); + } /** * Language (camel-language) * Execute scripts in any of the languages supported by Camel. diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LangChain4jToolsEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LangChain4jToolsEndpointBuilderFactory.java new file mode 100644 index 00000000000..fbc42dd9dcc --- /dev/null +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LangChain4jToolsEndpointBuilderFactory.java @@ -0,0 +1,545 @@ +/* Generated by camel build tools - do NOT edit this file! */ +/* + * 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.builder.endpoint.dsl; + +import java.util.*; +import java.util.concurrent.*; +import java.util.function.*; +import java.util.stream.*; +import javax.annotation.processing.Generated; +import org.apache.camel.builder.EndpointConsumerBuilder; +import org.apache.camel.builder.EndpointProducerBuilder; +import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; + +/** + * LangChain4j Tools and Function Calling Features + * + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.EndpointDslMojo") +public interface LangChain4jToolsEndpointBuilderFactory { + + /** + * Builder for endpoint consumers for the LangChain4j Tools component. + */ + public interface LangChain4jToolsEndpointConsumerBuilder + extends + EndpointConsumerBuilder { + default AdvancedLangChain4jToolsEndpointConsumerBuilder advanced() { + return (AdvancedLangChain4jToolsEndpointConsumerBuilder) this; + } + /** + * The tags for the tools. + * + * The option is a: <code>java.lang.String</code> type. + * + * Required: true + * Group: common + * + * @param tags the value to set + * @return the dsl builder + */ + default LangChain4jToolsEndpointConsumerBuilder tags(String tags) { + doSetProperty("tags", tags); + return this; + } + /** + * Tool description. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: consumer + * + * @param description the value to set + * @return the dsl builder + */ + default LangChain4jToolsEndpointConsumerBuilder description(String description) { + doSetProperty("description", description); + return this; + } + /** + * List of Tool parameters in the form of parameter.=. + * + * The option is a: <code>java.util.Map<java.lang.String, + * java.lang.String></code> type. + * The option is multivalued, and you can use the parameters(String, + * Object) method to add a value (call the method multiple times to set + * more values). + * + * Group: consumer + * + * @param key the option key + * @param value the option value + * @return the dsl builder + */ + default LangChain4jToolsEndpointConsumerBuilder parameters(String key, Object value) { + doSetMultiValueProperty("parameters", "parameter." + key, value); + return this; + } + /** + * List of Tool parameters in the form of parameter.=. + * + * The option is a: <code>java.util.Map<java.lang.String, + * java.lang.String></code> type. + * The option is multivalued, and you can use the parameters(String, + * Object) method to add a value (call the method multiple times to set + * more values). + * + * Group: consumer + * + * @param values the values + * @return the dsl builder + */ + default LangChain4jToolsEndpointConsumerBuilder parameters(Map values) { + doSetMultiValueProperties("parameters", "parameter.", values); + return this; + } + } + + /** + * Advanced builder for endpoint consumers for the LangChain4j Tools component. + */ + public interface AdvancedLangChain4jToolsEndpointConsumerBuilder + extends + EndpointConsumerBuilder { + default LangChain4jToolsEndpointConsumerBuilder basic() { + return (LangChain4jToolsEndpointConsumerBuilder) this; + } + /** + * Allows for bridging the consumer to the Camel routing Error Handler, + * which mean any exceptions (if possible) occurred while the Camel + * consumer is trying to pickup incoming messages, or the likes, will + * now be processed as a message and handled by the routing Error + * Handler. Important: This is only possible if the 3rd party component + * allows Camel to be alerted if an exception was thrown. Some + * components handle this internally only, and therefore + * bridgeErrorHandler is not possible. In other situations we may + * improve the Camel component to hook into the 3rd party component and + * make this possible for future releases. By default the consumer will + * use the org.apache.camel.spi.ExceptionHandler to deal with + * exceptions, that will be logged at WARN or ERROR level and ignored. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: consumer (advanced) + * + * @param bridgeErrorHandler the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder bridgeErrorHandler(boolean bridgeErrorHandler) { + doSetProperty("bridgeErrorHandler", bridgeErrorHandler); + return this; + } + /** + * Allows for bridging the consumer to the Camel routing Error Handler, + * which mean any exceptions (if possible) occurred while the Camel + * consumer is trying to pickup incoming messages, or the likes, will + * now be processed as a message and handled by the routing Error + * Handler. Important: This is only possible if the 3rd party component + * allows Camel to be alerted if an exception was thrown. Some + * components handle this internally only, and therefore + * bridgeErrorHandler is not possible. In other situations we may + * improve the Camel component to hook into the 3rd party component and + * make this possible for future releases. By default the consumer will + * use the org.apache.camel.spi.ExceptionHandler to deal with + * exceptions, that will be logged at WARN or ERROR level and ignored. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: consumer (advanced) + * + * @param bridgeErrorHandler the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder bridgeErrorHandler(String bridgeErrorHandler) { + doSetProperty("bridgeErrorHandler", bridgeErrorHandler); + return this; + } + /** + * Tool's Camel Parameters, programmatically define Tool description and + * parameters. + * + * The option is a: + * <code>org.apache.camel.component.langchain4j.tools.spec.CamelSimpleToolParameter</code> type. + * + * Group: consumer (advanced) + * + * @param camelToolParameter the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder camelToolParameter(org.apache.camel.component.langchain4j.tools.spec.CamelSimpleToolParameter camelToolParameter) { + doSetProperty("camelToolParameter", camelToolParameter); + return this; + } + /** + * Tool's Camel Parameters, programmatically define Tool description and + * parameters. + * + * The option will be converted to a + * <code>org.apache.camel.component.langchain4j.tools.spec.CamelSimpleToolParameter</code> type. + * + * Group: consumer (advanced) + * + * @param camelToolParameter the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder camelToolParameter(String camelToolParameter) { + doSetProperty("camelToolParameter", camelToolParameter); + return this; + } + /** + * To let the consumer use a custom ExceptionHandler. Notice if the + * option bridgeErrorHandler is enabled then this option is not in use. + * By default the consumer will deal with exceptions, that will be + * logged at WARN or ERROR level and ignored. + * + * The option is a: <code>org.apache.camel.spi.ExceptionHandler</code> + * type. + * + * Group: consumer (advanced) + * + * @param exceptionHandler the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder exceptionHandler(org.apache.camel.spi.ExceptionHandler exceptionHandler) { + doSetProperty("exceptionHandler", exceptionHandler); + return this; + } + /** + * To let the consumer use a custom ExceptionHandler. Notice if the + * option bridgeErrorHandler is enabled then this option is not in use. + * By default the consumer will deal with exceptions, that will be + * logged at WARN or ERROR level and ignored. + * + * The option will be converted to a + * <code>org.apache.camel.spi.ExceptionHandler</code> type. + * + * Group: consumer (advanced) + * + * @param exceptionHandler the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder exceptionHandler(String exceptionHandler) { + doSetProperty("exceptionHandler", exceptionHandler); + return this; + } + /** + * Sets the exchange pattern when the consumer creates an exchange. + * + * The option is a: <code>org.apache.camel.ExchangePattern</code> type. + * + * Group: consumer (advanced) + * + * @param exchangePattern the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder exchangePattern(org.apache.camel.ExchangePattern exchangePattern) { + doSetProperty("exchangePattern", exchangePattern); + return this; + } + /** + * Sets the exchange pattern when the consumer creates an exchange. + * + * The option will be converted to a + * <code>org.apache.camel.ExchangePattern</code> type. + * + * Group: consumer (advanced) + * + * @param exchangePattern the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder exchangePattern(String exchangePattern) { + doSetProperty("exchangePattern", exchangePattern); + return this; + } + /** + * Chat Language Model of type + * dev.langchain4j.model.chat.ChatLanguageModel. + * + * The option is a: + * <code>dev.langchain4j.model.chat.ChatLanguageModel</code> type. + * + * Group: advanced + * + * @param chatModel the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder chatModel(dev.langchain4j.model.chat.ChatLanguageModel chatModel) { + doSetProperty("chatModel", chatModel); + return this; + } + /** + * Chat Language Model of type + * dev.langchain4j.model.chat.ChatLanguageModel. + * + * The option will be converted to a + * <code>dev.langchain4j.model.chat.ChatLanguageModel</code> type. + * + * Group: advanced + * + * @param chatModel the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointConsumerBuilder chatModel(String chatModel) { + doSetProperty("chatModel", chatModel); + return this; + } + } + + /** + * Builder for endpoint producers for the LangChain4j Tools component. + */ + public interface LangChain4jToolsEndpointProducerBuilder + extends + EndpointProducerBuilder { + default AdvancedLangChain4jToolsEndpointProducerBuilder advanced() { + return (AdvancedLangChain4jToolsEndpointProducerBuilder) this; + } + + /** + * The tags for the tools. + * + * The option is a: <code>java.lang.String</code> type. + * + * Required: true + * Group: common + * + * @param tags the value to set + * @return the dsl builder + */ + default LangChain4jToolsEndpointProducerBuilder tags(String tags) { + doSetProperty("tags", tags); + return this; + } + } + + /** + * Advanced builder for endpoint producers for the LangChain4j Tools component. + */ + public interface AdvancedLangChain4jToolsEndpointProducerBuilder extends EndpointProducerBuilder { + default LangChain4jToolsEndpointProducerBuilder basic() { + return (LangChain4jToolsEndpointProducerBuilder) this; + } + + /** + * 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. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer (advanced) + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointProducerBuilder lazyStartProducer(boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * 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. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: producer (advanced) + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointProducerBuilder lazyStartProducer(String lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * Chat Language Model of type + * dev.langchain4j.model.chat.ChatLanguageModel. + * + * The option is a: + * <code>dev.langchain4j.model.chat.ChatLanguageModel</code> type. + * + * Group: advanced + * + * @param chatModel the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointProducerBuilder chatModel(dev.langchain4j.model.chat.ChatLanguageModel chatModel) { + doSetProperty("chatModel", chatModel); + return this; + } + /** + * Chat Language Model of type + * dev.langchain4j.model.chat.ChatLanguageModel. + * + * The option will be converted to a + * <code>dev.langchain4j.model.chat.ChatLanguageModel</code> type. + * + * Group: advanced + * + * @param chatModel the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointProducerBuilder chatModel(String chatModel) { + doSetProperty("chatModel", chatModel); + return this; + } + } + + /** + * Builder for endpoint for the LangChain4j Tools component. + */ + public interface LangChain4jToolsEndpointBuilder + extends + LangChain4jToolsEndpointConsumerBuilder, + LangChain4jToolsEndpointProducerBuilder { + default AdvancedLangChain4jToolsEndpointBuilder advanced() { + return (AdvancedLangChain4jToolsEndpointBuilder) this; + } + + /** + * The tags for the tools. + * + * The option is a: <code>java.lang.String</code> type. + * + * Required: true + * Group: common + * + * @param tags the value to set + * @return the dsl builder + */ + default LangChain4jToolsEndpointBuilder tags(String tags) { + doSetProperty("tags", tags); + return this; + } + } + + /** + * Advanced builder for endpoint for the LangChain4j Tools component. + */ + public interface AdvancedLangChain4jToolsEndpointBuilder + extends + AdvancedLangChain4jToolsEndpointConsumerBuilder, + AdvancedLangChain4jToolsEndpointProducerBuilder { + default LangChain4jToolsEndpointBuilder basic() { + return (LangChain4jToolsEndpointBuilder) this; + } + + /** + * Chat Language Model of type + * dev.langchain4j.model.chat.ChatLanguageModel. + * + * The option is a: + * <code>dev.langchain4j.model.chat.ChatLanguageModel</code> type. + * + * Group: advanced + * + * @param chatModel the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointBuilder chatModel(dev.langchain4j.model.chat.ChatLanguageModel chatModel) { + doSetProperty("chatModel", chatModel); + return this; + } + /** + * Chat Language Model of type + * dev.langchain4j.model.chat.ChatLanguageModel. + * + * The option will be converted to a + * <code>dev.langchain4j.model.chat.ChatLanguageModel</code> type. + * + * Group: advanced + * + * @param chatModel the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jToolsEndpointBuilder chatModel(String chatModel) { + doSetProperty("chatModel", chatModel); + return this; + } + } + + public interface LangChain4jToolsBuilders { + /** + * LangChain4j Tools (camel-langchain4j-tools) + * LangChain4j Tools and Function Calling Features + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-tools + * + * Syntax: <code>langchain4j-tools:toolId</code> + * + * Path parameter: toolId (required) + * The tool name + * + * @param path toolId + * @return the dsl builder + */ + default LangChain4jToolsEndpointBuilder langchain4jTools(String path) { + return LangChain4jToolsEndpointBuilderFactory.endpointBuilder("langchain4j-tools", path); + } + /** + * LangChain4j Tools (camel-langchain4j-tools) + * LangChain4j Tools and Function Calling Features + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-tools + * + * Syntax: <code>langchain4j-tools:toolId</code> + * + * Path parameter: toolId (required) + * The tool name + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path toolId + * @return the dsl builder + */ + default LangChain4jToolsEndpointBuilder langchain4jTools(String componentName, String path) { + return LangChain4jToolsEndpointBuilderFactory.endpointBuilder(componentName, path); + } + + } + static LangChain4jToolsEndpointBuilder endpointBuilder(String componentName, String path) { + class LangChain4jToolsEndpointBuilderImpl extends AbstractEndpointBuilder implements LangChain4jToolsEndpointBuilder, AdvancedLangChain4jToolsEndpointBuilder { + public LangChain4jToolsEndpointBuilderImpl(String path) { + super(componentName, path); + } + } + return new LangChain4jToolsEndpointBuilderImpl(path); + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..d2debfc78b6 --- /dev/null +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/LangChain4jWebSearchEndpointBuilderFactory.java @@ -0,0 +1,461 @@ +/* Generated by camel build tools - do NOT edit this file! */ +/* + * 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.builder.endpoint.dsl; + +import java.util.*; +import java.util.concurrent.*; +import java.util.function.*; +import java.util.stream.*; +import javax.annotation.processing.Generated; +import org.apache.camel.builder.EndpointConsumerBuilder; +import org.apache.camel.builder.EndpointProducerBuilder; +import org.apache.camel.builder.endpoint.AbstractEndpointBuilder; + +/** + * LangChain4j Web Search Engine + * + * Generated by camel build tools - do NOT edit this file! + */ +@Generated("org.apache.camel.maven.packaging.EndpointDslMojo") +public interface LangChain4jWebSearchEndpointBuilderFactory { + + /** + * Builder for endpoint for the LangChain4j Web Search component. + */ + public interface LangChain4jWebSearchEndpointBuilder + extends + EndpointProducerBuilder { + default AdvancedLangChain4jWebSearchEndpointBuilder advanced() { + return (AdvancedLangChain4jWebSearchEndpointBuilder) this; + } + + /** + * The additionalParams is the additional parameters for the search + * request are a map of key-value pairs that represent additional + * parameters for the search request. + * + * The option is a: <code>java.util.Map<java.lang.String, + * java.lang.Object></code> type. + * + * Group: producer + * + * @param additionalParams the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder additionalParams(Map<java.lang.String, java.lang.Object> additionalParams) { + doSetProperty("additionalParams", additionalParams); + return this; + } + /** + * The additionalParams is the additional parameters for the search + * request are a map of key-value pairs that represent additional + * parameters for the search request. + * + * The option will be converted to a + * <code>java.util.Map<java.lang.String, java.lang.Object></code> + * type. + * + * Group: producer + * + * @param additionalParams the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder additionalParams(String additionalParams) { + doSetProperty("additionalParams", additionalParams); + return this; + } + /** + * The geoLocation is the desired geolocation for search results. Each + * search engine may have a different set of supported geolocations. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param geoLocation the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder geoLocation(String geoLocation) { + doSetProperty("geoLocation", geoLocation); + return this; + } + /** + * The language is the desired language for search results. The expected + * values may vary depending on the search engine. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param language the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder language(String language) { + doSetProperty("language", language); + return this; + } + /** + * The 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. + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Required: true + * Default: 1 + * Group: producer + * + * @param maxResults the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder maxResults(Integer maxResults) { + doSetProperty("maxResults", maxResults); + return this; + } + /** + * The 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. + * + * The option will be converted to a <code>java.lang.Integer</code> + * type. + * + * Required: true + * Default: 1 + * Group: producer + * + * @param maxResults the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder maxResults(String maxResults) { + doSetProperty("maxResults", maxResults); + return this; + } + /** + * The 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 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. + * + * Required: true + * Default: CONTENT + * Group: producer + * + * @param resultType the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder resultType(org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchResultType resultType) { + doSetProperty("resultType", resultType); + return this; + } + /** + * The 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 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. + * + * Required: true + * Default: CONTENT + * Group: producer + * + * @param resultType the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder resultType(String resultType) { + doSetProperty("resultType", resultType); + return this; + } + /** + * The safeSearch is the safe search flag, indicating whether to enable + * or disable safe search. + * + * The option is a: <code>java.lang.Boolean</code> type. + * + * Group: producer + * + * @param safeSearch the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder safeSearch(Boolean safeSearch) { + doSetProperty("safeSearch", safeSearch); + return this; + } + /** + * The safeSearch is the safe search flag, indicating whether to enable + * or disable safe search. + * + * The option will be converted to a <code>java.lang.Boolean</code> + * type. + * + * Group: producer + * + * @param safeSearch the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder safeSearch(String safeSearch) { + doSetProperty("safeSearch", safeSearch); + return this; + } + /** + * The startIndex is the start index for search results, which may vary + * depending on the search engine. + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Group: producer + * + * @param startIndex the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder startIndex(Integer startIndex) { + doSetProperty("startIndex", startIndex); + return this; + } + /** + * The startIndex is the start index for search results, which may vary + * depending on the search engine. + * + * The option will be converted to a <code>java.lang.Integer</code> + * type. + * + * Group: producer + * + * @param startIndex the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder startIndex(String startIndex) { + doSetProperty("startIndex", startIndex); + return this; + } + /** + * The startPage is the start page number for search results. + * + * The option is a: <code>java.lang.Integer</code> type. + * + * Group: producer + * + * @param startPage the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder startPage(Integer startPage) { + doSetProperty("startPage", startPage); + return this; + } + /** + * The startPage is the start page number for search results. + * + * The option will be converted to a <code>java.lang.Integer</code> + * type. + * + * Group: producer + * + * @param startPage the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder startPage(String startPage) { + doSetProperty("startPage", startPage); + return this; + } + /** + * The WebSearchEngine engine to use. This is mandatory. Use one of the + * implementations from Langchain4j web search engines. + * + * The option is a: + * <code>dev.langchain4j.web.search.WebSearchEngine</code> type. + * + * Required: true + * Group: producer + * + * @param webSearchEngine the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder webSearchEngine(dev.langchain4j.web.search.WebSearchEngine webSearchEngine) { + doSetProperty("webSearchEngine", webSearchEngine); + return this; + } + /** + * The WebSearchEngine engine to use. This is mandatory. Use one of the + * implementations from Langchain4j web search engines. + * + * The option will be converted to a + * <code>dev.langchain4j.web.search.WebSearchEngine</code> type. + * + * Required: true + * Group: producer + * + * @param webSearchEngine the value to set + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder webSearchEngine(String webSearchEngine) { + doSetProperty("webSearchEngine", webSearchEngine); + return this; + } + } + + /** + * Advanced builder for endpoint for the LangChain4j Web Search component. + */ + public interface AdvancedLangChain4jWebSearchEndpointBuilder + extends + EndpointProducerBuilder { + default LangChain4jWebSearchEndpointBuilder basic() { + return (LangChain4jWebSearchEndpointBuilder) this; + } + + /** + * 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. + * + * The option is a: <code>boolean</code> type. + * + * Default: false + * Group: producer (advanced) + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jWebSearchEndpointBuilder lazyStartProducer(boolean lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * 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. + * + * The option will be converted to a <code>boolean</code> type. + * + * Default: false + * Group: producer (advanced) + * + * @param lazyStartProducer the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jWebSearchEndpointBuilder lazyStartProducer(String lazyStartProducer) { + doSetProperty("lazyStartProducer", lazyStartProducer); + return this; + } + /** + * The webSearchRequest is the custom WebSearchRequest - advanced. + * + * The option is a: + * <code>dev.langchain4j.web.search.WebSearchRequest</code> type. + * + * Group: advanced + * + * @param webSearchRequest the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jWebSearchEndpointBuilder webSearchRequest(dev.langchain4j.web.search.WebSearchRequest webSearchRequest) { + doSetProperty("webSearchRequest", webSearchRequest); + return this; + } + /** + * The webSearchRequest is the custom WebSearchRequest - advanced. + * + * The option will be converted to a + * <code>dev.langchain4j.web.search.WebSearchRequest</code> type. + * + * Group: advanced + * + * @param webSearchRequest the value to set + * @return the dsl builder + */ + default AdvancedLangChain4jWebSearchEndpointBuilder webSearchRequest(String webSearchRequest) { + doSetProperty("webSearchRequest", webSearchRequest); + return this; + } + } + + public interface LangChain4jWebSearchBuilders { + /** + * LangChain4j Web Search (camel-langchain4j-web-search) + * LangChain4j Web Search Engine + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-web-search + * + * Syntax: <code>langchain4j-web-search:searchId</code> + * + * Path parameter: searchId (required) + * The id + * + * @param path searchId + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder langchain4jWebSearch(String path) { + return LangChain4jWebSearchEndpointBuilderFactory.endpointBuilder("langchain4j-web-search", path); + } + /** + * LangChain4j Web Search (camel-langchain4j-web-search) + * LangChain4j Web Search Engine + * + * Category: ai + * Since: 4.8 + * Maven coordinates: org.apache.camel:camel-langchain4j-web-search + * + * Syntax: <code>langchain4j-web-search:searchId</code> + * + * Path parameter: searchId (required) + * The id + * + * @param componentName to use a custom component name for the endpoint + * instead of the default name + * @param path searchId + * @return the dsl builder + */ + default LangChain4jWebSearchEndpointBuilder langchain4jWebSearch(String componentName, String path) { + return LangChain4jWebSearchEndpointBuilderFactory.endpointBuilder(componentName, path); + } + + } + static LangChain4jWebSearchEndpointBuilder endpointBuilder(String componentName, String path) { + class LangChain4jWebSearchEndpointBuilderImpl extends AbstractEndpointBuilder implements LangChain4jWebSearchEndpointBuilder, AdvancedLangChain4jWebSearchEndpointBuilder { + public LangChain4jWebSearchEndpointBuilderImpl(String path) { + super(componentName, path); + } + } + return new LangChain4jWebSearchEndpointBuilderImpl(path); + } +} \ No newline at end of file diff --git a/dsl/camel-kamelet-main/src/generated/resources/camel-component-known-dependencies.properties b/dsl/camel-kamelet-main/src/generated/resources/camel-component-known-dependencies.properties index 14982e5e44a..2d92f9f1ce4 100644 --- a/dsl/camel-kamelet-main/src/generated/resources/camel-component-known-dependencies.properties +++ b/dsl/camel-kamelet-main/src/generated/resources/camel-component-known-dependencies.properties @@ -219,6 +219,8 @@ org.apache.camel.component.kubernetes.services.KubernetesServicesComponent=camel org.apache.camel.component.kudu.KuduComponent=camel:kudu org.apache.camel.component.langchain4j.chat.LangChain4jChatComponent=camel:langchain4j-chat org.apache.camel.component.langchain4j.embeddings.LangChain4jEmbeddingsComponent=camel:langchain4j-embeddings +org.apache.camel.component.langchain4j.tools.LangChain4jToolsComponent=camel:langchain4j-tools +org.apache.camel.component.langchain4j.web.search.LangChain4jWebSearchComponent=camel:langchain4j-web-search org.apache.camel.component.language.LanguageComponent=camel:language org.apache.camel.component.ldap.LdapComponent=camel:ldap org.apache.camel.component.ldif.LdifComponent=camel:ldif diff --git a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/Langchain4jToolsUriDsl.kt b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/Langchain4jToolsUriDsl.kt new file mode 100644 index 00000000000..d952f9dee12 --- /dev/null +++ b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/Langchain4jToolsUriDsl.kt @@ -0,0 +1,157 @@ +/* + * 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.kotlin.components + +import kotlin.Boolean +import kotlin.String +import kotlin.Unit +import org.apache.camel.kotlin.CamelDslMarker +import org.apache.camel.kotlin.UriDsl + +/** + * LangChain4j Tools and Function Calling Features + */ +public fun UriDsl.`langchain4j-tools`(i: Langchain4jToolsUriDsl.() -> Unit) { + Langchain4jToolsUriDsl(this).apply(i) +} + +@CamelDslMarker +public class Langchain4jToolsUriDsl( + it: UriDsl, +) { + private val it: UriDsl + + init { + this.it = it + this.it.component("langchain4j-tools") + } + + private var toolId: String = "" + + /** + * The tool name + */ + public fun toolId(toolId: String) { + this.toolId = toolId + it.url("$toolId") + } + + /** + * The tags for the tools + */ + public fun tags(tags: String) { + it.property("tags", tags) + } + + /** + * Tool description + */ + public fun description(description: String) { + it.property("description", description) + } + + /** + * List of Tool parameters in the form of parameter.= + */ + public fun parameters(parameters: String) { + it.property("parameters", parameters) + } + + /** + * Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions + * (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the + * likes, will now be processed as a message and handled by the routing Error Handler. Important: + * This is only possible if the 3rd party component allows Camel to be alerted if an exception was + * thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not + * possible. In other situations we may improve the Camel component to hook into the 3rd party + * component and make this possible for future releases. By default the consumer will use the + * org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or + * ERROR level and ignored. + */ + public fun bridgeErrorHandler(bridgeErrorHandler: String) { + it.property("bridgeErrorHandler", bridgeErrorHandler) + } + + /** + * Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions + * (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the + * likes, will now be processed as a message and handled by the routing Error Handler. Important: + * This is only possible if the 3rd party component allows Camel to be alerted if an exception was + * thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not + * possible. In other situations we may improve the Camel component to hook into the 3rd party + * component and make this possible for future releases. By default the consumer will use the + * org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or + * ERROR level and ignored. + */ + public fun bridgeErrorHandler(bridgeErrorHandler: Boolean) { + it.property("bridgeErrorHandler", bridgeErrorHandler.toString()) + } + + /** + * Tool's Camel Parameters, programmatically define Tool description and parameters + */ + public fun camelToolParameter(camelToolParameter: String) { + it.property("camelToolParameter", camelToolParameter) + } + + /** + * To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is + * enabled then this option is not in use. By default the consumer will deal with exceptions, that + * will be logged at WARN or ERROR level and ignored. + */ + public fun exceptionHandler(exceptionHandler: String) { + it.property("exceptionHandler", exceptionHandler) + } + + /** + * Sets the exchange pattern when the consumer creates an exchange. + */ + public fun exchangePattern(exchangePattern: String) { + it.property("exchangePattern", exchangePattern) + } + + /** + * 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. + */ + public fun lazyStartProducer(lazyStartProducer: String) { + it.property("lazyStartProducer", lazyStartProducer) + } + + /** + * 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. + */ + public fun lazyStartProducer(lazyStartProducer: Boolean) { + it.property("lazyStartProducer", lazyStartProducer.toString()) + } + + /** + * Chat Language Model of type dev.langchain4j.model.chat.ChatLanguageModel + */ + public fun chatModel(chatModel: String) { + it.property("chatModel", chatModel) + } +} diff --git a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/Langchain4jWebSearchUriDsl.kt b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/Langchain4jWebSearchUriDsl.kt new file mode 100644 index 00000000000..5a19ab25af8 --- /dev/null +++ b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/Langchain4jWebSearchUriDsl.kt @@ -0,0 +1,189 @@ +/* + * 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.kotlin.components + +import kotlin.Boolean +import kotlin.Int +import kotlin.String +import kotlin.Unit +import org.apache.camel.kotlin.CamelDslMarker +import org.apache.camel.kotlin.UriDsl + +/** + * LangChain4j Web Search Engine + */ +public fun UriDsl.`langchain4j-web-search`(i: Langchain4jWebSearchUriDsl.() -> Unit) { + Langchain4jWebSearchUriDsl(this).apply(i) +} + +@CamelDslMarker +public class Langchain4jWebSearchUriDsl( + it: UriDsl, +) { + private val it: UriDsl + + init { + this.it = it + this.it.component("langchain4j-web-search") + } + + private var searchId: String = "" + + /** + * The id + */ + public fun searchId(searchId: String) { + this.searchId = searchId + it.url("$searchId") + } + + /** + * The additionalParams is the additional parameters for the search request are a map of key-value + * pairs that represent additional parameters for the search request. + */ + public fun additionalParams(additionalParams: String) { + it.property("additionalParams", additionalParams) + } + + /** + * The geoLocation is the desired geolocation for search results. Each search engine may have a + * different set of supported geolocations. + */ + public fun geoLocation(geoLocation: String) { + it.property("geoLocation", geoLocation) + } + + /** + * The language is the desired language for search results. The expected values may vary depending + * on the search engine. + */ + public fun language(language: String) { + it.property("language", language) + } + + /** + * The 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. + */ + public fun maxResults(maxResults: String) { + it.property("maxResults", maxResults) + } + + /** + * The 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. + */ + public fun maxResults(maxResults: Int) { + it.property("maxResults", maxResults.toString()) + } + + /** + * The 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 maxResults is equal to 1, the response will be a single object instead of a list. + */ + public fun resultType(resultType: String) { + it.property("resultType", resultType) + } + + /** + * The safeSearch is the safe search flag, indicating whether to enable or disable safe search. + */ + public fun safeSearch(safeSearch: String) { + it.property("safeSearch", safeSearch) + } + + /** + * The safeSearch is the safe search flag, indicating whether to enable or disable safe search. + */ + public fun safeSearch(safeSearch: Boolean) { + it.property("safeSearch", safeSearch.toString()) + } + + /** + * The startIndex is the start index for search results, which may vary depending on the search + * engine. + */ + public fun startIndex(startIndex: String) { + it.property("startIndex", startIndex) + } + + /** + * The startIndex is the start index for search results, which may vary depending on the search + * engine. + */ + public fun startIndex(startIndex: Int) { + it.property("startIndex", startIndex.toString()) + } + + /** + * The startPage is the start page number for search results + */ + public fun startPage(startPage: String) { + it.property("startPage", startPage) + } + + /** + * The startPage is the start page number for search results + */ + public fun startPage(startPage: Int) { + it.property("startPage", startPage.toString()) + } + + /** + * The WebSearchEngine engine to use. This is mandatory. Use one of the implementations from + * Langchain4j web search engines. + */ + public fun webSearchEngine(webSearchEngine: String) { + it.property("webSearchEngine", webSearchEngine) + } + + /** + * 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. + */ + public fun lazyStartProducer(lazyStartProducer: String) { + it.property("lazyStartProducer", lazyStartProducer) + } + + /** + * 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. + */ + public fun lazyStartProducer(lazyStartProducer: Boolean) { + it.property("lazyStartProducer", lazyStartProducer.toString()) + } + + /** + * The webSearchRequest is the custom WebSearchRequest - advanced + */ + public fun webSearchRequest(webSearchRequest: String) { + it.property("webSearchRequest", webSearchRequest) + } +} diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java index 718df213f3b..f9875835a47 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/MojoHelper.java @@ -39,7 +39,9 @@ public final class MojoHelper { case "camel-ai": return Arrays.asList(dir.resolve("camel-chatscript"), dir.resolve("camel-djl"), dir.resolve("camel-langchain4j-core"), dir.resolve("camel-langchain4j-chat"), - dir.resolve("camel-langchain4j-embeddings"), dir.resolve("camel-qdrant"), dir.resolve("camel-milvus"), + dir.resolve("camel-langchain4j-embeddings"), dir.resolve("camel-langchain4j-tokenizer"), + dir.resolve("camel-langchain4j-tools"), dir.resolve("camel-langchain4j-web-search"), + dir.resolve("camel-qdrant"), dir.resolve("camel-milvus"), dir.resolve("camel-pinecone")); case "camel-as2": return Collections.singletonList(dir.resolve("camel-as2-component"));
