id stringlengths 14 16 | text stringlengths 36 2.73k | source stringlengths 59 127 |
|---|---|---|
127fa9812842-4 | **Answer**: Heat-bath random walks with Markov base (HB-MB) is a class of stochastic processes that have been studied in the field of statistical mechanics and condensed matter physics. In these processes, a particle moves in a lattice by making a transition to a neighboring site, which is chosen according to a probabi... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/arxiv.html |
a5e34d90dfb3-0 | .ipynb
.pdf
Databerry
Contents
Query
Databerry#
Databerry platform brings data from anywhere (Datsources: Text, PDF, Word, PowerPpoint, Excel, Notion, Airtable, Google Sheets, etc..) into Datastores (container of multiple Datasources).
Then your Datastores can be connected to ChatGPT via Plugins or any other Large La... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/databerry.html |
a5e34d90dfb3-1 | )
retriever.get_relevant_documents("What is Daftpage?")
[Document(page_content='✨ Made with DaftpageOpen main menuPricingTemplatesLoginSearchHelpGetting StartedFeaturesAffiliate ProgramGetting StartedDaftpage is a new type of website builder that works like a doc.It makes website building easy, fun and offers tons of p... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/databerry.html |
a5e34d90dfb3-2 | Document(page_content="✨ Made with DaftpageOpen main menuPricingTemplatesLoginSearchHelpGetting StartedFeaturesAffiliate ProgramHelp CenterWelcome to Daftpage’s help center—the one-stop shop for learning everything about building websites with Daftpage.Daftpage is the simplest way to create websites for all purposes in... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/databerry.html |
a5e34d90dfb3-3 | Document(page_content=" is the simplest way to create websites for all purposes in seconds. Without knowing how to code, and for free!Get StartedDaftpage is a new type of website builder that works like a doc.It makes website building easy, fun and offers tons of powerful features for free. Just type / in your page to ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/databerry.html |
a01b6a89dd97-0 | .ipynb
.pdf
Self-querying with Weaviate
Contents
Creating a Weaviate vectorstore
Creating our self-querying retriever
Testing it out
Filter k
Self-querying with Weaviate#
Creating a Weaviate vectorstore#
First we’ll want to create a Weaviate VectorStore and seed it with some data. We’ve created a small demo set of do... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/weaviate_self_query.html |
a01b6a89dd97-1 | Document(page_content="Toys come alive and have a blast doing so", metadata={"year": 1995, "genre": "animated"}),
Document(page_content="Three men walk into the Zone, three men walk out of the Zone", metadata={"year": 1979, "rating": 9.9, "director": "Andrei Tarkovsky", "genre": "science fiction", "rating": 9.9})
]... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/weaviate_self_query.html |
a01b6a89dd97-2 | llm = OpenAI(temperature=0)
retriever = SelfQueryRetriever.from_llm(llm, vectorstore, document_content_description, metadata_field_info, verbose=True)
Testing it out#
And now we can try actually using our retriever!
# This example only specifies a relevant query
retriever.get_relevant_documents("What are some movies ab... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/weaviate_self_query.html |
a01b6a89dd97-3 | We can do this by passing enable_limit=True to the constructor.
retriever = SelfQueryRetriever.from_llm(
llm,
vectorstore,
document_content_description,
metadata_field_info,
enable_limit=True,
verbose=True
)
# This example only specifies a relevant query
retriever.get_relevant_documents("wha... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/weaviate_self_query.html |
2fbc4de19103-0 | .ipynb
.pdf
Wikipedia
Contents
Installation
Examples
Running retriever
Question Answering on facts
Wikipedia#
Wikipedia is a multilingual free online encyclopedia written and maintained by a community of volunteers, known as Wikipedians, through open collaboration and using a wiki-based editing system called MediaWik... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/wikipedia.html |
2fbc4de19103-1 | 'summary': 'Hunter × Hunter (stylized as HUNTER×HUNTER and pronounced "hunter hunter") is a Japanese manga series written and illustrated by Yoshihiro Togashi. It has been serialized in Shueisha\'s shōnen manga magazine Weekly Shōnen Jump since March 1998, although the manga has frequently gone on extended hiatuses sin... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/wikipedia.html |
2fbc4de19103-2 | with the first series having aired on the Funimation Channel in 2009 and the second series broadcast on Adult Swim\'s Toonami programming block from April 2016 to June 2019.\nHunter × Hunter has been a huge critical and financial success and has become one of the best-selling manga series of all time, having over 84 mi... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/wikipedia.html |
2fbc4de19103-3 | docs[0].page_content[:400] # a content of the Document
'Hunter × Hunter (stylized as HUNTER×HUNTER and pronounced "hunter hunter") is a Japanese manga series written and illustrated by Yoshihiro Togashi. It has been serialized in Shueisha\'s shōnen manga magazine Weekly Shōnen Jump since March 1998, although the mang... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/wikipedia.html |
2fbc4de19103-4 | -> **Question**: What is Apify?
**Answer**: Apify is a platform that allows you to easily automate web scraping, data extraction and web automation. It provides a cloud-based infrastructure for running web crawlers and other automation tasks, as well as a web-based tool for building and managing your crawlers. Additio... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/wikipedia.html |
c811a681e451-0 | .ipynb
.pdf
LOTR (Merger Retriever)
Contents
Remove redundant results from the merged retrievers.
LOTR (Merger Retriever)#
Lord of the Retrievers, also known as MergerRetriever, takes a list of retrievers as input and merges the results of their get_relevant_documents() methods into a single list. The merged results ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/merger_retriever.html |
c811a681e451-1 | # Instantiate 2 diff cromadb indexs, each one with a diff embedding.
client_settings = chromadb.config.Settings(
chroma_db_impl="duckdb+parquet",
persist_directory=DB_DIR,
anonymized_telemetry=False,
)
db_all = Chroma(
collection_name="project_store_all",
persist_directory=DB_DIR,
client_setting... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/merger_retriever.html |
c811a681e451-2 | base_compressor=pipeline, base_retriever=lotr
)
previous
kNN
next
Metal
Contents
Remove redundant results from the merged retrievers.
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/merger_retriever.html |
aaf6444c42fb-0 | .ipynb
.pdf
Metal
Contents
Ingest Documents
Query
Metal#
Metal is a managed service for ML Embeddings.
This notebook shows how to use Metal’s retriever.
First, you will need to sign up for Metal and get an API key. You can do so here
# !pip install metal_sdk
from metal_sdk.metal import Metal
API_KEY = ""
CLIENT_ID = ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/metal.html |
aaf6444c42fb-1 | previous
LOTR (Merger Retriever)
next
Pinecone Hybrid Search
Contents
Ingest Documents
Query
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/metal.html |
8415773a60dc-0 | .ipynb
.pdf
Weaviate Hybrid Search
Weaviate Hybrid Search#
Weaviate is an open source vector database.
Hybrid search is a technique that combines multiple search algorithms to improve the accuracy and relevance of search results. It uses the best features of both keyword-based search algorithms with vector search techn... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/weaviate-hybrid.html |
8415773a60dc-1 | )
Add some data:
docs = [
Document(
metadata={
"title": "Embracing The Future: AI Unveiled",
"author": "Dr. Rebecca Simmons",
},
page_content="A comprehensive analysis of the evolution of artificial intelligence, from its inception to its future prospects. Dr. Simmons... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/weaviate-hybrid.html |
8415773a60dc-2 | "author": "Prof. Jonathan K. Sterling",
},
page_content="In his follow-up to 'Symbiosis', Prof. Sterling takes a look at the subtle, unnoticed presence and influence of AI in our everyday lives. It reveals how AI has become woven into our routines, often without our explicit realization.",
),
]
retr... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/weaviate-hybrid.html |
8415773a60dc-3 | Document(page_content='Prof. Sterling explores the potential for harmonious coexistence between humans and artificial intelligence. The book discusses how AI can be integrated into society in a beneficial and non-disruptive manner.', metadata={})]
Do a hybrid search with where filter:
retriever.get_relevant_documents(
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/retrievers/examples/weaviate-hybrid.html |
97f9205d66b2-0 | .ipynb
.pdf
Getting Started
Contents
Add texts
From Documents
Getting Started#
This notebook showcases basic functionality related to VectorStores. A key part of working with vectorstores is creating the vector to put in them, which is usually created via embeddings. Therefore, it is recommended that you familiarize ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/getting_started.html |
97f9205d66b2-1 | One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court.
And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/getting_started.html |
97f9205d66b2-2 | We cannot let this happen.
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections.
Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justi... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/getting_started.html |
ab74b8054487-0 | .ipynb
.pdf
Azure Cognitive Search
Contents
Azure Cognitive Search
Install Azure Cognitive Search SDK
Import required libraries
Configure OpenAI settings
Configure vector store settings
Create embeddings and vector store instances
Insert text and embeddings into vector store
Perform a vector similarity search
Perform... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/azuresearch.html |
ab74b8054487-1 | vector_store: AzureSearch = AzureSearch(azure_search_endpoint=vector_store_address,
azure_search_key=vector_store_password,
index_name=index_name,
embedding_function=embeddings.embed_query)
In... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/azuresearch.html |
ab74b8054487-2 | Perform a Hybrid Search#
Execute hybrid search using the hybrid_search() method:
# Perform a hybrid search
docs = vector_store.similarity_search(query="What did the president say about Ketanji Brown Jackson", k=3)
print(docs[0].page_content)
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/azuresearch.html |
029c149e4650-0 | .ipynb
.pdf
AnalyticDB
AnalyticDB#
AnalyticDB for PostgreSQL is a massively parallel processing (MPP) data warehousing service that is designed to analyze large volumes of data online.
AnalyticDB for PostgreSQL is developed based on the open source Greenplum Database project and is enhanced with in-depth extensions by ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/analyticdb.html |
029c149e4650-1 | import os
connection_string = AnalyticDB.connection_string_from_db_params(
driver=os.environ.get("PG_DRIVER", "psycopg2cffi"),
host=os.environ.get("PG_HOST", "localhost"),
port=int(os.environ.get("PG_PORT", "5432")),
database=os.environ.get("PG_DATABASE", "postgres"),
user=os.environ.get("PG_USER", ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/analyticdb.html |
ed13bace7fec-0 | .ipynb
.pdf
FAISS
Contents
Similarity Search with score
Saving and loading
Merging
Similarity Search with filtering
FAISS#
Facebook AI Similarity Search (Faiss) is a library for efficient similarity search and clustering of dense vectors. It contains algorithms that search in sets of vectors of any size, up to ones t... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/faiss.html |
ed13bace7fec-1 | docs = db.similarity_search(query)
print(docs[0].page_content)
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections.
Tonight, I’d like to honor someone who has dedicated hi... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/faiss.html |
ed13bace7fec-2 | docs_and_scores = db.similarity_search_with_score(query)
docs_and_scores[0]
(Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d li... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/faiss.html |
ed13bace7fec-3 | docs = new_db.similarity_search(query)
docs[0]
Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has de... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/faiss.html |
ed13bace7fec-4 | '807e0c63-13f6-4070-9774-5c6f0fbb9866': Document(page_content='bar', metadata={})}
Similarity Search with filtering#
FAISS vectorstore can also support filtering, since the FAISS does not natively support filtering we have to do it manually. This is done by first fetching more results than k and then filtering them. Yo... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/faiss.html |
ed13bace7fec-5 | Content: foo, Metadata: {'page': 4}, Score: 5.159960813797904e-15
Now we make the same query call but we filter for only page = 1
results_with_scores = db.similarity_search_with_score("foo", filter=dict(page=1))
for doc, score in results_with_scores:
print(f"Content: {doc.page_content}, Metadata: {doc.metadata}, Sc... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/faiss.html |
ed13bace7fec-6 | Content: bar, Metadata: {'page': 1}, Score: 0.3131446838378906
previous
ElasticSearch
next
Hologres
Contents
Similarity Search with score
Saving and loading
Merging
Similarity Search with filtering
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/faiss.html |
1f11c895f833-0 | .ipynb
.pdf
Typesense
Contents
Similarity Search
Typesense as a Retriever
Typesense#
Typesense is an open source, in-memory search engine, that you can either self-host or run on Typesense Cloud.
Typesense focuses on performance by storing the entire index in RAM (with a backup on disk) and also focuses on providing ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/typesense.html |
1f11c895f833-1 | 'typesense_api_key': 'xyz',
'typesense_collection_name': 'lang-chain'
})
Similarity Search#
query = "What did the president say about Ketanji Brown Jackson"
found_docs = docsearch.similarity_search(query)
print(found_docs[0].page_content)
Typ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/typesense.html |
6b342b4ccb1d-0 | .ipynb
.pdf
Milvus
Milvus#
Milvus is a database that stores, indexes, and manages massive embedding vectors generated by deep neural networks and other machine learning (ML) models.
This notebook shows how to use functionality related to the Milvus vector database.
To run, you should have a Milvus instance up and runni... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/milvus.html |
6b342b4ccb1d-1 | docs = vector_db.similarity_search(query)
docs[0].page_content
'Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedicate... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/milvus.html |
53ba2ce0b803-0 | .ipynb
.pdf
Tigris
Contents
Initialize Tigris vector store
Similarity Search
Similarity Search with score (vector distance)
Tigris#
Tigris is an open source Serverless NoSQL Database and Search Platform designed to simplify building high-performance vector search applications.
Tigris eliminates the infrastructure com... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/tigris.html |
53ba2ce0b803-1 | Initialize Tigris vector store#
Let’s import our test dataset:
loader = TextLoader('../../../state_of_the_union.txt')
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)
embeddings = OpenAIEmbeddings()
vector_store = Tigris.fr... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/tigris.html |
839bea08bb79-0 | .ipynb
.pdf
Deep Lake
Contents
Retrieval Question/Answering
Attribute based filtering in metadata
Choosing distance function
Maximal Marginal relevance
Delete dataset
Deep Lake datasets on cloud (Activeloop, AWS, GCS, etc.) or in memory
Creating dataset on AWS S3
Deep Lake API
Transfer local dataset to cloud
Deep Lak... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-1 | docs = text_splitter.split_documents(documents)
embeddings = OpenAIEmbeddings()
Create a dataset locally at ./deeplake/, then run similiarity search. The Deeplake+LangChain integration uses Deep Lake datasets under the hood, so dataset and vector store are used interchangeably. To create a dataset in your own cloud, or... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-2 | text text (42, 1) str None
print(docs[0].page_content)
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections.
Tonight, I’d like to honor someone who has... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-3 | text text (42, 1) str None
Deep Lake, for now, is single writer and multiple reader. Setting read_only=True helps to avoid acquring the writer lock.
Retrieval Question/Answering#
from langchain.chains import RetrievalQA
from langchain.llms import OpenAIChat
qa = RetrievalQA.from_chain_type(llm=Open... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-4 | tensor htype shape dtype compression
------- ------- ------- ------- -------
embedding generic (4, 1536) float32 None
ids text (4, 1) str None
metadata json (4, 1) str None
text text (4, 1) str None
db.similarity_search... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-5 | Document(page_content='And for our LGBTQ+ Americans, let’s finally get the bipartisan Equality Act to my desk. The onslaught of state laws targeting transgender Americans and their families is wrong. \n\nAs I said last year, especially to our younger transgender Americans, I will always have your back as your President... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-6 | [Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justic... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-7 | Document(page_content='A former top litigator in private practice. A former federal public defender. And from a family of public school educators and police officers. A consensus builder. Since she’s been nominated, she’s received a broad range of support—from the Fraternal Order of Police to former judges appointed by... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-8 | Document(page_content='And for our LGBTQ+ Americans, let’s finally get the bipartisan Equality Act to my desk. The onslaught of state laws targeting transgender Americans and their families is wrong. \n\nAs I said last year, especially to our younger transgender Americans, I will always have your back as your President... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-9 | Document(page_content='Tonight, I’m announcing a crackdown on these companies overcharging American businesses and consumers. \n\nAnd as Wall Street firms take over more nursing homes, quality in those homes has gone down and costs have gone up. \n\nThat ends on my watch. \n\nMedicare is going to set higher standards ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-10 | [Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justic... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-11 | Document(page_content='Tonight, I’m announcing a crackdown on these companies overcharging American businesses and consumers. \n\nAnd as Wall Street firms take over more nursing homes, quality in those homes has gone down and costs have gone up. \n\nThat ends on my watch. \n\nMedicare is going to set higher standards ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-12 | Document(page_content='A former top litigator in private practice. A former federal public defender. And from a family of public school educators and police officers. A consensus builder. Since she’s been nominated, she’s received a broad range of support—from the Fraternal Order of Police to former judges appointed by... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-13 | Document(page_content='And for our LGBTQ+ Americans, let’s finally get the bipartisan Equality Act to my desk. The onslaught of state laws targeting transgender Americans and their families is wrong. \n\nAs I said last year, especially to our younger transgender Americans, I will always have your back as your President... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-14 | username = "<username>" # your username on app.activeloop.ai
dataset_path = f"hub://{username}/langchain_test" # could be also ./local/path (much faster locally), s3://bucket/path/to/dataset, gcs://path/to/dataset, etc.
embedding = OpenAIEmbeddings()
db = DeepLake(dataset_path=dataset_path, embedding_function=embedd... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-15 | 'd6d6ccb7-e187-11ed-b66d-41c5f7b85421']
query = "What did the president say about Ketanji Brown Jackson"
docs = db.similarity_search(query)
print(docs[0].page_content)
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-16 | })
s3://hub-2.0-datasets-n/langchain_test loaded successfully.
Evaluating ingest: 100%|██████████| 1/1 [00:10<00:00
\
Dataset(path='s3://hub-2.0-datasets-n/langchain_test', tensors=['embedding', 'ids', 'metadata', 'text'])
tensor htype shape dtype compression
------- ------- ------- ------- ----... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-17 | username = "davitbun" # your username on app.activeloop.ai
source = f"hub://{username}/langchain_test" # could be local, s3, gcs, etc.
destination = f"hub://{username}/langchain_test_copy" # could be local, s3, gcs, etc.
deeplake.deepcopy(src=source, dest=destination, overwrite=True)
Copying dataset: 100%|██████████... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
839bea08bb79-18 | metadata json (4, 1) str None
text text (4, 1) str None
Evaluating ingest: 100%|██████████| 1/1 [00:31<00:00
-
Dataset(path='hub://davitbun/langchain_test_copy', tensors=['embedding', 'ids', 'metadata', 'text'])
tensor htype shape dtype compression
------- -... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/deeplake.html |
c601f9564972-0 | .ipynb
.pdf
ElasticSearch
Contents
ElasticSearch
ElasticVectorSearch class
Installation
Example
ElasticKnnSearch Class
Test adding vectors
Test knn search using query vector builder
Test knn search using pre generated vector
Test source option
Test fields option
Test with es client connection rather than cloud_id
Ela... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/elasticsearch.html |
c601f9564972-1 | To obtain your Elastic Cloud password for the default “elastic” user:
Log in to the Elastic Cloud console at https://cloud.elastic.co
Go to “Security” > “Users”
Locate the “elastic” user and click “Edit”
Click “Reset password”
Follow the prompts to reset the password
Format for Elastic Cloud URLs is
https://username:pa... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/elasticsearch.html |
c601f9564972-2 | docs = db.similarity_search(query)
print(docs[0].page_content)
In state after state, new laws have been passed, not only to suppress the vote, but to subvert entire elections.
We cannot let this happen.
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while yo... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/elasticsearch.html |
c601f9564972-3 | model_id,
#input_field=input_field,
es_cloud_id=es_cloud_id,
es_user=es_user,
es_password=es_password,
)
# Initialize ElasticKnnSearch
knn_search = ElasticKnnSearch(
es_cloud_id=es_cloud_id,
es_user=es_user,
es_password=es_password,
index_name= test_index,
embedding= embeddings
)
Test adding ve... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/elasticsearch.html |
c601f9564972-4 | Test knn search using pre generated vector#
# Generate embedding for tests
query_text = 'Hello'
query_embedding = embeddings.embed_query(query_text)
print(f"Length of embedding: {len(query_embedding)}\nFirst two items in embedding: {query_embedding[:2]}")
# Test knn Search
knn_result = knn_search.knn_search(query_vecto... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/elasticsearch.html |
c601f9564972-5 | assert 'text' in knn_result['hits']['hits'][0]['fields'].keys()
# Test `hybrid_search` method
query = "Hello"
hybrid_result = knn_search.knn_hybrid_search(query = query, model_id= model_id, k=2, fields=['text'])
assert 'text' in hybrid_result['hits']['hits'][0]['fields'].keys()
Test with es client connection rather tha... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/elasticsearch.html |
c601f9564972-6 | By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/elasticsearch.html |
b1adb8fbfb9c-0 | .ipynb
.pdf
LanceDB
LanceDB#
LanceDB is an open-source database for vector-search built with persistent storage, which greatly simplifies retrevial, filtering and management of embeddings. Fully open source.
This notebook shows how to use functionality related to the LanceDB vector database based on the Lance data form... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/lancedb.html |
b1adb8fbfb9c-1 | I spoke with their families and told them that we are forever in debt for their sacrifice, and we will carry on their mission to restore the trust and safety every community deserves.
I’ve worked on these issues a long time.
I know what works: Investing in crime preventionand community police officers who’ll walk the... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/lancedb.html |
b1adb8fbfb9c-2 | These laws don’t infringe on the Second Amendment. They save lives.
The most fundamental right in America is the right to vote – and to have it counted. And it’s under assault.
In state after state, new laws have been passed, not only to suppress the vote, but to subvert entire elections.
We cannot let this happen. ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/lancedb.html |
b1adb8fbfb9c-3 | We’ve set up joint patrols with Mexico and Guatemala to catch more human traffickers.
We’re putting in place dedicated immigration judges so families fleeing persecution and violence can have their cases heard faster.
previous
Hologres
next
MatchingEngine
By Harrison Chase
© Copyright 2023, Harrison Chase.... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/lancedb.html |
d71ba4b3e4fd-0 | .ipynb
.pdf
ClickHouse Vector Search
Contents
Setting up envrionments
Get connection info and data schema
Clickhouse table schema
Filtering
Deleting your data
ClickHouse Vector Search#
ClickHouse is the fastest and most resource efficient open-source database for real-time apps and analytics with full SQL support and... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/clickhouse.html |
d71ba4b3e4fd-1 | docs = text_splitter.split_documents(documents)
embeddings = OpenAIEmbeddings()
for d in docs:
d.metadata = {'some': 'metadata'}
settings = ClickhouseSettings(table="clickhouse_vector_search_example")
docsearch = Clickhouse.from_documents(docs, embeddings, config=settings)
query = "What did the president say about ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/clickhouse.html |
d71ba4b3e4fd-2 | |uuid |UUID |
---------------------------------------------------
Clickhouse table schema#
Clickhouse table will be automatically created if not exist by default. Advanced users could pre-create the table with optimized settings. For distributed Clickhouse cluster with sharding, ta... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/clickhouse.html |
d71ba4b3e4fd-3 | meta = docsearch.metadata_column
output = docsearch.similarity_search_with_relevance_scores('What did the president say about Ketanji Brown Jackson?',
k=4, where_str=f"{meta}.doc_id<10")
for d, dist in output:
print(dist, d.metadata, d.page_content[:20] + ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/clickhouse.html |
19c5dc65898d-0 | .ipynb
.pdf
Atlas
Atlas#
Atlas is a platform for interacting with both small and internet scale unstructured datasets by Nomic.
This notebook shows you how to use functionality related to the AtlasDB vectorstore.
!pip install spacy
!python3 -m spacy download en_core_web_sm
!pip install nomic
import time
from langchain.... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/atlas.html |
19c5dc65898d-1 | Hide embedded project
Explore on atlas.nomic.ai
previous
Annoy
next
AwaDB
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/atlas.html |
ff48fb474252-0 | .ipynb
.pdf
DocArrayHnswSearch
Contents
Setup
Using DocArrayHnswSearch
Similarity search
Similarity search with score
DocArrayHnswSearch#
DocArrayHnswSearch is a lightweight Document Index implementation provided by Docarray that runs fully locally and is best suited for small- to medium-sized datasets. It stores vec... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/docarray_hnsw.html |
ff48fb474252-1 | docs = db.similarity_search(query)
print(docs[0].page_content)
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections.
Tonight, I’d like to honor someone who has dedicated hi... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/docarray_hnsw.html |
ff48fb474252-2 | docs = db.similarity_search_with_score(query)
docs[0]
(Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone wh... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/docarray_hnsw.html |
aad6f8212517-0 | .ipynb
.pdf
Tair
Tair#
Tair is a cloud native in-memory database service developed by Alibaba Cloud.
It provides rich data models and enterprise-grade capabilities to support your real-time online scenarios while maintaining full compatibility with open source Redis. Tair also introduces persistent memory-optimized ins... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/tair.html |
aad6f8212517-1 | docs = vector_store.similarity_search(query)
docs[0]
Document(page_content='We’re going after the criminals who stole billions in relief money meant for small businesses and millions of Americans. \n\nAnd tonight, I’m announcing that the Justice Department will name a chief prosecutor for pandemic fraud. \n\nBy the en... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/tair.html |
297a70d3516a-0 | .ipynb
.pdf
PGVector
Contents
Similarity search with score
Similarity Search with Euclidean Distance (Default)
Working with vectorstore in PG
Uploading a vectorstore in PG
Retrieving a vectorstore in PG
PGVector#
PGVector is an open-source vector similarity search for Postgres
It supports:
exact and approximate neare... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-1 | Requirement already satisfied: charset-normalizer<4,>=2 in /Users/joyeed/langchain/langchain/.venv/lib/python3.9/site-packages (from requests>=2.20->openai) (3.1.0)
Requirement already satisfied: idna<4,>=2.5 in /Users/joyeed/langchain/langchain/.venv/lib/python3.9/site-packages (from requests>=2.20->openai) (3.4)
Requ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-2 | Requirement already satisfied: yarl<2.0,>=1.0 in /Users/joyeed/langchain/langchain/.venv/lib/python3.9/site-packages (from aiohttp->openai) (1.9.2)
Requirement already satisfied: frozenlist>=1.1.1 in /Users/joyeed/langchain/langchain/.venv/lib/python3.9/site-packages (from aiohttp->openai) (1.3.3)
Requirement already s... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-3 | Requirement already satisfied: idna<4,>=2.5 in /Users/joyeed/langchain/langchain/.venv/lib/python3.9/site-packages (from requests>=2.26.0->tiktoken) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/joyeed/langchain/langchain/.venv/lib/python3.9/site-packages (from requests>=2.26.0->tiktoken) (1.26.1... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-4 | ## We will load it from the environment variables.
import os
CONNECTION_STRING = PGVector.connection_string_from_db_params(
driver=os.environ.get("PGVECTOR_DRIVER", "psycopg2"),
host=os.environ.get("PGVECTOR_HOST", "localhost"),
port=int(os.environ.get("PGVECTOR_PORT", "5432")),
database=os.environ.get(... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-5 | documents=docs,
collection_name="state_of_the_union",
connection_string=CONNECTION_STRING,
)
query = "What did the president say about Ketanji Brown Jackson"
docs_with_score: List[Tuple[Document, float]] = db.similarity_search_with_score(query)
for doc, score in docs_with_score:
print("-" * 80)
print("S... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-6 | Tonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service.
One of the most serious constitutional responsibilities a President h... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-7 | And if we are to advance liberty and justice, we need to secure the Border and fix the immigration system.
We can do both. At our border, we’ve installed new technology like cutting-edge scanners to better detect drug smuggling.
We’ve set up joint patrols with Mexico and Guatemala to catch more human traffickers.
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-8 | db1 = PGVector.from_existing_index(
embedding=embeddings,
collection_name="state_of_the_union",
distance_strategy=DEFAULT_DISTANCE_STRATEGY,
pre_delete_collection = False,
connection_string=CONNECTION_STRING,
)
query = "What did the president say about Ketanji Brown Jackson"
docs_with_score: List[Tu... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-9 | [(Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justi... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-10 | Breyer’s legacy of excellence.', metadata={'source': '../../../state_of_the_union.txt'}), 0.6075870262188066), (Document(page_content='A former top litigator in private practice. A former federal public defender. And from a family of public school educators and police officers. A consensus builder. Since she’s been nom... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-11 | \n\nWe’re putting in place dedicated immigration judges so families fleeing persecution and violence can have their cases heard faster. \n\nWe’re securing commitments and supporting partners in South and Central America to host more refugees and secure their own borders.', metadata={'source': '../../../state_of_the_uni... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-12 | for doc, score in docs_with_score:
print("-" * 80)
print("Score: ", score)
print(doc.page_content)
print("-" * 80)
--------------------------------------------------------------------------------
Score: 0.6075870262188066
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lew... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-13 | And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.
--------------------------------------------------------------------------------
-----------------------------------------------... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
297a70d3516a-14 | We’ve set up joint patrols with Mexico and Guatemala to catch more human traffickers.
We’re putting in place dedicated immigration judges so families fleeing persecution and violence can have their cases heard faster.
We’re securing commitments and supporting partners in South and Central America to host more refuge... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pgvector.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.