API Reference
MatrixOneVectorStore
- class langchain_matrixone.vectorstores.MatrixOneVectorStore(embedding: Embeddings, connection_args: Dict[str, Any] | None = None, *, client: Client | None = None, table_name: str = 'langchain_vectors', content_column: str = 'content', metadata_column: str = 'metadata', vector_column: str = 'embedding', drop_old: bool = False, distance: str = 'l2')[source]
Bases:
VectorStoreMatrixOne vector store integration compatible with LangChain.
- add_texts(texts: Iterable[str], metadatas: List[dict] | None = None, ids: List[str] | None = None, **kwargs: Any) List[str][source]
Run more texts through the embeddings and add to the VectorStore.
- Parameters:
texts – Iterable of strings to add to the VectorStore.
metadatas – Optional list of metadatas associated with the texts.
ids – Optional list of IDs associated with the texts.
**kwargs – VectorStore specific parameters. One of the kwargs should be ids which is a list of ids associated with the texts.
- Returns:
List of IDs from adding the texts into the VectorStore.
- Raises:
ValueError – If the number of metadatas does not match the number of texts.
ValueError – If the number of IDs does not match the number of texts.
- delete(ids: List[str] | None = None, **kwargs: Any) bool | None[source]
Delete by vector ID or other criteria.
- Parameters:
ids – List of IDs to delete. If None, delete all.
**kwargs – Other keyword arguments that subclasses might use.
- Returns:
- True if deletion is successful, False otherwise, None if not
implemented.
- classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: List[dict] | None = None, connection_args: Dict[str, Any] | None = None, client: Client | None = None, **kwargs: Any) MatrixOneVectorStore[source]
Return VectorStore initialized from texts and embeddings.
- Parameters:
texts – Texts to add to the VectorStore.
embedding – Embedding function to use.
metadatas – Optional list of metadatas associated with the texts.
ids – Optional list of IDs associated with the texts.
**kwargs – Additional keyword arguments.
- Returns:
VectorStore initialized from texts and embeddings.
- similarity_search(query: str, k: int = 4, **kwargs: Any) List[Document][source]
Return docs most similar to query.
- Parameters:
query – Input text.
k – Number of Document objects to return.
**kwargs – Arguments to pass to the search method.
- Returns:
List of Document objects most similar to the query.
- similarity_search_by_vector(embedding: List[float], k: int = 4, **kwargs: Any) List[Document][source]
Return docs most similar to embedding vector.
- Parameters:
embedding – Embedding to look up documents similar to.
k – Number of Document objects to return.
**kwargs – Arguments to pass to the search method.
- Returns:
List of Document objects most similar to the query vector.