Pinecone
PineconeDocumentRetriever
Document Retriever using Pinecone.
Source code in dynamiq/components/retrievers/pinecone.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
__init__(*, vector_store, filters=None, top_k=10)
Initializes a component for retrieving documents from a Pinecone vector store with optional filtering.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vector_store |
PineconeVectorStore
|
An instance of PineconeVectorStore to interface with Pinecone vectors. |
required |
filters |
Optional[dict[str, Any]]
|
Filters to apply for retrieving specific documents. Defaults to None. |
None
|
top_k |
int
|
The maximum number of documents to return. Defaults to 10. |
10
|
Raises:
Type | Description |
---|---|
ValueError
|
If the |
This initializer checks if the vector_store
provided is an instance of the expected PineconeVectorStore
class, sets up filtering conditions if any, and defines how many top results to retrieve in document queries.
Source code in dynamiq/components/retrievers/pinecone.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
run(query_embedding, exclude_document_embeddings=True, top_k=None, filters=None, content_key=None)
Retrieves documents from the PineconeDocumentStore that are similar to the provided query embedding.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query_embedding |
List[float]
|
The embedding vector of the query for which similar documents are to be |
required |
exclude_document_embeddings |
bool
|
Specifies whether to exclude the embeddings of the retrieved |
True
|
top_k |
int
|
The maximum number of documents to return. Defaults to None. |
None
|
filters |
Optional[dict[str, Any]]
|
Filters to apply for retrieving specific documents. Defaults to None. |
None
|
content_key |
Optional[str]
|
The field used to store content in the storage. |
None
|
Returns:
Type | Description |
---|---|
dict[str, list[Document]]
|
List[Document]: A list of Document instances sorted by their relevance to the query_embedding. |
Source code in dynamiq/components/retrievers/pinecone.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|