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 fee75d93bfa0a47023bf10301dcc7f4e0de3e747 Author: James Netherton <[email protected]> AuthorDate: Mon Sep 16 10:12:32 2024 +0100 Add langchain4j-tokenizer JVM only extension --- catalog/pom.xml | 13 +++ .../ROOT/examples/others/langchain4j-tokenizer.yml | 13 +++ docs/modules/ROOT/nav.adoc | 1 + .../extensions/langchain4j-tokenizer.adoc | 64 +++++++++++++ .../langchain4j-tokenizer/deployment/pom.xml | 63 +++++++++++++ .../deployment/Langchain4jTokenizerProcessor.java | 46 ++++++++++ extensions-jvm/langchain4j-tokenizer/pom.xml | 39 ++++++++ .../langchain4j-tokenizer/runtime/pom.xml | 100 +++++++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 33 +++++++ extensions-jvm/pom.xml | 1 + .../langchain4j-tokenizer/pom.xml | 84 +++++++++++++++++ .../tokenizer/it/Langchain4jTokenizerResource.java | 47 ++++++++++ .../tokenizer/it/Langchain4jTokenizerTest.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, 599 insertions(+) diff --git a/catalog/pom.xml b/catalog/pom.xml index 3e79957593..6af0e0df1c 100644 --- a/catalog/pom.xml +++ b/catalog/pom.xml @@ -2476,6 +2476,19 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tokenizer</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/others/langchain4j-tokenizer.yml b/docs/modules/ROOT/examples/others/langchain4j-tokenizer.yml new file mode 100644 index 0000000000..d71c08a072 --- /dev/null +++ b/docs/modules/ROOT/examples/others/langchain4j-tokenizer.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-tokenizer +cqArtifactIdBase: langchain4j-tokenizer +cqNativeSupported: false +cqStatus: Preview +cqDeprecated: false +cqJvmSince: 3.15.0 +cqNativeSince: n/a +cqCamelPartName: langchain4j-tokenizer +cqCamelPartTitle: LangChain4j Tokenizer +cqCamelPartDescription: LangChain4j Tokenizer +cqExtensionPageTitle: LangChain4j Tokenizer diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 1a6542a883..c45ca409ff 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -201,6 +201,7 @@ *** xref:reference/extensions/lra.adoc[LRA] *** 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/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-tokenizer.adoc b/docs/modules/ROOT/pages/reference/extensions/langchain4j-tokenizer.adoc new file mode 100644 index 0000000000..54062d568f --- /dev/null +++ b/docs/modules/ROOT/pages/reference/extensions/langchain4j-tokenizer.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-tokenizer"] += LangChain4j Tokenizer +:linkattrs: +:cq-artifact-id: camel-quarkus-langchain4j-tokenizer +:cq-native-supported: false +:cq-status: Preview +:cq-status-deprecation: Preview +:cq-description: LangChain4j Tokenizer +: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 Tokenizer + +[id="extensions-langchain4j-tokenizer-whats-inside"] +== What's inside + +* xref:{cq-camel-components}:others:langchain4j-tokenizer.adoc[LangChain4j Tokenizer] + +Please refer to the above link for usage and configuration details. + +[id="extensions-langchain4j-tokenizer-maven-coordinates"] +== Maven coordinates + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tokenizer</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-tokenizer-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-tokenizer/deployment/pom.xml b/extensions-jvm/langchain4j-tokenizer/deployment/pom.xml new file mode 100644 index 0000000000..b6331578e7 --- /dev/null +++ b/extensions-jvm/langchain4j-tokenizer/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-tokenizer-parent</artifactId> + <version>3.15.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-langchain4j-tokenizer-deployment</artifactId> + <name>Camel Quarkus :: LangChain4j Tokenizer :: 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-tokenizer</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-tokenizer/deployment/src/main/java/org/apache/camel/quarkus/component/langchain4j/tokenizer/deployment/Langchain4jTokenizerProcessor.java b/extensions-jvm/langchain4j-tokenizer/deployment/src/main/java/org/apache/camel/quarkus/component/langchain4j/tokenizer/deployment/Langchain4jTokenizerProcessor.java new file mode 100644 index 0000000000..32025e83f9 --- /dev/null +++ b/extensions-jvm/langchain4j-tokenizer/deployment/src/main/java/org/apache/camel/quarkus/component/langchain4j/tokenizer/deployment/Langchain4jTokenizerProcessor.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.tokenizer.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 Langchain4jTokenizerProcessor { + + private static final Logger LOG = Logger.getLogger(Langchain4jTokenizerProcessor.class); + private static final String FEATURE = "camel-langchain4j-tokenizer"; + + @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-tokenizer/pom.xml b/extensions-jvm/langchain4j-tokenizer/pom.xml new file mode 100644 index 0000000000..37c6d1b911 --- /dev/null +++ b/extensions-jvm/langchain4j-tokenizer/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-tokenizer-parent</artifactId> + <name>Camel Quarkus :: LangChain4j Tokenizer</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> +</project> diff --git a/extensions-jvm/langchain4j-tokenizer/runtime/pom.xml b/extensions-jvm/langchain4j-tokenizer/runtime/pom.xml new file mode 100644 index 0000000000..bcc5abc5c6 --- /dev/null +++ b/extensions-jvm/langchain4j-tokenizer/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-tokenizer-parent</artifactId> + <version>3.15.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-langchain4j-tokenizer</artifactId> + <name>Camel Quarkus :: LangChain4j Tokenizer :: Runtime</name> + <description>LangChain4j Tokenizer</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-tokenizer</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-tokenizer/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/langchain4j-tokenizer/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000000..60bbc4da8e --- /dev/null +++ b/extensions-jvm/langchain4j-tokenizer/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 Tokenizer" +description: "LangChain4j Tokenizer" +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-tokenizer.html" + categories: + - "integration" + status: + - "preview" diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml index 13aae3e13f..787b761dcc 100644 --- a/extensions-jvm/pom.xml +++ b/extensions-jvm/pom.xml @@ -77,6 +77,7 @@ <module>json-patch</module> <module>jsonapi</module> <module>langchain4j-embeddings</module> + <module>langchain4j-tokenizer</module> <module>ldif</module> <module>lucene</module> <module>mail-microsoft-oauth</module> diff --git a/integration-tests-jvm/langchain4j-tokenizer/pom.xml b/integration-tests-jvm/langchain4j-tokenizer/pom.xml new file mode 100644 index 0000000000..38660216bf --- /dev/null +++ b/integration-tests-jvm/langchain4j-tokenizer/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-tokenizer</artifactId> + <name>Camel Quarkus :: Integration Tests :: LangChain4j Tokenizer</name> + <description>Integration tests for Camel Quarkus LangChain4j Tokenizer extension</description> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tokenizer</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-tokenizer-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-tokenizer/src/main/java/org/apache/camel/quarkus/component/langchain4j/tokenizer/it/Langchain4jTokenizerResource.java b/integration-tests-jvm/langchain4j-tokenizer/src/main/java/org/apache/camel/quarkus/component/langchain4j/tokenizer/it/Langchain4jTokenizerResource.java new file mode 100644 index 0000000000..226bc844fd --- /dev/null +++ b/integration-tests-jvm/langchain4j-tokenizer/src/main/java/org/apache/camel/quarkus/component/langchain4j/tokenizer/it/Langchain4jTokenizerResource.java @@ -0,0 +1,47 @@ +/* + * 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.tokenizer.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-tokenizer") +@ApplicationScoped +public class Langchain4jTokenizerResource { + + private static final Logger LOG = Logger.getLogger(Langchain4jTokenizerResource.class); + + private static final String OTHER_LANGCHAIN4J_TOKENIZER = "langchain4j-tokenizer"; + @Inject + CamelContext context; + + @Path("/load/other/langchain4j-tokenizer") + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response loadOtherLangchain4jTokenizer() throws Exception { + /* This is an autogenerated test */ + /* No way to test a Camel artifact of kind "other" */ + return Response.ok().build(); + } +} diff --git a/integration-tests-jvm/langchain4j-tokenizer/src/test/java/org/apache/camel/quarkus/component/langchain4j/tokenizer/it/Langchain4jTokenizerTest.java b/integration-tests-jvm/langchain4j-tokenizer/src/test/java/org/apache/camel/quarkus/component/langchain4j/tokenizer/it/Langchain4jTokenizerTest.java new file mode 100644 index 0000000000..51fe800ca4 --- /dev/null +++ b/integration-tests-jvm/langchain4j-tokenizer/src/test/java/org/apache/camel/quarkus/component/langchain4j/tokenizer/it/Langchain4jTokenizerTest.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.tokenizer.it; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import org.junit.jupiter.api.Test; + +@QuarkusTest +class Langchain4jTokenizerTest { + + @Test + public void loadOtherLangchain4jTokenizer() { + /* A simple autogenerated test */ + RestAssured.get("/langchain4j-tokenizer/load/other/langchain4j-tokenizer") + .then() + .statusCode(200); + } + +} diff --git a/integration-tests-jvm/pom.xml b/integration-tests-jvm/pom.xml index 71c1c86ed2..6620b070bf 100644 --- a/integration-tests-jvm/pom.xml +++ b/integration-tests-jvm/pom.xml @@ -76,6 +76,7 @@ <module>json-patch</module> <module>jsonapi</module> <module>langchain4j-embeddings</module> + <module>langchain4j-tokenizer</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 8b52955808..baaacce81c 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -1836,6 +1836,11 @@ <artifactId>camel-langchain4j-embeddings</artifactId> <version>${camel.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-langchain4j-tokenizer</artifactId> + <version>${camel.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-language</artifactId> @@ -4797,6 +4802,16 @@ <artifactId>camel-quarkus-langchain4j-embeddings-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tokenizer</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tokenizer-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 e8c05b5c0b..d1b79a280c 100644 --- a/poms/bom/src/main/generated/flattened-full-pom.xml +++ b/poms/bom/src/main/generated/flattened-full-pom.xml @@ -1773,6 +1773,11 @@ <artifactId>camel-langchain4j-embeddings</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-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-language</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -4722,6 +4727,16 @@ <artifactId>camel-quarkus-langchain4j-embeddings-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-tokenizer</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-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-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 d0ea8583e9..b63b438799 100644 --- a/poms/bom/src/main/generated/flattened-reduced-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml @@ -1773,6 +1773,11 @@ <artifactId>camel-langchain4j-embeddings</artifactId> <version>4.8.0</version> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-langchain4j-tokenizer</artifactId> + <version>4.8.0</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-language</artifactId> @@ -4722,6 +4727,16 @@ <artifactId>camel-quarkus-langchain4j-embeddings-deployment</artifactId> <version>3.15.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tokenizer</artifactId> + <version>3.15.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-langchain4j-tokenizer-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 0849425ea3..83b272cdd3 100644 --- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml @@ -1773,6 +1773,11 @@ <artifactId>camel-langchain4j-embeddings</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-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-language</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -4722,6 +4727,16 @@ <artifactId>camel-quarkus-langchain4j-embeddings-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-tokenizer</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-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-language</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} -->
