pineconedb
langroid/vector_store/pineconedb.py
PineconeDB(config=PineconeDBConfig())
¶
Bases: VectorStore
Source code in langroid/vector_store/pineconedb.py
clear_all_collections(really=False, prefix='')
¶
Returns:
Type | Description |
---|---|
int
|
Number of Pinecone indexes that were deleted |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
really
|
bool
|
Optional[bool] - whether to really delete all Pinecone collections |
False
|
prefix
|
str
|
Optional[str] - string to match potential Pinecone indexes for deletion |
''
|
Source code in langroid/vector_store/pineconedb.py
list_collections(empty=False)
¶
Returns:
Type | Description |
---|---|
List[str]
|
List of Pinecone indices that have at least one vector. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
empty
|
bool
|
Optional[bool] - whether to include empty collections |
False
|
Source code in langroid/vector_store/pineconedb.py
create_collection(collection_name, replace=False)
¶
Create a collection with the given name, optionally replacing an existing
collection if replace
is True.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection_name
|
str
|
str - Configuration of the collection to create. |
required |
replace
|
bool
|
Optional[Bool] - Whether to replace an existing collection with the same name. Defaults to False. |
False
|
Source code in langroid/vector_store/pineconedb.py
get_all_documents(prefix='', namespace='')
¶
Returns:
Type | Description |
---|---|
List[Document]
|
All documents for the collection currently defined in |
List[Document]
|
the configuration object |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix
|
str
|
str - document id prefix to search for |
''
|
namespace
|
str
|
str - partition of vectors to search within the index |
''
|
Source code in langroid/vector_store/pineconedb.py
get_documents_by_ids(ids, namespace='')
¶
Returns:
Type | Description |
---|---|
List[Document]
|
Fetches document text embedded in Pinecone index metadata |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
List[str]
|
List[str] - vector data object ids to retrieve |
required |
namespace
|
str
|
str - partition of vectors to search within the index |
''
|
Source code in langroid/vector_store/pineconedb.py
transform_pinecone_vector(metadata_dict)
¶
Parses the metadata response from the Pinecone vector query and formats it into a dictionary that can be parsed by the Document class associated with the PineconeDBConfig class
Returns:
Type | Description |
---|---|
Document
|
Well formed dictionary object to be transformed into a Document |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metadata_dict
|
Dict[str, Any]
|
Dict - the metadata dictionary from the Pinecone vector query match |
required |