id
stringlengths
14
16
source
stringlengths
49
117
text
stringlengths
16
2.73k
f896cfa7c017-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/atlas.html
.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....
f896cfa7c017-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/atlas.html
Explore on atlas.nomic.ai previous Annoy next Chroma By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 04, 2023.
41e2be778248-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
.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...
41e2be778248-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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...
41e2be778248-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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...
41e2be778248-3
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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...
41e2be778248-4
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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("PGVECTOR_DATABASE", "postgres"), user=os.environ.get("PG...
41e2be778248-5
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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("Score: ", score) print(doc.page_content) print("-" * 80) -------------------------------------...
41e2be778248-6
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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 ...
41e2be778248-7
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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...
41e2be778248-8
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
docs_with_score: List[Tuple[Document, float]] = db1.similarity_search_with_score(query) print(docs_with_score)
41e2be778248-9
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
[(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...
41e2be778248-10
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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 nominated, she’s received a broad range of support—from the Fraternal Order of Police to form...
41e2be778248-11
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
Central America to host more refugees and secure their own borders.', metadata={'source': '../../../state_of_the_union.txt'}), 0.6589478388546668)]
41e2be778248-12
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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...
41e2be778248-13
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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. -------------------------------------------------------------------------------- -----------------------------------------------...
41e2be778248-14
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html
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 refugees and secure their own borders. -------------------------------------------------------...
6b50ed5a265f-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/sklearn.html
.ipynb .pdf SKLearnVectorStore Contents Basic usage Load a sample document corpus Create the SKLearnVectorStore, index the document corpus and run a sample query Saving and loading a vector store Clean-up SKLearnVectorStore# scikit-learn is an open source collection of machine learning algorithms, including some impl...
6b50ed5a265f-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/sklearn.html
vector_store = SKLearnVectorStore.from_documents( documents=docs, embedding=embeddings, persist_path=persist_path, # persist_path and serializer are optional serializer='parquet' ) query = "What did the president say about Ketanji Brown Jackson" docs = vector_store.similarity_search(query) print(docs[0...
6b50ed5a265f-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/sklearn.html
A new instance of vector store was loaded from /var/folders/6r/wc15p6m13nl_nl_n_xfqpc5c0000gp/T/union.parquet docs = vector_store2.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 ...
17f9304342ca-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/vectara.html
.ipynb .pdf Vectara Contents Connecting to Vectara from LangChain Similarity search Similarity search with score Vectara as a Retriever Vectara# Vectara is a API platform for building LLM-powered applications. It provides a simple to use API for document indexing and query that is managed by Vectara and is optimized ...
17f9304342ca-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/vectara.html
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 ha...
17f9304342ca-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/vectara.html
retriever = vectara.as_retriever() retriever VectorStoreRetriever(vectorstore=<langchain.vectorstores.vectara.Vectara object at 0x156d3e830>, search_type='similarity', search_kwargs={}) query = "What did the president say about Ketanji Brown Jackson" retriever.get_relevant_documents(query)[0] Document(page_content='Ton...
bf9ae75253d6-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/zilliz.html
.ipynb .pdf Zilliz Zilliz# Zilliz Cloud is a fully managed service on cloud for LF AI Milvus®, This notebook shows how to use functionality related to the Zilliz Cloud managed vector database. To run, you should have a Zilliz Cloud instance up and running. Here are the installation instructions !pip install pymilvus We...
bf9ae75253d6-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/zilliz.html
} ) query = "What did the president say about Ketanji Brown Jackson" 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 o...
b60b48a8ff71-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/lancedb.html
.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...
b60b48a8ff71-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/lancedb.html
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...
b60b48a8ff71-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/lancedb.html
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. Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass...
b60b48a8ff71-3
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/lancedb.html
By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 04, 2023.
fbe75be6b153-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html
.ipynb .pdf Annoy Contents Create VectorStore from texts Create VectorStore from docs Create VectorStore via existing embeddings Search via embeddings Search via docstore id Save and load Construct from scratch Annoy# Annoy (Approximate Nearest Neighbors Oh Yeah) is a C++ library with Python bindings to search for po...
fbe75be6b153-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html
vector_store.similarity_search_with_score("food", k=3) [(Document(page_content='pizza is great', metadata={}), 1.0944390296936035), (Document(page_content='I love salad', metadata={}), 1.1273186206817627), (Document(page_content='my car', metadata={}), 1.1580758094787598)] Create VectorStore from docs# from langchain...
fbe75be6b153-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html
Document(page_content='Groups of citizens blocking tanks with their bodies. Everyone from students to retirees teachers turned soldiers defending their homeland. \n\nIn this struggle as President Zelenskyy said in his speech to the European Parliament “Light will win over darkness.” The Ukrainian Ambassador to the Unit...
fbe75be6b153-3
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html
Document(page_content='Putin’s latest attack on Ukraine was premeditated and unprovoked. \n\nHe rejected repeated efforts at diplomacy. \n\nHe thought the West and NATO wouldn’t respond. And he thought he could divide us at home. Putin was wrong. We were ready. Here is what we did. \n\nWe prepared extensively and ca...
fbe75be6b153-4
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html
Document(page_content='We are inflicting pain on Russia and supporting the people of Ukraine. Putin is now isolated from the world more than ever. \n\nTogether with our allies –we are right now enforcing powerful economic sanctions. \n\nWe are cutting off Russia’s largest banks from the international financial system. ...
fbe75be6b153-5
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html
Document(page_content='And tonight I am announcing that we will join our allies in closing off American air space to all Russian flights – further isolating Russia – and adding an additional squeeze –on their economy. The Ruble has lost 30% of its value. \n\nThe Russian stock market has lost 40% of its value and tradin...
fbe75be6b153-6
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html
(Document(page_content='I love salad', metadata={}), 1.1273186206817627), (Document(page_content='my car', metadata={}), 1.1580758094787598)] Search via embeddings# motorbike_emb = embeddings_func.embed_query("motorbike") vector_store.similarity_search_by_vector(motorbike_emb, k=3) [Document(page_content='my car', met...
fbe75be6b153-7
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html
vector_store.similarity_search_with_score_by_index(some_docstore_id, k=3) [(Document(page_content='pizza is great', metadata={}), 0.0), (Document(page_content='I love salad', metadata={}), 1.0734446048736572), (Document(page_content='my car', metadata={}), 1.2895267009735107)] Save and load# vector_store.save_local("...
fbe75be6b153-8
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html
metadata = metadatas[i] if metadatas else {} documents.append(Document(page_content=text, metadata=metadata)) index_to_docstore_id = {i: str(uuid.uuid4()) for i in range(len(documents))} docstore = InMemoryDocstore( {index_to_docstore_id[i]: doc for i, doc in enumerate(documents)} ) db_manually = Annoy( emb...
b5250b937e5a-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/redis.html
.ipynb .pdf Redis Contents Installing Example Redis as Retriever Redis# Redis (Remote Dictionary Server) is an in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker, with optional durability. This notebook shows how to use functionality related to the Redis vect...
b5250b937e5a-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/redis.html
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...
b5250b937e5a-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/redis.html
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. Redis as Retriever# Here we go over different options for using the vector store as a retriever. There are three different searc...
f4cbb5e8ccfe-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html
.ipynb .pdf Supabase (Postgres) Contents Similarity search with score Retriever options Maximal Marginal Relevance Searches Supabase (Postgres)# Supabase is an open source Firebase alternative. Supabase is built on top of PostgreSQL, which offers strong SQL querying capabilities and enables a simple interface with al...
f4cbb5e8ccfe-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html
1 -(documents.embedding <=> query_embedding) AS similarity FROM documents ORDER BY documents.embedding <=> query_embedding LIMIT match_count; END; $$; # with pip !pip install supabase # with conda # !conda install -c conda-forge supabase We wa...
f4cbb5e8ccfe-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html
# We're using the default `documents` table here. You can modify this by passing in a `table_name` argument to the `from_documents` method. vector_store = SupabaseVectorStore.from_documents( docs, embeddings, client=supabase ) query = "What did the president say about Ketanji Brown Jackson" matched_docs = vector_st...
f4cbb5e8ccfe-3
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html
(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...
f4cbb5e8ccfe-4
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html
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...
f4cbb5e8ccfe-5
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html
And I’m taking robust action to make sure the pain of our sanctions is targeted at Russia’s economy. And I will use every tool at our disposal to protect American businesses and consumers. Tonight, I can announce that the United States has worked with 30 other countries to release 60 Million barrels of oil from reser...
f4cbb5e8ccfe-6
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html
I know what works: Investing in crime preventionand community police officers who’ll walk the beat, who’ll know the neighborhood, and who can restore trust and safety. previous SKLearnVectorStore next Tair Contents Similarity search with score Retriever options Maximal Marginal Relevance Searches By Harrison Chase ...
ce616b0d82e1-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html
.ipynb .pdf Qdrant Contents Connecting to Qdrant from LangChain Local mode In-memory On-disk storage On-premise server deployment Qdrant Cloud Reusing the same collection Similarity search Similarity search with score Metadata filtering Maximum marginal relevance search (MMR) Qdrant as a Retriever Customizing Qdrant ...
ce616b0d82e1-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html
Connecting to Qdrant from LangChain# Local mode# Python client allows you to run the same code in local mode without running the Qdrant server. That’s great for testing things out and debugging or if you plan to store just a small amount of vectors. The embeddings might be fully kepy in memory or persisted on disk. In-...
ce616b0d82e1-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html
If you prefer not to keep yourself busy with managing the infrastructure, you can choose to set up a fully-managed Qdrant cluster on Qdrant Cloud. There is a free forever 1GB cluster included for trying out. The main difference with using a managed version of Qdrant is that you’ll need to provide an API key to secure y...
ce616b0d82e1-3
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html
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: Justice Stephen Breyer—an Army ve...
ce616b0d82e1-4
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html
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. Score: 0.8153784913324512 Metadata filtering# Qdrant has an extensive filtering system with rich type support. It is also possib...
ce616b0d82e1-5
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html
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 ...
ce616b0d82e1-6
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html
It might be also specified to use MMR as a search strategy, instead of similarity. retriever = qdrant.as_retriever(search_type="mmr") retriever VectorStoreRetriever(vectorstore=<langchain.vectorstores.qdrant.Qdrant object at 0x7fc4e5720a00>, search_type='mmr', search_kwargs={}) query = "What did the president say about...
ce616b0d82e1-7
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html
"foo": "bar" } } You can, however, decide to use different keys for the page content and metadata. That’s useful if you already have a collection that you’d like to reuse. You can always change the Qdrant.from_documents( docs, embeddings, location=":memory:", collection_name="my_documents_2", conte...
02fb23edb911-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/mongodb_atlas_vector_search.html
.ipynb .pdf MongoDB Atlas Vector Search MongoDB Atlas Vector Search# MongoDB Atlas is a document database managed in the cloud. It also enables Lucene and its vector search feature. This notebook shows how to use the functionality related to the MongoDB Atlas Vector Search feature where you can store your embeddings in...
02fb23edb911-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/mongodb_atlas_vector_search.html
from langchain.text_splitter import CharacterTextSplitter from langchain.vectorstores import MongoDBAtlasVectorSearch from langchain.document_loaders import TextLoader from langchain.document_loaders import TextLoader loader = TextLoader('../../../state_of_the_union.txt') documents = loader.load() text_splitter = Chara...
d6e40c649875-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/milvus.html
.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...
d6e40c649875-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/milvus.html
'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: Justice Stephen Breyer—an Arm...
f88845974341-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html
.ipynb .pdf Chroma Contents Similarity search with score Persistance Initialize PeristedChromaDB Persist the Database Load the Database from disk, and create the chain Retriever options MMR Updating a Document Chroma# Chroma is a database for building AI applications with embeddings. This notebook shows how to use fu...
f88845974341-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html
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...
f88845974341-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html
Create embeddings for each chunk and insert into the Chroma vector database. The persist_directory argument tells ChromaDB where to store the database when it’s persisted. # Embed and store the texts # Supplying a persist_directory will store the embeddings on disk persist_directory = 'db' embedding = OpenAIEmbeddings(...
f88845974341-3
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html
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: Justice...
f88845974341-4
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html
At this point, we have a new Chroma instance with a single document “This is an initial document content” with id “doc1”. Now, let’s update the content of the document. # Updated document content updated_content = "This is the updated document content" # Create a new Document instance with the updated content updated_d...
9f7757a27092-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
.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...
9f7757a27092-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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 in the Deep Lake storage, adjust the path accordingly. db = DeepLake(dataset_pa...
9f7757a27092-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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: Justice Stephen Breyer—an Army ve...
9f7757a27092-3
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
Retrieval Question/Answering# from langchain.chains import RetrievalQA from langchain.llms import OpenAIChat qa = RetrievalQA.from_chain_type(llm=OpenAIChat(model='gpt-3.5-turbo'), chain_type='stuff', retriever=db.as_retriever()) /home/leo/.local/lib/python3.10/site-packages/langchain/llms/openai.py:624: UserWarning: Y...
9f7757a27092-4
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
ids text (4, 1) str None metadata json (4, 1) str None text text (4, 1) str None db.similarity_search('What did the president say about Ketanji Brown Jackson', filter={'year': 2013}) 100%|██████████| 4/4 [00:00<00:00, 1080.24it/s] [Document(page_content='...
9f7757a27092-5
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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...
9f7757a27092-6
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
[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...
9f7757a27092-7
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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...
9f7757a27092-8
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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...
9f7757a27092-9
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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 ...
9f7757a27092-10
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
[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...
9f7757a27092-11
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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 ...
9f7757a27092-12
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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...
9f7757a27092-13
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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...
9f7757a27092-14
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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=embeddings, overwrite=True) db.add_documents(docs) Your Deep Lake data...
9f7757a27092-15
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
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 Americans can know who is funding our el...
9f7757a27092-16
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
Dataset(path='s3://hub-2.0-datasets-n/langchain_test', tensors=['embedding', 'ids', 'metadata', 'text']) tensor htype shape dtype compression ------- ------- ------- ------- ------- embedding generic (4, 1536) float32 None ids text (4, 1) str None metadata ...
9f7757a27092-17
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
deeplake.deepcopy(src=source, dest=destination, overwrite=True) Copying dataset: 100%|██████████| 56/56 [00:38<00:00 This dataset can be visualized in Jupyter Notebook by ds.visualize() or at https://app.activeloop.ai/davitbun/langchain_test_copy Your Deep Lake dataset has been successfully created! The dataset is priv...
9f7757a27092-18
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/deeplake.html
tensor htype shape dtype compression ------- ------- ------- ------- ------- embedding generic (8, 1536) float32 None ids text (8, 1) str None metadata json (8, 1) str None text text (8, 1) str None ['ad42f3fe-e188-11...
8fed2f4241d0-0
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
.ipynb .pdf Weaviate Contents Weaviate Similarity search with score Persistance Retriever options Retriever options MMR Question Answering with Sources Weaviate# Weaviate is an open-source vector database. It allows you to store data objects and vector embeddings from your favorite ML-models, and scale seamlessly int...
8fed2f4241d0-1
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
Requirement already satisfied: charset-normalizer<4,>=2 in /workspaces/langchain/.venv/lib/python3.9/site-packages (from requests<2.29.0,>=2.28.0->weaviate-client) (3.1.0) Requirement already satisfied: idna<4,>=2.5 in /workspaces/langchain/.venv/lib/python3.9/site-packages (from requests<2.29.0,>=2.28.0->weaviate-clie...
8fed2f4241d0-2
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
Requirement already satisfied: pycparser in /workspaces/langchain/.venv/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=3.2->authlib>=1.1.0->weaviate-client) (2.21) We want to use OpenAIEmbeddings so we have to get the OpenAI API Key. import os import getpass os.environ["OPENAI_API_KEY"] = getpass.getpass("...
8fed2f4241d0-3
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
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...
8fed2f4241d0-4
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
(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...
8fed2f4241d0-5
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
-0.03392191, 0.002800712, -0.0027778621, -0.024259781, -0.006202043, -0.019950991, 0.0176138, -0.0001134321, 0.008343379, 0.034209162, -0.027654583, 0.03149332, -0.0008389079, 0.0053696632, -0.0024644958, -0.016582303, 0.0066720927, -0.005036711, -0.035514854, 0.002942706, 0.02958701, 0.032825127, 0.015694432, -0.01984...
8fed2f4241d0-6
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
0.010752384, 0.0053598704, -0.00019248774, 0.008480477, -0.010517359, -0.005017126, 0.0020434097, 0.011699011, 0.0051379027, 0.021687564, -0.010830725, 0.020734407, -0.006606808, 0.029769806, 0.02817686, -0.047318324, 0.024338122, -0.001150642, -0.026231378, -0.012325744, -0.0318328, -0.0094989175, -0.00897664, 0.00473...
8fed2f4241d0-7
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
0.0031973163, -0.01115062, 0.004837593, 0.01298512, -0.018645298, -0.02992649, 0.004837593, 0.0067634913, 0.02992649, 0.0145062525, 0.00566018, -0.0017055618, -0.0056667086, 0.012697867, 0.0150677, -0.007559964, -0.01991182, -0.005268472, -0.008650217, -0.008702445, 0.027550127, 0.0018296026, 0.0018589807, -0.033295177...
8fed2f4241d0-8
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
-0.01902395, -0.635507, -0.030083172, 0.0177052, -0.0104912445, 0.012502013, -0.0010747487, 0.00465806, 0.020825805, -0.006887532, 0.013892576, -0.019977106, 0.029952602, 0.0012004217, -0.015211326, -0.008708973, -0.017809656, 0.008578404, -0.01612531, 0.022614606, -0.022327352, -0.032616217, 0.0050693536, -0.020629952...
8fed2f4241d0-9
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
-0.010732798, -0.00876773, -0.0075273216, -0.016530076, 0.018175248, 0.016020855, -0.00067284, 0.013461698, -0.0065904865, -0.017809656, -0.014741276, 0.016582303, -0.0088526, 0.0046482678, 0.037473395, -0.02237958, 0.010112594, 0.022549322, 9.680491e-05, -0.0059082615, 0.020747464, -0.026923396, 0.01162067, -0.0074816...
8fed2f4241d0-10
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
0.02318911, -0.031754456, -0.018188305, -0.031441092, -0.030579336, 0.0011832844, 0.0065023527, -0.027053965, 0.009198609, 0.022079272, -0.027785152, 0.005846241, 0.013500868, 0.016699815, 0.010445545, -0.025265165, -0.004396922, 0.0076774764, 0.014597651, -0.009851455, -0.03637661, 0.0004745379, -0.010112594, -0.00920...
8fed2f4241d0-11
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
-0.013670608, 0.011059221, -0.005438212, 0.0406854, 0.0006218364, -0.024494806, -0.041259903, 0.022013986, -0.0040019494, -0.0052097156, 0.015798887, 0.016190596, 0.0003794671, -0.017444061, 0.012325744, 0.024769, 0.029482553, -0.0046547963, -0.015955571, -0.018397218, -0.0102431625, 0.020577725, 0.016190596, -0.020381...
8fed2f4241d0-12
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
0.0047951583, -0.026923396, 0.014675993, 0.0055851024, 0.015616091, -0.012306159, 0.007670948, 0.038439605, -0.015759716, 0.00016178355, 0.01076544, -0.008232395, -0.009942854, 0.018801982, -0.0025314125, 0.030709906, -0.001442791, -0.042617824, -0.007409809, -0.013109161, 0.031101612, 0.016229765, 0.006162872, 0.01790...
8fed2f4241d0-13
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
0.000504324, 0.03157166, 0.010112594, -0.009009283, 0.026557801, -0.013997031, -0.0071878415, 0.009414048, -0.03480978, 0.006626393, 0.013827291, -0.011444401, -0.011823053, -0.0042957305, -0.016229765, -0.014192886, 0.026531687, -0.012534656, -0.0056569157, -0.0010331298, 0.007977786, 0.0033654245, -0.017352663, 0.034...
8fed2f4241d0-14
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
-0.019128405, 0.0079582, -0.026270548, -0.015877228, 0.014153715, -0.011960151, 0.007853745, 0.006972402, -0.014101488, 0.02456009, 0.015119928, -0.0018850947, 0.019010892, -0.0046188897, -0.0050954674, -0.03548874, -0.01608614, -0.00324628, 0.009466276, 0.031911142, 7.033402e-05, -0.025095424, 0.020225188, 0.014832675...
8fed2f4241d0-15
https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html
-0.00075689406, 0.0076578907, -0.019337315, -0.0024187965, -0.0110331075, -0.01187528, 0.0013048771, 0.0009711094, -0.027863493, -0.020616895, -0.0024481746, -0.0040802914, 0.014571536, -0.012306159, -0.037630077, 0.012652168, 0.009068039, -0.0018263385, 0.0371078, -0.0026831995, 0.011333417, -0.011548856, -0.005904997...