Package org.springframework.ai.chroma
Class ChromaApi
java.lang.Object
org.springframework.ai.chroma.ChromaApi
Single-class Chroma API implementation based on the (unofficial) Chroma REST API.
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordAdd embeddings to the chroma data store.static final recordChroma embedding collection.static final recordRequest to create a new collection with the given name and metadata.static final recordRequest to delete embedding from a collection.static final recordSingle query embedding response.static final recordObject containing the get embedding results.static final recordGet embeddings from a collection.static final recordRequest to get the nResults nearest neighbor embeddings for provided queryEmbeddings.static final recordA QueryResponse object containing the query results. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncountEmbeddings(String collectionId) createCollection(ChromaApi.CreateCollectionRequest createCollectionRequest) voiddeleteCollection(String collectionName) Delete a collection with the given name.deleteEmbeddings(String collectionId, ChromaApi.DeleteEmbeddingsRequest deleteRequest) getCollection(String collectionName) getEmbeddings(String collectionId, ChromaApi.GetEmbeddingsRequest getEmbeddingsRequest) queryCollection(String collectionId, ChromaApi.QueryRequest queryRequest) toEmbeddingResponseList(ChromaApi.QueryResponse queryResponse) voidupsertEmbeddings(String collectionId, ChromaApi.AddEmbeddingsRequest embedding) withBasicAuthCredentials(String username, String password) Configure access to ChromaDB secured with Basic Authentication: https://docs.trychroma.com/usage-guide#basic-authenticationwithKeyToken(String keyToken) Configure access to ChromaDB secured with static API Token Authentication: https://docs.trychroma.com/usage-guide#static-api-token-authentication
-
Constructor Details
-
ChromaApi
-
ChromaApi
public ChromaApi(String baseUrl, org.springframework.web.client.RestTemplate restTemplate, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
withKeyToken
Configure access to ChromaDB secured with static API Token Authentication: https://docs.trychroma.com/usage-guide#static-api-token-authentication- Parameters:
keyToken- Chroma static API Token Authentication. (Optional)
-
withBasicAuthCredentials
Configure access to ChromaDB secured with Basic Authentication: https://docs.trychroma.com/usage-guide#basic-authentication- Parameters:
username- Credentials username.password- Credentials password.
-
toEmbeddingResponseList
-
createCollection
public ChromaApi.Collection createCollection(ChromaApi.CreateCollectionRequest createCollectionRequest) -
deleteCollection
Delete a collection with the given name.- Parameters:
collectionName- the name of the collection to delete.
-
getCollection
-
listCollections
-
upsertEmbeddings
-
deleteEmbeddings
public List<String> deleteEmbeddings(String collectionId, ChromaApi.DeleteEmbeddingsRequest deleteRequest) -
countEmbeddings
-
queryCollection
public ChromaApi.QueryResponse queryCollection(String collectionId, ChromaApi.QueryRequest queryRequest) -
getEmbeddings
public ChromaApi.GetEmbeddingResponse getEmbeddings(String collectionId, ChromaApi.GetEmbeddingsRequest getEmbeddingsRequest) -
where
-