-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Camel 4.5 : create langchain-embeddings extension
Fixes #5970
- Loading branch information
1 parent
b5bcb87
commit c0a9858
Showing
17 changed files
with
566 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
docs/modules/ROOT/examples/components/langchain-embeddings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Do not edit directly! | ||
# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page | ||
cqArtifactId: camel-quarkus-langchain-embeddings | ||
cqArtifactIdBase: langchain-embeddings | ||
cqNativeSupported: false | ||
cqStatus: Preview | ||
cqDeprecated: false | ||
cqJvmSince: 3.10.0 | ||
cqNativeSince: n/a | ||
cqCamelPartName: langchain-embeddings | ||
cqCamelPartTitle: LangChain4j Embeddings | ||
cqCamelPartDescription: LangChain4j Embeddings | ||
cqExtensionPageTitle: LangChain4j Embeddings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
docs/modules/ROOT/pages/reference/extensions/langchain-embeddings.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Do not edit directly! | ||
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page | ||
[id="extensions-langchain-embeddings"] | ||
= LangChain4j Embeddings | ||
:linkattrs: | ||
:cq-artifact-id: camel-quarkus-langchain-embeddings | ||
:cq-native-supported: false | ||
:cq-status: Preview | ||
:cq-status-deprecation: Preview | ||
:cq-description: LangChain4j Embeddings | ||
:cq-deprecated: false | ||
:cq-jvm-since: 3.10.0 | ||
:cq-native-since: n/a | ||
|
||
ifeval::[{doc-show-badges} == true] | ||
[.badges] | ||
[.badge-key]##JVM since##[.badge-supported]##3.10.0## [.badge-key]##Native##[.badge-unsupported]##unsupported## | ||
endif::[] | ||
|
||
LangChain4j Embeddings | ||
|
||
[id="extensions-langchain-embeddings-whats-inside"] | ||
== What's inside | ||
|
||
* xref:{cq-camel-components}::langchain-embeddings-component.adoc[LangChain4j Embeddings component], URI syntax: `langchain-embeddings:embeddingId` | ||
|
||
Please refer to the above link for usage and configuration details. | ||
|
||
[id="extensions-langchain-embeddings-maven-coordinates"] | ||
== Maven coordinates | ||
|
||
[source,xml] | ||
---- | ||
<dependency> | ||
<groupId>org.apache.camel.quarkus</groupId> | ||
<artifactId>camel-quarkus-langchain-embeddings</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::[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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-langchain-embeddings-parent</artifactId> | ||
<version>3.10.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>camel-quarkus-langchain-embeddings-deployment</artifactId> | ||
<name>Camel Quarkus :: LangChain4j Embeddings :: 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-langchain-embeddings</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> |
46 changes: 46 additions & 0 deletions
46
...camel/quarkus/component/langchain/embeddings/deployment/LangchainEmbeddingsProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.langchain.embeddings.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 LangchainEmbeddingsProcessor { | ||
|
||
private static final Logger LOG = Logger.getLogger(LangchainEmbeddingsProcessor.class); | ||
private static final String FEATURE = "camel-langchain-embeddings"; | ||
|
||
@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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.10.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>camel-quarkus-langchain-embeddings-parent</artifactId> | ||
<name>Camel Quarkus :: LangChain4j Embeddings</name> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>deployment</module> | ||
<module>runtime</module> | ||
</modules> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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-langchain-embeddings-parent</artifactId> | ||
<version>3.10.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>camel-quarkus-langchain-embeddings</artifactId> | ||
<name>Camel Quarkus :: LangChain4j Embeddings :: Runtime</name> | ||
<description>LangChain4j Embeddings</description> | ||
|
||
<properties> | ||
<camel.quarkus.jvmSince>3.10.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-langchain-embeddings</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> |
33 changes: 33 additions & 0 deletions
33
...sions-jvm/langchain-embeddings/runtime/src/main/resources/META-INF/quarkus-extension.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 Embeddings" | ||
description: "LangChain4j Embeddings" | ||
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/langchain-embeddings.html" | ||
categories: | ||
- "integration" | ||
status: | ||
- "preview" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.