Croway opened a new pull request, #30448:
URL: https://github.com/apache/camel/pull/30448

   [CAMEL-27242](https://issues.apache.org/jira/browse/CAMEL-27242)
   
   ## Description
   
   After spring-ai-embeddings, the body is the `float[]` vector of a text. ADD 
stored the text and the vector store embedded it again with its own embedding 
model (the vector only went in the document metadata), and SIMILARITY_SEARCH 
embedded the text of the `CamelSpringAiEmbeddingInputText` header again: Spring 
AI 2.0 had no API to write or search with a vector. Elsewhere in Camel the 
vector of the embeddings component is the one that is stored and searched 
(langchain4j-embeddingstore, pgvector, qdrant, milvus, pinecone, ...). Spring 
AI 2.1.0 adds `VectorStore.upsert(List<EmbeddedDocument>)` and 
`similaritySearch(float[], SearchRequest)`.
   
   - New `UPSERT` operation: a `float[]` body with 
`CamelSpringAiEmbeddingInputText`, a `List<float[]>` with 
`CamelSpringAiEmbeddingInputTexts`, an `EmbeddedDocument` or a 
`List<EmbeddedDocument>`, written with `upsert` as it is; the embedding model 
of the store is not called. The ids come from the new 
`CamelSpringAiVectorStoreUpsertDocumentId` / 
`CamelSpringAiVectorStoreUpsertDocumentIds` headers, else random UUIDs. They 
are not taken from `CamelSpringAiVectorStoreDocumentIds`, which ADD, UPSERT and 
SIMILARITY_SEARCH set to their output ids, so a search followed by an UPSERT 
does not overwrite the documents it found.
   - New `searchByVector` option (default `false`): SIMILARITY_SEARCH of a 
`float[]` body searches with the vector, and the input text header is not 
needed.
   - A store without upsert or vector search (for example `SimpleVectorStore`) 
fails with an `UnsupportedOperationException` that points to ADD or to a text 
search. Chroma, Couchbase, Elasticsearch, MariaDB, MongoDB Atlas, Neo4j, 
OpenSearch, PgVector, Qdrant, Redis and Typesense support both.
   - ADD and the default SIMILARITY_SEARCH are unchanged, so no upgrade guide 
entry. Making the vector the default would silently mix two embedding spaces 
when spring-ai-embeddings uses another model than the store.
   - Documentation: UPSERT, `searchByVector`, and an "ADD or UPSERT" section 
with the same-model warning and Java, XML and YAML examples.
   
   ## Tests
   
   - `SpringAiVectorStoreUpsertTest` (20): an in-memory store whose embedding 
model fails when called, and `SimpleVectorStore` for the unsupported case. The 
module has 39 unit tests, all passing.
   - `QdrantVectorStoreUpsertIT` (3): UPSERT, replacing a document by id, and 
vector search against a Qdrant container, with an embedding model that fails 
when called. It passes locally. The pom skips ITs on s390x, as camel-qdrant 
does, because Qdrant has no s390x image.
   
   _Claude Code on behalf of Croway_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to