id
stringlengths
14
15
text
stringlengths
101
5.26k
source
stringlengths
57
120
dfe865bf62a8-0
.ipynb .pdf Pinecone Pinecone# Pinecone is a vector database with broad functionality. This notebook shows how to use functionality related to the Pinecone vector database. To use Pinecone, you must have an API key. Here are the installation instructions. !pip install pinecone-client import os import getpass PINECONE_A...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/pinecone.html
ada9ac68c1ef-0
.ipynb .pdf Commented out until further notice Commented out until further notice# 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 feat...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/mongodb_atlas_vector_search.html
7b4624a88f1a-0
.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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-1
docs = text_splitter.split_documents(documents) embeddings = OpenAIEmbeddings() db = Weaviate.from_documents(docs, embeddings, weaviate_url=WEAVIATE_URL, by_text=False) 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 ...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-2
(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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-3
-0.005826656, 0.0072531262, 0.015498579, -0.0077819317, -0.011953622, -0.028934162, -0.033974137, -0.01574666, 0.0086306315, -0.029299757, 0.030213742, -0.0033148287, 0.013448641, -0.013474754, 0.015851116, 0.0076578907, -0.037421167, -0.015185213, 0.010719741, -0.014636821, 0.0001918757, 0.011783881, 0.0036330915, -0....
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-4
0.006283649, 0.01868447, -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.02692339...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-5
0.030030945, -0.01115062, 0.0032560725, -0.014819618, 0.005647123, -0.0032560725, 0.0038909658, 0.013311543, 0.024285894, -0.0045699263, -0.010112594, 0.009237779, 0.008728559, 0.0423828, 0.010909067, 0.04225223, -0.031806685, -0.013696723, -0.025787441, 0.00838255, -0.008715502, 0.006776548, 0.01825359, -0.014480138, ...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-6
0.00086583785, 0.15835446, 0.033765227, 0.00893747, 0.015119928, -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, ...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-7
-0.036193814, -0.021126116, -0.005412098, -0.013076518, 0.027080078, 0.012900249, -0.0073379963, -0.015119928, -0.019781252, 0.0062346854, -0.03266844, 0.025278222, -0.022797402, -0.0028415148, 0.021452539, -0.023162996, 0.005170545, -0.022314297, 0.011215905, -0.009838398, -0.00033233972, 0.0019650683, 0.0026326037, 0...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-8
0.0042565595, 0.022327352, -0.015681375, -0.013840348, 6.502964e-05, 0.015485522, -0.002678303, -0.0047984226, -0.012182118, -0.001512972, 0.013931747, -0.009642544, 0.012652168, -0.012932892, -0.027759038, -0.01085031, 0.0050236546, -0.009675186, -0.00893747, -0.0051770736, 0.036011018, 0.003528636, -0.001008648, -0.0...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-9
0.014179829, 0.010321504, 0.0053337566, -0.017156808, -0.010439017, 0.034444187, -0.010393318, -0.006042096, -0.018566957, 0.004517698, -0.011228961, -0.009015812, -0.02089109, 0.022484036, 0.0029867734, -0.029064732, -0.010236635, -0.0006761042, -0.029038617, 0.004367544, -0.012293102, 0.0017528932, -0.023358852, 0.02...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-10
0.0029981981, -0.015589978, 0.026479458, 0.0067439056, -0.035775993, -0.010550001, -0.014767391, -0.009897154, -0.013944804, -0.0147543335, 0.015798887, -0.02456009, -0.0018850947, 0.024442578, 0.0019715966, -0.02422061, -0.02945644, -0.003443766, 0.0004945313, 0.0011522742, -0.020773578, -0.011777353, 0.008173639, -0....
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-11
-0.0147543335, -0.005000805, 0.02345025, -0.028908048, 0.0104912445, -0.00753385, 0.017561574, -0.012025435, 0.042670052, -0.0041978033, 0.0013056932, -0.009263893, -0.010941708, -0.004471999, 0.01008648, -0.002578744, -0.013931747, 0.018619185, -0.04029369, -0.00025909848, 0.0030063589, 0.003149985, 0.011091864, 0.006...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-12
0.011568441, -0.03230285, 0.023646105, 0.0111114485, -0.015172156, 0.0257091, 0.0045699263, -0.00919208, 0.021517823, 0.037838988, 0.00787333, -0.007755818, -0.028281316, 0.011170205, -0.005412098, -0.016321165, 0.009929797, 0.004609097, -0.03047488, 0.002688096, -0.07264877, 0.024455635, -0.020930262, -0.015381066, -0...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-13
0.01774437, 0.0021233836, -0.008434778, -0.0059441687, 0.038335152, 0.022653777, -0.0066002794, 0.02149171, 0.015093814, 0.025382677, -0.007579549, 0.0030357367, -0.0014117807, -0.015341896, 0.014545423, 0.007135614, -0.0113595305, -0.04387129, 0.016308108, -0.008186696, -0.013370299, -0.014297341, 0.017431004, -0.0226...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
7b4624a88f1a-14
0.8154189703772676) Persistance# Anything uploaded to weaviate is automatically persistent into the database. You do not need to call any specific method or pass any param for this to happen. Retriever options# Retriever options# This section goes over different options for how to use Weaviate as a retriever. MMR# In a...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/weaviate.html
ff4c412eb27d-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 ...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/analyticdb.html
eb60cb15db1a-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/tair.html
2a54a6e799c5-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....
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/atlas.html
8b1c5da89410-0
.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 ...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/qdrant.html
8b1c5da89410-1
del qdrant import qdrant_client client = qdrant_client.QdrantClient( path="/tmp/local_qdrant", prefer_grpc=True ) qdrant = Qdrant( client=client, collection_name="my_documents", embeddings=embeddings ) Similarity search# The simplest scenario for using Qdrant vector store is to perform a similarity search....
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/qdrant.html
8b1c5da89410-2
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. 2. We can’t change how divided we’ve been. But we can change how we move forward—on COVID-19 and other issues we must face toge...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/qdrant.html
8b1c5da89410-3
By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 08, 2023.
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/qdrant.html
4ddc6c7b09e5-0
.ipynb .pdf MyScale Contents Setting up envrionments Get connection info and data schema Filtering Similarity search with score Deleting your data MyScale# MyScale is a cloud-based database optimized for AI applications and solutions, built on the open-source ClickHouse. This notebook shows how to use functionality r...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/myscale.html
4ddc6c7b09e5-1
k=4, where_str=f"{meta}.doc_id<10") for d, dist in output: print(dist, d.metadata, d.page_content[:20] + '...') 0.252379834651947 {'doc_id': 6, 'some': ''} And I’m taking robus... 0.25022566318511963 {'doc_id': 1, 'some': ''} Groups of citizens b... 0.2469480037689209 {'doc_id': 8, 'some': ''} And so many families....
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/myscale.html
76b03b40d8e3-0
.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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/sklearn.html
76b03b40d8e3-1
Clean-up# os.remove(persist_path) previous SingleStoreDB vector search next Supabase (Postgres) 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 By Harrison Chase © Copyright 2023,...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/sklearn.html
e07c96f65d0e-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/docarray_hnsw.html
b8483673a15f-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/tigris.html
faaf549b807d-0
.ipynb .pdf DocArrayInMemorySearch Contents Setup Using DocArrayInMemorySearch Similarity search Similarity search with score DocArrayInMemorySearch# DocArrayInMemorySearch is a document index provided by Docarray that stores documents in memory. It is a great starting point for small datasets, where you may not want...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/docarray_in_memory.html
e05b847b07d0-0
.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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/annoy.html
e05b847b07d0-1
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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/annoy.html
e05b847b07d0-2
Create VectorStore via existing embeddings# embs = embeddings_func.embed_documents(texts) data = list(zip(texts, embs)) vector_store_from_embeddings = Annoy.from_embeddings(data, embeddings_func) vector_store_from_embeddings.similarity_search_with_score("food", k=3) [(Document(page_content='pizza is great', metadata={}...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/annoy.html
e05b847b07d0-3
) db_manually.similarity_search_with_score("eating!", k=3) [(Document(page_content='pizza is great', metadata={'x': 'food'}), 1.1314140558242798), (Document(page_content='I love salad', metadata={'x': 'food'}), 1.1668788194656372), (Document(page_content='my car', metadata={'x': 'stuff'}), 1.226445198059082)] pre...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/annoy.html
27e4ea9f2ce5-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/pgvector.html
27e4ea9f2ce5-1
Requirement already satisfied: requests>=2.26.0 in /Users/joyeed/langchain/langchain/.venv/lib/python3.9/site-packages (from tiktoken) (2.28.2) Requirement already satisfied: charset-normalizer<4,>=2 in /Users/joyeed/langchain/langchain/.venv/lib/python3.9/site-packages (from requests>=2.26.0->tiktoken) (3.1.0) Require...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/pgvector.html
27e4ea9f2ce5-2
-------------------------------------------------------------------------------- Score: 0.6076804864602984 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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/pgvector.html
27e4ea9f2ce5-3
) retriever = store.as_retriever() print(retriever) vectorstore=<langchain.vectorstores.pgvector.PGVector object at 0x7fe9a1b1c670> search_type='similarity' search_kwargs={} # When we have an existing PG VEctor DEFAULT_DISTANCE_STRATEGY = DistanceStrategy.EUCLIDEAN db1 = PGVector.from_existing_index( embedding=emb...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/pgvector.html
27e4ea9f2ce5-4
print(docs_with_score) [(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 se...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/pgvector.html
27e4ea9f2ce5-5
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 ...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/pgvector.html
0c8d9ded5f65-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/deeplake.html
0c8d9ded5f65-1
Deep Lake Dataset in ./my_deeplake/ already exists, loading from the storage Dataset(path='./my_deeplake/', read_only=True, tensors=['embedding', 'ids', 'metadata', 'text']) tensor htype shape dtype compression ------- ------- ------- ------- ------- embedding generic (42, 1536) float32 ...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/deeplake.html
0c8d9ded5f65-2
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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/deeplake.html
0c8d9ded5f65-3
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 ...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/deeplake.html
0c8d9ded5f65-4
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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/deeplake.html
0c8d9ded5f65-5
Creating dataset on AWS S3# dataset_path = f"s3://BUCKET/langchain_test" # could be also ./local/path (much faster locally), hub://bucket/path/to/dataset, gcs://path/to/dataset, etc. embedding = OpenAIEmbeddings() db = DeepLake.from_documents(docs, dataset_path=dataset_path, embedding=embeddings, overwrite=True, creds ...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/deeplake.html
0c8d9ded5f65-6
------- ------- ------- ------- ------- 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-11ed-b66d-41c5f7b85421', 'ad42f3ff-e188-11ed-b66d-41c...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/deeplake.html
24ad99710ee1-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/clickhouse.html
24ad99710ee1-1
If you custimized your column_map under your setting, you search with filter like this: from langchain.vectorstores import Clickhouse, ClickhouseSettings from langchain.document_loaders import TextLoader loader = TextLoader('../../../state_of_the_union.txt') documents = loader.load() text_splitter = CharacterTextSplitt...
https://langchain.readthedocs.io/en/latest/modules/indexes/vectorstores/examples/clickhouse.html
374093f54bbc-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/weaviate_self_query.html
374093f54bbc-1
Document(page_content='A psychologist / detective gets lost in a series of dreams within dreams within dreams and Inception reused the idea', metadata={'genre': None, 'rating': 8.6, 'year': 2006})] # This example specifies a query and a filter retriever.get_relevant_documents("Has Greta Gerwig directed any movies about...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/weaviate_self_query.html
bfa2b8fa15d5-0
.ipynb .pdf VectorStore Contents Maximum Marginal Relevance Retrieval Similarity Score Threshold Retrieval Specifying top k VectorStore# The index - and therefore the retriever - that LangChain has the most support for is the VectorStoreRetriever. As the name suggests, this retriever is backed heavily by a VectorStor...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/vectorstore.html
7b1288250945-0
.ipynb .pdf Zep Contents Retriever Example Initialize the Zep Chat Message History Class and add a chat message history to the memory store Use the Zep Retriever to vector search over the Zep memory Zep# Zep - A long-term memory store for LLM applications. More on Zep: Zep stores, summarizes, embeds, indexes, and enr...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/zep_memorystore.html
7b1288250945-1
" living in a dystopian future where society has collapsed due to" " environmental disasters, poverty, and violence." ), }, ] for msg in test_history: zep_chat_history.append( HumanMessage(content=msg["content"]) if msg["role"] == "human" else AIMessage(content=msg["c...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/zep_memorystore.html
7b1288250945-2
Document(page_content="Write a short synopsis of Butler's book, Parable of the Sower. What is it about?", metadata={'score': 0.8857628682610436, 'uuid': 'f6706e8c-6c91-452f-8c1b-9559fd924657', 'created_at': '2023-05-25T15:03:30.265302Z', 'role': 'human', 'token_count': 23}), Document(page_content='Who was Octavia Butl...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/zep_memorystore.html
21ee3ea94a99-0
.ipynb .pdf Contextual Compression Contents Contextual Compression Using a vanilla vector store retriever Adding contextual compression with an LLMChainExtractor More built-in compressors: filters LLMChainFilter EmbeddingsFilter Stringing compressors and document transformers together Contextual Compression# This not...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/contextual-compression.html
21ee3ea94a99-1
First, beat the opioid epidemic. ---------------------------------------------------------------------------------------------------- Document 4: Tonight, I’m announcing a crackdown on these companies overcharging American businesses and consumers. And as Wall Street firms take over more nursing homes, quality in thos...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/contextual-compression.html
21ee3ea94a99-2
compressed_docs = compression_retriever.get_relevant_documents("What did the president say about Ketanji Jackson Brown") pretty_print_docs(compressed_docs) Document 1: 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 ...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/contextual-compression.html
21ee3ea94a99-3
---------------------------------------------------------------------------------------------------- Document 2: As I said last year, especially to our younger transgender Americans, I will always have your back as your President, so you can be yourself and reach your God-given potential. While it often appears that w...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/contextual-compression.html
969d44ef95a6-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/wikipedia.html
969d44ef95a6-1
from langchain.chains import ConversationalRetrievalChain model = ChatOpenAI(model_name='gpt-3.5-turbo') # switch to 'gpt-4' qa = ConversationalRetrievalChain.from_llm(model,retriever=retriever) questions = [ "What is Apify?", "When the Monument to the Martyrs of the 1830 Revolution was created?", "What is ...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/wikipedia.html
4cbc97f54dcb-0
.ipynb .pdf ChatGPT Plugin Contents Using the ChatGPT Retriever Plugin ChatGPT Plugin# OpenAI plugins connect ChatGPT to third-party applications. These plugins enable ChatGPT to interact with APIs defined by developers, enhancing ChatGPT’s capabilities and allowing it to perform a wide range of actions. Plugins can ...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/chatgpt-plugin.html
3f4073807186-0
.ipynb .pdf Time Weighted VectorStore Contents Low Decay Rate High Decay Rate Virtual Time Time Weighted VectorStore# This retriever uses a combination of semantic similarity and a time decay. The algorithm for scoring them is: semantic_similarity + (1.0 - decay_rate) ** hours_passed Notably, hours_passed refers to t...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/time_weighted_vectorstore.html
3f4073807186-1
print(retriever.get_relevant_documents("hello world")) [Document(page_content='hello world', metadata={'last_accessed_at': MockDateTime(2011, 2, 3, 10, 11), 'created_at': datetime.datetime(2023, 5, 13, 21, 0, 27, 279596), 'buffer_idx': 0})] previous TF-IDF next VectorStore Contents Low Decay Rate High Decay Rate Vi...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/time_weighted_vectorstore.html
88ecfcddccd5-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/weaviate-hybrid.html
88ecfcddccd5-1
retriever.get_relevant_documents("the ethical implications of AI") [Document(page_content='In her second book, Dr. Simmons delves deeper into the ethical considerations surrounding AI development and deployment. It is an eye-opening examination of the dilemmas faced by developers, policymakers, and society at large.', ...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/weaviate-hybrid.html
e1b8f6bbf8b0-0
.ipynb .pdf SVM Contents Create New Retriever with Texts Use Retriever SVM# Support vector machines (SVMs) are a set of supervised learning methods used for classification, regression and outliers detection. This notebook goes over how to use a retriever that under the hood uses an SVM using scikit-learn package. Lar...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/svm.html
2f2a65158de4-0
.ipynb .pdf Arxiv Contents Installation Examples Running retriever Question Answering on facts Arxiv# arXiv is an open-access archive for 2 million scholarly articles in the fields of physics, mathematics, computer science, quantitative biology, quantitative finance, statistics, electrical engineering and systems sci...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/arxiv.html
2f2a65158de4-1
-> **Question**: What is the ImageBind model? **Answer**: ImageBind is an approach developed by Facebook AI Research to learn a joint embedding across six different modalities, including images, text, audio, depth, thermal, and IMU data. The approach uses the binding property of images to align each modality's embeddi...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/arxiv.html
506c6a59f04b-0
.ipynb .pdf Self-querying with Qdrant Contents Creating a Qdrant vectorstore Creating our self-querying retriever Testing it out Filter k Self-querying with Qdrant# Qdrant (read: quadrant ) is a vector similarity search engine. It provides a production-ready service with a convenient API to store, search, and manage ...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/qdrant_self_query.html
506c6a59f04b-1
query='dinosaur' filter=None limit=None [Document(page_content='A bunch of scientists bring back dinosaurs and mayhem breaks loose', metadata={'year': 1993, 'rating': 7.7, 'genre': 'science fiction'}), Document(page_content='Toys come alive and have a blast doing so', metadata={'year': 1995, 'genre': 'animated'}), Do...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/qdrant_self_query.html
506c6a59f04b-2
previous PubMed Retriever next Self-querying Contents Creating a Qdrant vectorstore Creating our self-querying retriever Testing it out Filter k By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 08, 2023.
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/qdrant_self_query.html
0a1209deab2b-0
.ipynb .pdf Pinecone Hybrid Search Contents Setup Pinecone Get embeddings and sparse encoders Load Retriever Add texts (if necessary) Use Retriever Pinecone Hybrid Search# Pinecone is a vector database with broad functionality. This notebook goes over how to use a retriever that under the hood uses Pinecone and Hybri...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/pinecone_hybrid_search.html
0a1209deab2b-1
By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 08, 2023.
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/pinecone_hybrid_search.html
ca67590cf6d4-0
.ipynb .pdf Self-querying Contents Creating a Pinecone index Creating our self-querying retriever Testing it out Filter k Self-querying# In the notebook we’ll demo the SelfQueryRetriever, which, as the name suggests, has the ability to query itself. Specifically, given any natural language query, the retriever uses a...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/self_query.html
ca67590cf6d4-1
type="float" ), ] document_content_description = "Brief summary of a movie" 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 spec...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/self_query.html
ca67590cf6d4-2
metadata_field_info, enable_limit=True, verbose=True ) # This example only specifies a relevant query retriever.get_relevant_documents("What are two movies about dinosaurs") previous Self-querying with Qdrant next SVM Contents Creating a Pinecone index Creating our self-querying retriever Testing it out Fi...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/self_query.html
4d3f43d11cdb-0
.ipynb .pdf Self-querying with Chroma Contents Creating a Chroma vectorstore Creating our self-querying retriever Testing it out Filter k Self-querying with Chroma# Chroma is a database for building AI applications with embeddings. In the notebook we’ll demo the SelfQueryRetriever wrapped around a Chroma vector store...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/chroma_self_query.html
4d3f43d11cdb-1
Document(page_content='A psychologist / detective gets lost in a series of dreams within dreams within dreams and Inception reused the idea', metadata={'year': 2006, 'director': 'Satoshi Kon', 'rating': 8.6}), Document(page_content='Leo DiCaprio gets lost in a dream within a dream within a dream within a ...', metadat...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/chroma_self_query.html
4d3f43d11cdb-2
previous ChatGPT Plugin next Cohere Reranker Contents Creating a Chroma vectorstore Creating our self-querying retriever Testing it out Filter k By Harrison Chase © Copyright 2023, Harrison Chase. Last updated on Jun 08, 2023.
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/chroma_self_query.html
2fe231df2319-0
.ipynb .pdf kNN Contents Create New Retriever with Texts Use Retriever kNN# In statistics, the k-nearest neighbors algorithm (k-NN) is a non-parametric supervised learning method first developed by Evelyn Fix and Joseph Hodges in 1951, and later expanded by Thomas Cover. It is used for classification and regression. ...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/knn.html
4622b6704dbb-0
.ipynb .pdf PubMed Retriever PubMed Retriever# This notebook goes over how to use PubMed as a retriever PubMed® comprises more than 35 million citations for biomedical literature from MEDLINE, life science journals, and online books. Citations may include links to full text content from PubMed Central and publisher web...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/pubmed.html
db164f844f70-0
.ipynb .pdf ElasticSearch BM25 Contents Create New Retriever Add texts (if necessary) Use Retriever ElasticSearch BM25# Elasticsearch is a distributed, RESTful search and analytics engine. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents....
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/elastic_search_bm25.html
dd3414e03431-0
.ipynb .pdf TF-IDF Contents Create New Retriever with Texts Create a New Retriever with Documents Use Retriever TF-IDF# TF-IDF means term-frequency times inverse document-frequency. This notebook goes over how to use a retriever that under the hood uses TF-IDF using scikit-learn package. For more information on the d...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/tf_idf.html
0fb76a0e9b89-0
.ipynb .pdf Cohere Reranker Contents Set up the base vector store retriever Doing reranking with CohereRerank Cohere Reranker# Cohere is a Canadian startup that provides natural language processing models that help companies improve human-machine interactions. This notebook shows how to use Cohere’s rerank endpoint i...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/cohere-reranker.html
0fb76a0e9b89-1
and the middle out, not from the top down. Because we know that when the middle class grows, the poor have a ladder up and the wealthy do very well. America used to have the best roads, bridges, and airports on Earth. Now our infrastructure is ranked 13th in the world. ----------------------------------------------...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/cohere-reranker.html
0fb76a0e9b89-2
Our troops in Iraq and Afghanistan faced many dangers. ---------------------------------------------------------------------------------------------------- Document 16: When we invest in our workers, when we build the economy from the bottom up and the middle out together, we can do something we haven’t done in a long ...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/cohere-reranker.html
0fb76a0e9b89-3
chain({"query": query}) {'query': 'What did the president say about Ketanji Brown Jackson', 'result': " The president said that Ketanji Brown Jackson is one of the nation's top legal minds and that she is a consensus builder who has received a broad range of support from the Fraternal Order of Police to former judges ...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/cohere-reranker.html
0cf09c7922d0-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...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/databerry.html
3d04b97b9cd4-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 = ...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/metal.html
e44eb5993657-0
.ipynb .pdf Vespa Vespa# Vespa is a fully featured search engine and vector database. It supports vector search (ANN), lexical search, and search in structured data, all in the same query. This notebook shows how to use Vespa.ai as a LangChain retriever. In order to create a retriever, we use pyvespa to create a connec...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/vespa.html
a98d244b2588-0
.ipynb .pdf Azure Cognitive Search Contents Set up Azure Cognitive Search Using the Azure Cognitive Search Retriever Azure Cognitive Search# Azure Cognitive Search (formerly known as Azure Search) is a cloud search service that gives developers infrastructure, APIs, and tools for building a rich search experience ove...
https://langchain.readthedocs.io/en/latest/modules/indexes/retrievers/examples/azure_cognitive_search.html
70805e07ee7a-0
.ipynb .pdf Chat Prompt Templates Contents Format output Different types of MessagePromptTemplate Chat Prompt Templates# Chat Models take a list of chat messages as input - this list commonly referred to as a prompt. These chat messages differ from raw string (which you would pass into a LLM model) in that every mess...
https://langchain.readthedocs.io/en/latest/modules/prompts/chat_prompt_template.html
70805e07ee7a-1
ChatMessage(content='May the force be with you', additional_kwargs={}, role='Jedi') LangChain also provides MessagesPlaceholder, which gives you full control of what messages to be rendered during formatting. This can be useful when you are uncertain of what role you should be using for your message prompt templates or...
https://langchain.readthedocs.io/en/latest/modules/prompts/chat_prompt_template.html
a6ec384bdce9-0
.rst .pdf Output Parsers Output Parsers# Note Conceptual Guide Language models output text. But many times you may want to get more structured information than just text back. This is where output parsers come in. Output parsers are classes that help structure language model responses. There are two main methods an out...
https://langchain.readthedocs.io/en/latest/modules/prompts/output_parsers.html
40fcdcb607a4-0
.ipynb .pdf Getting Started Contents PromptTemplates to_string to_messages Getting Started# This section contains everything related to prompts. A prompt is the value passed into the Language Model. This value can either be a string (for LLMs) or a list of messages (for Chat Models). The data types of these prompts a...
https://langchain.readthedocs.io/en/latest/modules/prompts/getting_started.html
bc86231a1675-0
.rst .pdf Prompt Templates Prompt Templates# Note Conceptual Guide Language models take text as input - that text is commonly referred to as a prompt. Typically this is not simply a hardcoded string but rather a combination of a template, some examples, and user input. LangChain provides several classes and functions t...
https://langchain.readthedocs.io/en/latest/modules/prompts/prompt_templates.html
e6fa1e7fcbd0-0
.rst .pdf Example Selectors Example Selectors# Note Conceptual Guide If you have a large number of examples, you may need to select which ones to include in the prompt. The ExampleSelector is the class responsible for doing so. The base interface is defined as below: class BaseExampleSelector(ABC): """Interface for...
https://langchain.readthedocs.io/en/latest/modules/prompts/example_selectors.html
f4129c63ca1a-0
.md .pdf How to create a custom example selector Contents Implement custom example selector Use custom example selector How to create a custom example selector# In this tutorial, we’ll create a custom example selector that selects every alternate example from a given list of examples. An ExampleSelector must implemen...
https://langchain.readthedocs.io/en/latest/modules/prompts/example_selectors/examples/custom_example_selector.html