This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch milvus-embeddings
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 83cc1fc1499bf8b6ff8e7ab454f3e49a7dbe3137
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Aug 8 10:32:27 2024 +0200

    Camel-Milvus: Relation with Langchain4j-embeddings in docs
    
    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[]

Reply via email to