This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 90879cc413b Camel-Milvus: Relation with Langchain4j-embeddings in docs
(#15052)
90879cc413b is described below
commit 90879cc413b7a1c0f039e8bbc70c0a261b456b55
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Aug 8 10:34:12 2024 +0200
Camel-Milvus: Relation with Langchain4j-embeddings in docs (#15052)
Signed-off-by: Andrea Cosentino <[email protected]>
---
.../src/main/docs/milvus-component.adoc | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git
a/components/camel-ai/camel-milvus/src/main/docs/milvus-component.adoc
b/components/camel-ai/camel-milvus/src/main/docs/milvus-component.adoc
index 27ee8b8b509..9eb48290483 100644
--- a/components/camel-ai/camel-milvus/src/main/docs/milvus-component.adoc
+++ b/components/camel-ai/camel-milvus/src/main/docs/milvus-component.adoc
@@ -180,5 +180,46 @@ from("direct:in")
----
====
+=== Relation with Langchain4j-Embeddings component
+
+The Milvus component provides a datatype transformer, from
langchain4j-embeddings to an insert/upsert object compatible with Milvus.
+
+As an example you could think about these routes:
+
+[tabs]
+====
+Java::
+[source,java]
+----
+ protected RoutesBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:in")
+ .to("langchain4j-embeddings:test")
+
.setHeader(Milvus.Headers.ACTION).constant(MilvusAction.INSERT)
+ .setHeader(Milvus.Headers.KEY_NAME).constant("userID")
+
.setHeader(Milvus.Headers.KEY_VALUE).constant(Long.valueOf("3"))
+ .transform(new
org.apache.camel.spi.DataType("milvus:embeddings"))
+ .to(MILVUS_URI);
+
+ from("direct:up")
+ .to("langchain4j-embeddings:test")
+
.setHeader(Milvus.Headers.ACTION).constant(MilvusAction.UPSERT)
+ .setHeader(Milvus.Headers.KEY_NAME).constant("userID")
+
.setHeader(Milvus.Headers.KEY_VALUE).constant(Long.valueOf("3"))
+ .transform(new
org.apache.camel.spi.DataType("milvus:embeddings"))
+ .to(MILVUS_URI);
+ }
+ };
+ }
+----
+====
+
+It's important to note that: Milvus SDK doesn't support upsert for autoID
fields. This means if you set a field as key, and you set the autoID to true,
the upsert won't be possible.
+
+That's the reason why, in the example we are setting the userID as keyName
with a keyValue of 3. This is particularly important when you design your
Milvus database.
+
+The transformer only support insert/upsert objects, so the only operation you
can set via header are INSERT and UPSERT, otherwise the transformer will fail
with an error log.
+
include::spring-boot:partial$starter.adoc[]