1.7 KiB
1.7 KiB
The RAG ClusterService EJB
With the EJB ClusterService clients can index and retrieve embeddings.
Index
A text chunk can be index by:
clusterService.insertVector(workitem.getUniqueID(),
workitem.getModelVersion(),
workitem.getTaskID(),
chunk,
indexResult);
Retrieval
The retrieval can be based on text embedding only or refined by workflow metadata like the modelVersion or the TaskId
List<RetrievalResult> retrievalResultList = clusterService.searchEmbeddings(embeddings, 5);
You can refine the retrieval by providing additional workflow context
- Task ID Range: Suche alle Tasks zwischen 1000-1999
List<RetrievalResult> rangeResults = clusterService.searchEmbeddingsWithTaskRange(
queryEmbedding,
5,
null, // all Model Versions
1000,
1999
);
- Wildcard Model Version: all products by wildcard search
List<RetrievalResult> productResults = clusterService.searchEmbeddingsWithModelWildcard(
queryEmbedding,
5,
"product-de*", // product-de-1.0.0, product-de-2.0.0, etc.
null
);
- Combination products and Task Range 1000-1999
List<RetrievalResult> combinedResults = clusterService.searchEmbeddings(
queryEmbedding,
5,
Arrays.asList("product-de*"),
null, // no specific Task IDs
1000, // Task Range Start
1999 // Task Range End
);
- Multiple Wildcards: all german models
List<RetrievalResult> germanResults = clusterService.searchEmbeddings(
queryEmbedding,
5,
Arrays.asList("product-de*", "offer-de*", "invoice-de*"),
null, null, null
);