This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 2b5537b5ae7be04cebbc05d82e0f7902bd2ec301 Author: James Netherton <[email protected]> AuthorDate: Mon Sep 16 10:14:35 2024 +0100 Add langchain4j-tools JVM only extension --- catalog/pom.xml | 13 +++ .../ROOT/examples/components/langchain4j-tools.yml | 13 +++ docs/modules/ROOT/nav.adoc | 1 + .../reference/extensions/langchain4j-tools.adoc | 64 +++++++++++++ .../langchain4j-tools/deployment/pom.xml | 63 +++++++++++++ .../deployment/Langchain4jToolsProcessor.java | 46 ++++++++++ extensions-jvm/langchain4j-tools/pom.xml | 39 ++++++++ extensions-jvm/langchain4j-tools/runtime/pom.xml | 100 +++++++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 33 +++++++ extensions-jvm/pom.xml | 1 + integration-tests-jvm/langchain4j-tools/pom.xml | 84 +++++++++++++++++ .../tools/it/Langchain4jToolsResource.java | 50 +++++++++++ .../langchain4j/tools/it/Langchain4jToolsTest.java | 34 +++++++ integration-tests-jvm/pom.xml | 1 + poms/bom/pom.xml | 15 ++++ poms/bom/src/main/generated/flattened-full-pom.xml | 15 ++++ .../src/main/generated/flattened-reduced-pom.xml | 15 ++++ .../generated/flattened-reduced-verbose-pom.xml | 15 ++++ 18 files changed, 602 insertions(+) diff --git a/catalog/pom.xml b/catalog/pom.xml index 6af0e0df1c..5fdecb6c2d 100644 --- a/catalog/pom.xml +++ b/catalog/pom.xml @@ -2489,6 +2489,19 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-language</artifactId> diff --git a/docs/modules/ROOT/examples/components/langchain4j-tools.yml b/docs/modules/ROOT/examples/components/langchain4j-tools.yml new file mode 100644 index 0000000000..c7e77fa6a9 --- /dev/null +++ b/docs/modules/ROOT/examples/components/langchain4j-tools.yml @@ -0,0 +1,13 @@ +# Do not edit directly! +# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page +cqArtifactId: camel-quarkus-langchain4j-tools +cqArtifactIdBase: langchain4j-tools +cqNativeSupported: false +cqStatus: Preview +cqDeprecated: false +cqJvmSince: 3.15.0 +cqNativeSince: n/a +cqCamelPartName: langchain4j-tools +cqCamelPartTitle: LangChain4j Tools +cqCamelPartDescription: LangChain4j Tools and Function Calling Features +cqExtensionPageTitle: LangChain4j Tools diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index c45ca409ff..062df5213b 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -202,6 +202,7 @@ *** xref:reference/extensions/lzf.adoc[LZF Deflate Compression] *** xref:reference/extensions/langchain4j-embeddings.adoc[LangChain4j Embeddings] *** xref:reference/extensions/langchain4j-tokenizer.adoc[LangChain4j Tokenizer] +*** xref:reference/extensions/langchain4j-tools.adoc[LangChain4j Tools] *** xref:reference/extensions/language.adoc[Language] *** xref:reference/extensions/leveldb.adoc[LevelDB] *** xref:reference/extensions/log.adoc[Log] diff --git a/docs/modules/ROOT/pages/reference/extensions/langchain4j-tools.adoc b/docs/modules/ROOT/pages/reference/extensions/langchain4j-tools.adoc new file mode 100644 index 0000000000..0135293c6a --- /dev/null +++ b/docs/modules/ROOT/pages/reference/extensions/langchain4j-tools.adoc @@ -0,0 +1,64 @@ +// Do not edit directly! +// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page +[id="extensions-langchain4j-tools"] += LangChain4j Tools +:linkattrs: +:cq-artifact-id: camel-quarkus-langchain4j-tools +:cq-native-supported: false +:cq-status: Preview +:cq-status-deprecation: Preview +:cq-description: LangChain4j Tools and Function Calling Features +:cq-deprecated: false +:cq-jvm-since: 3.15.0 +:cq-native-since: n/a + +ifeval::[{doc-show-badges} == true] +[.badges] +[.badge-key]##JVM since##[.badge-supported]##3.15.0## [.badge-key]##Native##[.badge-unsupported]##unsupported## +endif::[] + +LangChain4j Tools and Function Calling Features + +[id="extensions-langchain4j-tools-whats-inside"] +== What's inside + +* xref:{cq-camel-components}::langchain4j-tools-component.adoc[LangChain4j Tools component], URI syntax: `langchain4j-tools:toolId` + +Please refer to the above link for usage and configuration details. + +[id="extensions-langchain4j-tools-maven-coordinates"] +== Maven coordinates + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools</artifactId> +</dependency> +---- +ifeval::[{doc-show-user-guide-link} == true] +Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. +endif::[] + +[id="extensions-langchain4j-tools-quarkus-langchain4j-bom"] +== Ensure Quarkus LangChain4j dependencies version alignment with the Bom + +In order to ensure alignment across all Quarkus and LangChain4j related dependencies, it is recommended to import the Quarkus LangChain4j bom as below: +[source,xml] +---- +<dependencyManagement> + <dependencies> + <dependency> + <groupId>io.quarkiverse.langchain4j</groupId> + <artifactId>quarkus-langchain4j-bom</artifactId> + <version>${insert your version here}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + ... +</dependencyManagement> +---- + +Note that the import order is paramount when using maven `dependencyManagement`. +As such, one might need to import the `quarkus-langchain4j-bom` before other related Camel and Quarkus boms. diff --git a/extensions-jvm/langchain4j-tools/deployment/pom.xml b/extensions-jvm/langchain4j-tools/deployment/pom.xml new file mode 100644 index 0000000000..3461c55fa2 --- /dev/null +++ b/extensions-jvm/langchain4j-tools/deployment/pom.xml @@ -0,0 +1,63 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools-parent</artifactId> + <version>3.15.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-langchain4j-tools-deployment</artifactId> + <name>Camel Quarkus :: LangChain4j Tools :: Deployment</name> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/extensions-jvm/langchain4j-tools/deployment/src/main/java/org/apache/camel/quarkus/component/langchain4j/tools/deployment/Langchain4jToolsProcessor.java b/extensions-jvm/langchain4j-tools/deployment/src/main/java/org/apache/camel/quarkus/component/langchain4j/tools/deployment/Langchain4jToolsProcessor.java new file mode 100644 index 0000000000..1b52aa60a1 --- /dev/null +++ b/extensions-jvm/langchain4j-tools/deployment/src/main/java/org/apache/camel/quarkus/component/langchain4j/tools/deployment/Langchain4jToolsProcessor.java @@ -0,0 +1,46 @@ +/* + * 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.quarkus.component.langchain4j.tools.deployment; + +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.annotations.ExecutionTime; +import io.quarkus.deployment.annotations.Record; +import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; +import org.apache.camel.quarkus.core.JvmOnlyRecorder; +import org.jboss.logging.Logger; + +class Langchain4jToolsProcessor { + + private static final Logger LOG = Logger.getLogger(Langchain4jToolsProcessor.class); + private static final String FEATURE = "camel-langchain4j-tools"; + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + + /** + * Remove this once this extension starts supporting the native mode. + */ + @BuildStep(onlyIf = NativeOrNativeSourcesBuild.class) + @Record(value = ExecutionTime.RUNTIME_INIT) + void warnJvmInNative(JvmOnlyRecorder recorder) { + JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time + recorder.warnJvmInNative(FEATURE); // warn at runtime + } +} diff --git a/extensions-jvm/langchain4j-tools/pom.xml b/extensions-jvm/langchain4j-tools/pom.xml new file mode 100644 index 0000000000..d2aa1572bc --- /dev/null +++ b/extensions-jvm/langchain4j-tools/pom.xml @@ -0,0 +1,39 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-extensions-jvm</artifactId> + <version>3.15.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-langchain4j-tools-parent</artifactId> + <name>Camel Quarkus :: LangChain4j Tools</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> +</project> diff --git a/extensions-jvm/langchain4j-tools/runtime/pom.xml b/extensions-jvm/langchain4j-tools/runtime/pom.xml new file mode 100644 index 0000000000..4aa357fe09 --- /dev/null +++ b/extensions-jvm/langchain4j-tools/runtime/pom.xml @@ -0,0 +1,100 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools-parent</artifactId> + <version>3.15.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-langchain4j-tools</artifactId> + <name>Camel Quarkus :: LangChain4j Tools :: Runtime</name> + <description>LangChain4j Tools and Function Calling Features</description> + + <properties> + <camel.quarkus.jvmSince>3.15.0</camel.quarkus.jvmSince> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-langchain4j-tools</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + + + <profiles> + <profile> + <id>full</id> + <activation> + <property> + <name>!quickly</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-maven-plugin</artifactId> + <executions> + <execution> + <id>update-extension-doc-page</id> + <goals> + <goal>update-extension-doc-page</goal> + </goals> + <phase>process-classes</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/extensions-jvm/langchain4j-tools/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/langchain4j-tools/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000000..90367e4683 --- /dev/null +++ b/extensions-jvm/langchain4j-tools/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,33 @@ +# +# 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. +# + +# This is a generated file. Do not edit directly! +# To re-generate, run the following command from the top level directory: +# +# mvn -N cq:update-quarkus-metadata +# +--- +name: "Camel LangChain4j Tools" +description: "LangChain4j Tools and Function Calling Features" +metadata: + icon-url: "https://raw.githubusercontent.com/apache/camel-website/main/antora-ui-camel/src/img/logo-d.svg" + unlisted: true + guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/langchain4j-tools.html" + categories: + - "integration" + status: + - "preview" diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml index 787b761dcc..15419b46e1 100644 --- a/extensions-jvm/pom.xml +++ b/extensions-jvm/pom.xml @@ -78,6 +78,7 @@ <module>jsonapi</module> <module>langchain4j-embeddings</module> <module>langchain4j-tokenizer</module> + <module>langchain4j-tools</module> <module>ldif</module> <module>lucene</module> <module>mail-microsoft-oauth</module> diff --git a/integration-tests-jvm/langchain4j-tools/pom.xml b/integration-tests-jvm/langchain4j-tools/pom.xml new file mode 100644 index 0000000000..bb94ac2056 --- /dev/null +++ b/integration-tests-jvm/langchain4j-tools/pom.xml @@ -0,0 +1,84 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-build-parent-it</artifactId> + <version>3.15.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent-it/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-integration-test-langchain4j-tools</artifactId> + <name>Camel Quarkus :: Integration Tests :: LangChain4j Tools</name> + <description>Integration tests for Camel Quarkus LangChain4j Tools extension</description> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</artifactId> + </dependency> + + <!-- test dependencies --> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>rest-assured</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>virtualDependencies</id> + <activation> + <property> + <name>!noVirtualDependencies</name> + </property> + </activation> + <dependencies> + <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory --> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + </profile> + </profiles> +</project> diff --git a/integration-tests-jvm/langchain4j-tools/src/main/java/org/apache/camel/quarkus/component/langchain4j/tools/it/Langchain4jToolsResource.java b/integration-tests-jvm/langchain4j-tools/src/main/java/org/apache/camel/quarkus/component/langchain4j/tools/it/Langchain4jToolsResource.java new file mode 100644 index 0000000000..e72a18d1b7 --- /dev/null +++ b/integration-tests-jvm/langchain4j-tools/src/main/java/org/apache/camel/quarkus/component/langchain4j/tools/it/Langchain4jToolsResource.java @@ -0,0 +1,50 @@ +/* + * 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.quarkus.component.langchain4j.tools.it; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import org.apache.camel.CamelContext; +import org.jboss.logging.Logger; + +@Path("/langchain4j-tools") +@ApplicationScoped +public class Langchain4jToolsResource { + + private static final Logger LOG = Logger.getLogger(Langchain4jToolsResource.class); + + private static final String COMPONENT_LANGCHAIN4J_TOOLS = "langchain4j-tools"; + @Inject + CamelContext context; + + @Path("/load/component/langchain4j-tools") + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response loadComponentLangchain4jTools() throws Exception { + /* This is an autogenerated test */ + if (context.getComponent(COMPONENT_LANGCHAIN4J_TOOLS) != null) { + return Response.ok().build(); + } + LOG.warnf("Could not load [%s] from the Camel context", COMPONENT_LANGCHAIN4J_TOOLS); + return Response.status(500, COMPONENT_LANGCHAIN4J_TOOLS + " could not be loaded from the Camel context").build(); + } +} diff --git a/integration-tests-jvm/langchain4j-tools/src/test/java/org/apache/camel/quarkus/component/langchain4j/tools/it/Langchain4jToolsTest.java b/integration-tests-jvm/langchain4j-tools/src/test/java/org/apache/camel/quarkus/component/langchain4j/tools/it/Langchain4jToolsTest.java new file mode 100644 index 0000000000..8fcfa5f454 --- /dev/null +++ b/integration-tests-jvm/langchain4j-tools/src/test/java/org/apache/camel/quarkus/component/langchain4j/tools/it/Langchain4jToolsTest.java @@ -0,0 +1,34 @@ +/* + * 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.quarkus.component.langchain4j.tools.it; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import org.junit.jupiter.api.Test; + +@QuarkusTest +class Langchain4jToolsTest { + + @Test + public void loadComponentLangchain4jTools() { + /* A simple autogenerated test */ + RestAssured.get("/langchain4j-tools/load/component/langchain4j-tools") + .then() + .statusCode(200); + } + +} diff --git a/integration-tests-jvm/pom.xml b/integration-tests-jvm/pom.xml index 6620b070bf..3770b3e303 100644 --- a/integration-tests-jvm/pom.xml +++ b/integration-tests-jvm/pom.xml @@ -77,6 +77,7 @@ <module>jsonapi</module> <module>langchain4j-embeddings</module> <module>langchain4j-tokenizer</module> + <module>langchain4j-tools</module> <module>ldif</module> <module>lucene</module> <module>mail-microsoft-oauth</module> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index baaacce81c..9d4cd093e0 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -1841,6 +1841,11 @@ <artifactId>camel-langchain4j-tokenizer</artifactId> <version>${camel.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-langchain4j-tools</artifactId> + <version>${camel.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-language</artifactId> @@ -4812,6 +4817,16 @@ <artifactId>camel-quarkus-langchain4j-tokenizer-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-language</artifactId> diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml b/poms/bom/src/main/generated/flattened-full-pom.xml index d1b79a280c..72bbbe1ba0 100644 --- a/poms/bom/src/main/generated/flattened-full-pom.xml +++ b/poms/bom/src/main/generated/flattened-full-pom.xml @@ -1778,6 +1778,11 @@ <artifactId>camel-langchain4j-tokenizer</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>4.8.0</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-langchain4j-tools</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>4.8.0</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-language</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -4737,6 +4742,16 @@ <artifactId>camel-quarkus-langchain4j-tokenizer-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>3.15.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-langchain4j-tools</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.15.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-langchain4j-tools-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.15.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-quarkus-language</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> diff --git a/poms/bom/src/main/generated/flattened-reduced-pom.xml b/poms/bom/src/main/generated/flattened-reduced-pom.xml index b63b438799..8d8b172643 100644 --- a/poms/bom/src/main/generated/flattened-reduced-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml @@ -1778,6 +1778,11 @@ <artifactId>camel-langchain4j-tokenizer</artifactId> <version>4.8.0</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-langchain4j-tools</artifactId> + <version>4.8.0</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-language</artifactId> @@ -4737,6 +4742,16 @@ <artifactId>camel-quarkus-langchain4j-tokenizer-deployment</artifactId> <version>3.15.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools</artifactId> + <version>3.15.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tools-deployment</artifactId> + <version>3.15.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-language</artifactId> diff --git a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml index 83b272cdd3..59614909dc 100644 --- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml @@ -1778,6 +1778,11 @@ <artifactId>camel-langchain4j-tokenizer</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>4.8.0</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-langchain4j-tools</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>4.8.0</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-language</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -4737,6 +4742,16 @@ <artifactId>camel-quarkus-langchain4j-tokenizer-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>3.15.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-langchain4j-tools</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.15.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-langchain4j-tools-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.15.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-quarkus-language</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
