Creates an Instance of AzureCosmosDBVectorSearch from a Connection String
Parameters
connection_string – The MongoDB vCore instance connection string
namespace – The namespace (database.collection)
embedding – The embedding utility
**kwargs – Dynamic keyword arguments
Returns
an instance of the vector store
classmethod from_documents(documents: List[Document], embedding: Embeddings, **kwargs: Any) → VST¶
Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, collection: Optional[Collection[CosmosDBDocumentType]] = None, **kwargs: Any) → AzureCosmosDBVectorSearch[source]¶
Return VectorStore initialized from texts and embeddings.
get_index_name() → str[source]¶
Returns the index name
Returns
Returns the index name
index_exists() → bool[source]¶
Verifies if the specified index name during instanceconstruction exists on the collection
Returns
Returns True on success and False if no such index existson the collection
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, **kwargs: Any) → List[Document][source]¶
Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity
among selected documents.
Parameters
query – Text to look up documents similar to.
k – Number of Documents to return. Defaults to 4.
fetch_k – Number of Documents to fetch to pass to MMR algorithm.
lambda_mult – Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
Returns