Pinecone
Module to interact with Pinecone, a vector database service.
This module contains a class Pinecone
which provides several methods to
interact with the Pinecone vector database service.
Pinecone
Bases: VectorStore
Interact with Pinecone, a vector database service.
This class has methods to initialize the Pinecone client, describe the index, search the index for similar vectors, and insert or update vectors in the index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index_name |
str
|
The name of the index to use. |
required |
api_key |
str
|
The Pinecone API key to use for authentication. |
required |
environment |
str
|
The environment to use, e.g. "production" or "development". |
required |
Attributes:
Name | Type | Description |
---|---|---|
index_name |
str
|
The name of the index to use. |
environment |
str
|
The pinecone environment to use. |
Source code in llmflows/vectorstores/pinecone.py
describe()
search(query, top_k)
Search the index for similar vectors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
VectorDoc
|
The query vector to search for. |
required |
top_k |
int
|
The number of results to return. |
required |
Returns:
Type | Description |
---|---|
tuple[list, dict, dict]
|
list[dict]: A list of dictionaries representing the search results. |
Source code in llmflows/vectorstores/pinecone.py
upsert(docs)
Insert or update vectors in the index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
docs |
list[VectorDoc]
|
VectorDoc objects to insert or update. |
required |