Check Get Started for more information.See the installation instructions.pip install vald-client-pythonBasic Example‚Äãfrom langchain.document_loaders import TextLoaderfrom langchain.embeddings import HuggingFaceEmbeddingsfrom langchain.text_splitter import CharacterTextSplitterfrom langchain.vectorstores import Valdraw_documents = TextLoader('state_of_the_union.txt').load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)documents = text_splitter.split_documents(raw_documents)embeddings = HuggingFaceEmbeddings()db = Vald.from_documents(documents, embeddings, host="localhost", port=8080)query = "What did the president say about Ketanji Brown Jackson"docs = db.similarity_search(query)docs[0].page_contentSimilarity search by vector‚Äãembedding_vector = embeddings.embed_query(query)docs = db.similarity_search_by_vector(embedding_vector)docs[0].page_contentSimilarity search with score‚Äãdocs_and_scores = db.similarity_search_with_score(query)docs_and_scores[0]Maximal Marginal Relevance Search (MMR)‚ÄãIn addition to using similarity search in the retriever object, you can also use mmr as retriever.retriever = db.as_retriever(search_type="mmr")retriever.get_relevant_documents(query)Or use max_marginal_relevance_search directly:db.max_marginal_relevance_search(query, k=2, fetch_k=10)PreviousUSearchNextvearchBasic ExampleSimilarity search by vectorSimilarity search with scoreMaximal Marginal Relevance Search (MMR)CommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Vald is a highly scalable distributed fast approximate nearest neighbor (ANN) dense vector search engine.
Vald is a highly scalable distributed fast approximate nearest neighbor (ANN) dense vector search engine. ->: Check Get Started for more information.See the installation instructions.pip install vald-client-pythonBasic Example‚Äãfrom langchain.document_loaders import TextLoaderfrom langchain.embeddings import HuggingFaceEmbeddingsfrom langchain.text_splitter import CharacterTextSplitterfrom langchain.vectorstores import Valdraw_documents = TextLoader('state_of_the_union.txt').load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)documents = text_splitter.split_documents(raw_documents)embeddings = HuggingFaceEmbeddings()db = Vald.from_documents(documents, embeddings, host="localhost", port=8080)query = "What did the president say about Ketanji Brown Jackson"docs = db.similarity_search(query)docs[0].page_contentSimilarity search by vector‚Äãembedding_vector = embeddings.embed_query(query)docs = db.similarity_search_by_vector(embedding_vector)docs[0].page_contentSimilarity search with score‚Äãdocs_and_scores = db.similarity_search_with_score(query)docs_and_scores[0]Maximal Marginal Relevance Search (MMR)‚ÄãIn addition to using similarity search in the retriever object, you can also use mmr as retriever.retriever = db.as_retriever(search_type="mmr")retriever.get_relevant_documents(query)Or use max_marginal_relevance_search directly:db.max_marginal_relevance_search(query, k=2, fetch_k=10)PreviousUSearchNextvearchBasic ExampleSimilarity search by vectorSimilarity search with scoreMaximal Marginal Relevance Search (MMR)CommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.