langchain.vectorstores.scann.ScaNN¶
class langchain.vectorstores.scann.ScaNN(embedding: Embeddings, index: Any, docstore: Docstore, index_to_docstore_id: Dict[int, str], relevance_score_fn: Optional[Callable[[float], float]] = None, normalize_L2: bool = False, distance_strategy: DistanceStrategy = DistanceStrategy.EUCLIDEAN_DISTANCE, scann_config: Optional[str] = None)[source]¶
ScaNN vector store.
To use, you should have the scann python package installed.
Example
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.vectorstores import ScaNN
db = ScaNN.from_texts(
    ['foo', 'bar', 'barz', 'qux'],
    HuggingFaceEmbeddings())
db.similarity_search('foo?', k=1)
Initialize with necessary components.
Attributes
embeddings
Access the query embedding object if available.
Methods
__init__(embedding, index, docstore, ...[, ...])
Initialize with necessary components.
aadd_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
aadd_texts(texts[, metadatas])
Run more texts through the embeddings and add to the vectorstore.
add_documents(documents, **kwargs)
Run more documents through the embeddings and add to the vectorstore.
add_embeddings(text_embeddings[, metadatas, ids])
Run more texts through the embeddings and add to the vectorstore.
add_texts(texts[, metadatas, ids])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.