Return VectorStore initialized from documents and embeddings.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, text_key: str = 'text', index_name: Optional[str] = None, dimension: int = 1024, client: Any = None, host: List[str] = ['172.20.31.10:13000'], user: str = 'root', password: str = '123123', batch_size: int = 500, **kwargs: Any) → Dingo[source]¶
Construct Dingo wrapper from raw documents.
This is a user friendly interface that:
Embeds documents.
Adds the documents to a provided Dingo index
This is intended to be a quick way to get started.
Example:from langchain_community.vectorstores import Dingo
from langchain_community.embeddings import OpenAIEmbeddings
import dingodb
sssembeddings = OpenAIEmbeddings()
dingo = Dingo.from_texts(
texts,
embeddings,
index_name=”langchain-demo”
)
max_marginal_relevance_search(query: str, k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, search_params: Optional[dict] = None, **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