Skip to content

Commit

Permalink
CAMEL-21153: added the starter for camel-langchain4j-tools
Browse files Browse the repository at this point in the history
  • Loading branch information
orpiske committed Sep 3, 2024
1 parent 4fa767a commit 1cdc74f
Show file tree
Hide file tree
Showing 13 changed files with 669 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ kubernetes-services
kudu
langchain4j-chat
langchain4j-embeddings
langchain4j-tools
langchain4j-web-search
language
ldap
Expand Down
Original file line number Diff line number Diff line change
@@ -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.springboot",
"artifactId": "camel-langchain4j-tools-starter",
"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 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." },
"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 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." },
"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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." },
"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.langchain4j.model.chat.ChatLanguageModel" }
},
"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 parameter.=" },
"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 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." },
"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 default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
"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 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." },
"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.langchain4j.model.chat.ChatLanguageModel" }
}
}
48 changes: 48 additions & 0 deletions components-starter/camel-langchain4j-tools-starter/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>components-starter</artifactId>
<version>4.8.0-SNAPSHOT</version>
</parent>
<artifactId>camel-langchain4j-tools-starter</artifactId>
<packaging>jar</packaging>
<name>Camel SB Starters :: langchain4j-tools</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring-boot-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-langchain4j-tools</artifactId>
<version>${camel-version}</version>
</dependency>
<!--START OF GENERATED CODE-->
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-core-starter</artifactId>
</dependency>
<!--END OF GENERATED CODE-->
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"groups": [
{
"name": "camel.component.langchain4j-tools",
"type": "org.apache.camel.component.langchain4j.tools.springboot.LangChain4jToolsComponentConfiguration",
"sourceType": "org.apache.camel.component.langchain4j.tools.springboot.LangChain4jToolsComponentConfiguration"
},
{
"name": "camel.component.langchain4j-tools.customizer",
"type": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties",
"sourceType": "org.apache.camel.component.langchain4j.tools.springboot.LangChain4jToolsComponentConfiguration",
"sourceMethod": "getCustomizer()"
}
],
"properties": [
{
"name": "camel.component.langchain4j-tools.autowired-enabled",
"type": "java.lang.Boolean",
"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 type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.",
"sourceType": "org.apache.camel.component.langchain4j.tools.springboot.LangChain4jToolsComponentConfiguration",
"defaultValue": true
},
{
"name": "camel.component.langchain4j-tools.bridge-error-handler",
"type": "java.lang.Boolean",
"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 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.",
"sourceType": "org.apache.camel.component.langchain4j.tools.springboot.LangChain4jToolsComponentConfiguration",
"defaultValue": false
},
{
"name": "camel.component.langchain4j-tools.chat-model",
"type": "dev.langchain4j.model.chat.ChatLanguageModel",
"description": "Chat Language Model of type dev.langchain4j.model.chat.ChatLanguageModel. The option is a dev.langchain4j.model.chat.ChatLanguageModel type.",
"sourceType": "org.apache.camel.component.langchain4j.tools.springboot.LangChain4jToolsComponentConfiguration"
},
{
"name": "camel.component.langchain4j-tools.configuration",
"type": "org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration",
"description": "The configuration. The option is a org.apache.camel.component.langchain4j.tools.LangChain4jToolsConfiguration type.",
"sourceType": "org.apache.camel.component.langchain4j.tools.springboot.LangChain4jToolsComponentConfiguration"
},
{
"name": "camel.component.langchain4j-tools.customizer.enabled",
"type": "java.lang.Boolean",
"sourceType": "org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon$CustomizerProperties"
},
{
"name": "camel.component.langchain4j-tools.enabled",
"type": "java.lang.Boolean",
"description": "Whether to enable auto configuration of the langchain4j-tools component. This is enabled by default.",
"sourceType": "org.apache.camel.component.langchain4j.tools.springboot.LangChain4jToolsComponentConfiguration"
},
{
"name": "camel.component.langchain4j-tools.lazy-start-producer",
"type": "java.lang.Boolean",
"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 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.",
"sourceType": "org.apache.camel.component.langchain4j.tools.springboot.LangChain4jToolsComponentConfiguration",
"defaultValue": false
}
],
"hints": []
}
Loading

0 comments on commit 1cdc74f

Please sign in to comment.