Class PineconeVectorStore
java.lang.Object
org.springframework.ai.vectorstore.observation.AbstractObservationVectorStore
org.springframework.ai.vectorstore.pinecone.PineconeVectorStore
- All Implemented Interfaces:
Consumer<List<Document>>,DocumentWriter,VectorStore,VectorStoreRetriever
A VectorStore implementation backed by Pinecone, a cloud-based vector database. This
store supports creating, updating, deleting, and similarity searching of documents in a
Pinecone index.
- Author:
- Christian Tzolov, Adam Bchouti, Soby Chacko, Thomas Vitale, Ilayaperumal Gopinathan
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for creatingPineconeVectorStoreinstances. -
Field Summary
FieldsFields inherited from class org.springframework.ai.vectorstore.observation.AbstractObservationVectorStore
batchingStrategy, embeddingModel -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new PineconeVectorStore using the builder pattern. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a list of documents to the vector store based on the namespace.builder(EmbeddingModel embeddingModel) Creates a new builder for constructing a PineconeVectorStore instance.createObservationContextBuilder(String operationName) Create a newVectorStoreObservationContext.Builderinstance.voidDeletes a list of documents by their IDs based on the namespace.voidAdds a list of documents to the vector store.voidDeletes a list of documents by their IDs.protected voiddoDelete(Filter.Expression filterExpression) Template method for concrete implementations to provide filter-based deletion logic.doSimilaritySearch(SearchRequest request) Perform the actual similarity search operation.<T> Optional<T> Returns the native client if available in this vector store implementation.similaritySearch(SearchRequest request, String namespace) Methods inherited from class org.springframework.ai.vectorstore.observation.AbstractObservationVectorStore
add, delete, delete, similaritySearchMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.document.DocumentWriter
writeMethods inherited from interface org.springframework.ai.vectorstore.VectorStore
accept, delete, getNameMethods inherited from interface org.springframework.ai.vectorstore.VectorStoreRetriever
similaritySearch
-
Field Details
-
CONTENT_FIELD_NAME
- See Also:
-
filterExpressionConverter
-
-
Constructor Details
-
PineconeVectorStore
Creates a new PineconeVectorStore using the builder pattern.- Parameters:
builder- The configured builder instance
-
-
Method Details
-
builder
Creates a new builder for constructing a PineconeVectorStore instance. This builder implements a type-safe step pattern that guides users through the required configuration fields in a specific order, followed by optional configurations. Required fields must be provided in this sequence:- embeddingModel (provided to this method)
- apiKey
- indexName
PineconeVectorStore store = PineconeVectorStore.builder(embeddingModel) .apiKey("your-api-key") .indexName("your-index") .namespace("optional") // optional configuration .build();- Parameters:
embeddingModel- the embedding model to use for vector transformations- Returns:
- the first step of the builder requiring API key configuration
- Throws:
IllegalArgumentException- if embeddingModel is null
-
add
Adds a list of documents to the vector store based on the namespace.- Parameters:
documents- The list of documents to be added.namespace- The namespace to add the documents to
-
doAdd
Adds a list of documents to the vector store.- Specified by:
doAddin classAbstractObservationVectorStore- Parameters:
documents- The list of documents to be added.
-
delete
Deletes a list of documents by their IDs based on the namespace.- Parameters:
documentIds- The list of document IDs to be deleted.namespace- The namespace of the document IDs.
-
doDelete
Deletes a list of documents by their IDs.- Specified by:
doDeletein classAbstractObservationVectorStore- Parameters:
documentIds- The list of document IDs to be deleted.
-
similaritySearch
-
doDelete
Description copied from class:AbstractObservationVectorStoreTemplate method for concrete implementations to provide filter-based deletion logic.- Overrides:
doDeletein classAbstractObservationVectorStore- Parameters:
filterExpression- Filter expression to identify documents to delete
-
doSimilaritySearch
Description copied from class:AbstractObservationVectorStorePerform the actual similarity search operation.- Specified by:
doSimilaritySearchin classAbstractObservationVectorStore- Parameters:
request- the search request- Returns:
- the list of documents that match the query request conditions
-
createObservationContextBuilder
Description copied from class:AbstractObservationVectorStoreCreate a newVectorStoreObservationContext.Builderinstance.- Specified by:
createObservationContextBuilderin classAbstractObservationVectorStore- Parameters:
operationName- the operation name- Returns:
- the observation context builder
-
getNativeClient
Description copied from interface:VectorStoreReturns the native client if available in this vector store implementation. Note on usage: 1. Returns empty Optional when no native client is available 2. Due to Java type erasure, runtime type checking is not possible Example usage: When working with implementation with known native client: Optionalclient = vectorStore.getNativeClient(); Note: Using Optionalinvalid input: '<'?> will return the native client if one exists, rather than an empty Optional. For type safety, prefer using the specific client type. - Type Parameters:
T- The type of the native client- Returns:
- Optional containing native client if available, empty Optional otherwise
-