langchain.vectorstores.dashvector.DashVector¶
class langchain.vectorstores.dashvector.DashVector(collection: Any, embedding: Embeddings, text_field: str)[source]¶
DashVector vector store.
To use, you should have the dashvector python package installed.
Example
from langchain.vectorstores import dashvector
from langchain.embeddings.openai import OpenAIEmbeddings
import dashvector
client = dashvector.Client.init(api_key="***")
client.create("langchain")
collection = client.get("langchain")
embeddings = OpenAIEmbeddings()
vectorstore = Dashvector(collection, embeddings.embed_query, "text")
Initialize with DashVector collection.
Attributes
embeddings
Access the query embedding object if available.
Methods
__init__(collection, embedding, text_field)
Initialize with DashVector collection.
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_texts(texts[, metadatas, ids, batch_size])
Run more texts through the embeddings and add to the vectorstore.
afrom_documents(documents, embedding, **kwargs)
Return VectorStore initialized from documents and embeddings.
afrom_texts(texts, embedding[, metadatas])
Return VectorStore initialized from texts and embeddings.
amax_marginal_relevance_search(query[, k, ...])
Return docs selected using the maximal marginal relevance.
amax_marginal_relevance_search_by_vector(...)
Return docs selected using the maximal marginal relevance.
as_retriever(**kwargs)