id stringlengths 14 16 | text stringlengths 36 2.73k | source stringlengths 59 127 |
|---|---|---|
1ff1c3166c12-0 | .ipynb
.pdf
MatchingEngine
Contents
Create VectorStore from texts
Create Index and deploy it to an Endpoint
Imports, Constants and Configs
Using Tensorflow Universal Sentence Encoder as an Embedder
Inserting a test embedding
Creating Index
Creating Endpoint
Deploy Index
MatchingEngine#
This notebook shows how to use ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/matchingengine.html |
1ff1c3166c12-1 | import tensorflow_text
PROJECT_ID = "<my_project_id>"
REGION = "<my_region>"
VPC_NETWORK = "<my_vpc_network_name>"
PEERING_RANGE_NAME = "ann-langchain-me-range" # Name for creating the VPC peering.
BUCKET_URI = "gs://<bucket_uri>"
# The number of dimensions for the tensorflow universal sentence encoder.
# If other em... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/matchingengine.html |
1ff1c3166c12-2 | ! gcloud compute firewall-rules create {VPC_NETWORK}-allow-rdp --network {VPC_NETWORK} --priority 65534 --project {PROJECT_ID} --allow tcp:3389
! gcloud compute firewall-rules create {VPC_NETWORK}-allow-ssh --network {VPC_NETWORK} --priority 65534 --project {PROJECT_ID} --allow tcp:22
# Reserve IP range
! g... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/matchingengine.html |
1ff1c3166c12-3 | Creating Index#
my_index = aiplatform.MatchingEngineIndex.create_tree_ah_index(
display_name=DISPLAY_NAME,
contents_delta_uri=EMBEDDING_DIR,
dimensions=DIMENSIONS,
approximate_neighbors_count=150,
distance_measure_type="DOT_PRODUCT_DISTANCE"
)
Creating Endpoint#
my_index_endpoint = aiplatform.Matchi... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/matchingengine.html |
abcd1d053f29-0 | .ipynb
.pdf
Contents
Commented out until further notice
MongoDB Atlas Vector Search
MongoDB Atlas is a fully-managed cloud database available in AWS , Azure, and GCP. It now has support for native Vector Search on your MongoDB document data.
This notebook shows how to use MongoDB Atlas Vector Search to store your em... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/mongodb_atlas_vector_search.html |
abcd1d053f29-1 | "mappings": {
"dynamic": true,
"fields": {
"embedding": {
"dimensions": 1536,
"similarity": "cosine",
"type": "knnVector"
}
}
}
}
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstor... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/mongodb_atlas_vector_search.html |
abcd1d053f29-2 | from langchain.embeddings.openai import OpenAIEmbeddings
import os
MONGODB_ATLAS_URI = os.environ['MONGODB_ATLAS_URI']
# initialize MongoDB python client
client = MongoClient(MONGODB_ATLAS_URI)
db_name = "langchain_db"
collection_name = "langchain_col"
collection = client[db_name][collection_name]
index_name = "langcha... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/mongodb_atlas_vector_search.html |
3d33e32c2cc5-0 | .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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/redis.html |
3d33e32c2cc5-1 | 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/redis.html |
3d33e32c2cc5-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.
Redis as Retriever#
Here we go over different options for using the vector store as a retriever.
There are three different searc... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/redis.html |
1d504b5bf642-0 | .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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/supabase.html |
1d504b5bf642-1 | SELECT
id,
content,
metadata,
embedding,
1 -(documents.embedding <=> query_embedding) AS similarity
FROM
documents
ORDER BY
documents.embedding <=> query_embedding
LIMIT match_count;... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/supabase.html |
1d504b5bf642-2 | docs = text_splitter.split_documents(documents)
embeddings = OpenAIEmbeddings()
# 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 = "... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/supabase.html |
1d504b5bf642-3 | matched_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 dedicated his life to serve this... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/supabase.html |
1d504b5bf642-4 | 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/supabase.html |
1d504b5bf642-5 | ## Document 2
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 ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/supabase.html |
1d504b5bf642-6 | I’ve worked on these issues a long time.
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 Marg... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/supabase.html |
f031b15cdf08-0 | .ipynb
.pdf
Pinecone
Contents
Maximal Marginal Relevance Searches
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 pine... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pinecone.html |
f031b15cdf08-1 | # docsearch = Pinecone.from_existing_index(index_name, embeddings)
query = "What did the president say about Ketanji Brown Jackson"
docs = docsearch.similarity_search(query)
print(docs[0].page_content)
Maximal Marginal Relevance Searches#
In addition to using similarity search in the retriever object, you can also use ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/pinecone.html |
ec266acbe76a-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-1 | 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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-2 | 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("... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-3 | 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/weaviate.html |
ec266acbe76a-4 | (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/weaviate.html |
ec266acbe76a-5 | -0.031754456, 0.013526983, -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.03282... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-6 | 0.0025607906, -0.01599474, -0.017757427, -0.0041651614, 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.01... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-7 | 0.0036330915, -0.02132197, 0.0031010215, 0.0024334856, -0.0033229894, 0.050086394, 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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-8 | -0.015028529, 0.018606128, 0.03449641, -0.017757427, -0.016020855, -0.012142947, 0.025304336, 0.00821281, -0.0025461016, -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, ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-9 | 0.008349908, 0.00035641342, 0.009028868, 0.007631777, -0.01298512, -0.0015350056, 0.009982024, -0.024207553, -0.003332782, 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.00885... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-10 | 0.015942514, 0.0097469995, -0.0067830766, 0.023828901, -0.01523744, -0.0121494755, 0.00744898, 0.010445545, -0.011006993, -0.0032789223, 0.020394927, -0.017796598, -0.0029116957, 0.02318911, -0.031754456, -0.018188305, -0.031441092, -0.030579336, 0.0011832844, 0.0065023527, -0.027053965, 0.009198609, 0.022079272, -0.02... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-11 | -0.02038187, -0.033739112, 0.0018948873, -0.011379116, -0.0020923733, -0.014075373, 0.01970291, 0.0020352493, -0.0075273216, -0.02136114, 0.0027974476, -0.009577259, -0.023815846, 0.024847344, 0.014675993, -0.019454828, -0.013670608, 0.011059221, -0.005438212, 0.0406854, 0.0006218364, -0.024494806, -0.041259903, 0.0220... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-12 | 0.0423828, 0.010909067, 0.04225223, -0.031806685, -0.013696723, -0.025787441, 0.00838255, -0.008715502, 0.006776548, 0.01825359, -0.014480138, -0.014427911, -0.017600743, -0.030004831, 0.0145845935, 0.013762007, -0.013226673, 0.004168425, 0.0047951583, -0.026923396, 0.014675993, 0.0055851024, 0.015616091, -0.012306159,... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-13 | 0.007710119, 0.03407859, -0.008898299, -0.008565348, 0.030527107, -0.0003027576, 0.025082368, 0.0405026, 0.03867463, 0.0014117807, -0.024076983, 0.003933401, -0.009812284, 0.00829768, -0.0074293944, 0.0061530797, -0.016647588, -0.008147526, -0.015629148, 0.02055161, 0.000504324, 0.03157166, 0.010112594, -0.009009283, 0... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-14 | -0.0030226798, -0.00074261305, 0.030892702, -0.026218321, 0.0062803845, -0.018031623, -0.021504767, -0.012834964, 0.009009283, -0.0029198565, -0.014349569, -0.020434098, 0.009838398, -0.005993132, -0.013618381, -0.031597774, -0.019206747, 0.00086583785, 0.15835446, 0.033765227, 0.00893747, 0.015119928, -0.019128405, 0.... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-15 | 0.019650683, -0.0074424515, -0.0030977572, 0.0073379963, -0.00012455089, 0.010230106, -0.0007254758, -0.0025052987, -0.009681715, 0.03439196, -0.035123147, -0.0028806855, 0.012828437, 0.00018646932, 0.0066133365, 0.025539361, -0.00055736775, -0.025356563, -0.004537284, -0.007031158, 0.015825002, -0.013076518, 0.0073641... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-16 | 0.01727432, -0.008082241, -0.018645298, 0.024507863, 0.0030895968, -0.0014656406, 0.011137563, -0.025513247, -0.022967143, -0.002033617, 0.006887532, 0.016621474, -0.019337315, -0.0030618508, 0.0014697209, -0.011679426, -0.003597185, -0.0049844836, -0.012332273, 0.009068039, 0.009407519, 0.027080078, -0.011215905, -0.0... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-17 | -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.009753528, -0.0029639236, 0.021126116, 0.01944177, -0.00044883206, -0.00961643, 0... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-18 | 0.013801178, -0.006296706, -0.00025052988, -0.01795328, -0.026296662, 0.0017659501, 0.021883417, 0.0028937424, 0.00495837, -0.011888337, -0.008950527, -0.012058077, 0.020316586, 0.00804307, -0.0068483613, -0.0038387382, 0.019715967, -0.025069311, -0.000797697, -0.04507253, -0.009179023, -0.016242823, 0.013553096, -0.00... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-19 | 0.021570051, -0.008284623, -0.003793039, -0.013422526, -0.009655601, -0.0016614947, -0.02388113, 0.00114901, 0.0034405016, 0.02796795, -0.039118566, 0.0023975791, -0.010608757, 0.00093438674, 0.0017382042, -0.02047327, 0.026283605, -0.020799693, 0.005947433, -0.014349569, 0.009890626, -0.022719061, -0.017248206, 0.0042... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-20 | -0.021517823, 0.00372449, -0.045124754, 0.015589978, -0.033582427, -0.01642562, -0.009609901, -0.031179955, 0.0012591778, -0.011176733, -0.018658355, -0.015224383, 0.014884903, 0.013083046, 0.0063587264, -0.008238924, -0.008917884, -0.003877909, 0.022836573, -0.004374072, -0.031127727, 0.02604858, -0.018136078, 0.00076... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-21 | 0.005826656, 0.012188647, -0.020394927, -0.0013024289, -0.027315103, -0.017000126, -0.0010600596, -0.0019014158, 0.016712872, 0.0012673384, 0.02966535, 0.02911696, -0.03081436, 0.025552418, 0.0014215735, -0.02510848, 0.020277414, -0.02672754, 0.01829276, 0.03381745, -0.013957861, 0.0049094064, 0.033556316, 0.005167281,... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-22 | 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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-23 | 0.0047135525, -0.011294246, 0.011477043, 0.015485522, 0.03426139, 0.014323455, 0.011052692, -0.008362965, -0.037969556, -0.00252162, -0.013709779, -0.0030292084, -0.016569246, -0.013879519, 0.0011849166, -0.0016925049, 0.009753528, 0.008349908, -0.008245452, 0.033007924, -0.0035873922, -0.025461018, 0.016791213, 0.0541... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-24 | 0.029743692, 0.021857304, 0.01438874, 0.00014128008, -0.006156344, -0.006691678, 0.01672593, -0.012821908, -0.0024367499, -0.03219839, 0.0058233915, -0.0056405943, -0.009381405, 0.0064044255, 0.013905633, -0.011228961, -0.0013481282, -0.014023146, 0.00016239559, -0.0051901303, 0.0025265163, 0.023619989, -0.021517823, 0... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-25 | -0.012325744, -0.021348083, 0.0036461484, 0.0063228197, 0.00028970066, -0.0036200345, -0.021596165, -0.003949722, -0.0006034751, 0.007305354, -0.023424136, 0.004834329, -0.008833014, -0.013435584, 0.0026097542, -0.0012240873, -0.0028349862, -0.01706541, 0.027863493, -0.026414175, -0.011783881, 0.014075373, -0.005634066... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-26 | -0.0018573486, -0.0024840813, -0.022444865, 0.0055687814, 0.0037767177, 0.0033915383, 0.0301354, -0.012227817, 0.0021854038, -0.042878963, 0.021517823, -0.010419431, -0.0051183174, 0.01659536, 0.0017333078, -0.00727924, -0.0020026069, -0.0012493852, 0.031441092, 0.0017431005, 0.008702445, -0.0072335405, -0.020081561, -... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-27 | -0.021792019, 0.013657551, -0.01872364, 0.009100681, -0.0079582, -0.011640254, -0.01093518, -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.013931... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-28 | -0.007690533, 0.058808424, -0.0016859764, -0.0044622063, -0.0037734534, 0.01578583, -0.0018459238, -0.1196015, -0.0007075225, 0.0030341048, 0.012306159, -0.0068483613, 0.01851473, 0.015315781, 0.031388864, -0.015563863, 0.04776226, -0.008199753, -0.02591801, 0.00546759, -0.004915935, 0.0050824108, 0.0027011528, -0.0092... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-29 | -0.00043455104, 0.008611047, 0.025748271, 0.022353467, -0.020747464, -0.015759716, 0.029038617, -0.000377631, -0.028725252, 0.018109964, -0.0016125311, -0.022719061, -0.009133324, -0.033060152, 0.011248547, -0.0019797573, -0.007181313, 0.0018867267, 0.0070899143, 0.004077027, 0.0055328747, -0.014245113, -0.021217514, -... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-30 | 0.009929797, 0.004609097, -0.03047488, 0.002688096, -0.07264877, 0.024455635, -0.020930262, -0.015381066, -0.0033148287, 0.027236762, 0.0014501355, -0.014101488, -0.024076983, 0.026218321, -0.009009283, 0.019624569, 0.0020646274, -0.009081096, -0.01565526, -0.003358896, 0.048571788, -0.004857179, 0.022444865, 0.0241814... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-31 | -0.004432828, -0.032746784, 0.025513247, -0.0025852725, 0.014467081, -0.008617575, -0.019755138, 0.003966043, -0.0033915383, 0.0004088452, -0.025173767, 0.02796795, 0.0023763615, 0.0052358294, 0.017796598, 0.014806561, 0.0150024155, -0.005859298, 0.01259994, 0.021726735, -0.026466403, -0.017457118, -0.0025493659, 0.007... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-32 | 0.0037734534, 0.020394927, -0.00021931567, 0.0041814824, 0.025121538, -0.036246043, -0.019428715, -0.023802789, 0.014845733, 0.015420238, 0.019650683, 0.008186696, 0.025304336, -0.03204171, 0.01774437, 0.0021233836, -0.008434778, -0.0059441687, 0.038335152, 0.022653777, -0.0066002794, 0.02149171, 0.015093814, 0.0253826... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-33 | 0.0013946436, 0.00025726235, 0.008016956, -0.0042565595, 0.008447835, 0.0038191527, -0.014702106, 0.02196176, 0.0052097156, -0.010869896, 0.0051640165, 0.030840475, -0.041468814, 0.009250836, -0.018997835, 0.020107675, 0.008421721, -0.016373392, 0.004602568, 0.0327729, -0.00812794, 0.001581521, 0.019350372, 0.016112253... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-34 | 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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
ec266acbe76a-35 | from langchain.chains import RetrievalQAWithSourcesChain
from langchain import OpenAI
with open("../../../state_of_the_union.txt") as f:
state_of_the_union = f.read()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
texts = text_splitter.split_text(state_of_the_union)
docsearch = Weaviate.fro... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/weaviate.html |
2fef3c296507-0 | .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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/zilliz.html |
2fef3c296507-1 | "password": ZILLIZ_CLOUD_PASSWORD,
"secure": True
}
)
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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/zilliz.html |
945c1877d1b0-0 | .ipynb
.pdf
SingleStoreDB vector search
SingleStoreDB vector search#
SingleStore DB is a high-performance distributed database that supports deployment both in the cloud and on-premises. For a significant duration, it has provided support for vector functions such as dot_product, thereby positioning itself as an ideal ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/singlestoredb.html |
945c1877d1b0-1 | docsearch = SingleStoreDB.from_documents(
docs,
embeddings,
table_name = "noteook", # use table with a custom name
)
query = "What did the president say about Ketanji Brown Jackson"
docs = docsearch.similarity_search(query) # Find documents that correspond to the query
print(docs[0].page_content)
previous
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/singlestoredb.html |
17e0bbe166dc-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
17e0bbe166dc-1 | # the score is a distance metric, so lower is better
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.1580758094... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
17e0bbe166dc-2 | docs = text_splitter.split_documents(documents)
docs[:5]
[Document(page_content='Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans. \n\nLast year COVID-19 kept us apart. This year we are finally together aga... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
17e0bbe166dc-3 | 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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
17e0bbe166dc-4 | 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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
17e0bbe166dc-5 | 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. ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
17e0bbe166dc-6 | 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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
17e0bbe166dc-7 | (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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
17e0bbe166dc-8 | Document(page_content='pizza is great', metadata={})
# same document has distance 0
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='... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
17e0bbe166dc-9 | index.build(10)
# docstore
documents = []
for i, text in enumerate(texts):
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_docstor... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/annoy.html |
2f2cd9f0c37d-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
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/qdrant.html |
2f2cd9f0c37d-1 | docs = text_splitter.split_documents(documents)
embeddings = OpenAIEmbeddings()
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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/qdrant.html |
2f2cd9f0c37d-2 | collection_name="my_documents",
)
Qdrant Cloud#
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 th... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/qdrant.html |
2f2cd9f0c37d-3 | found_docs = qdrant.similarity_search(query)
print(found_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 ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/qdrant.html |
2f2cd9f0c37d-4 | 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/examples/qdrant.html |
2f2cd9f0c37d-5 | 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/qdrant.html |
2f2cd9f0c37d-6 | retriever = qdrant.as_retriever()
retriever
VectorStoreRetriever(vectorstore=<langchain.vectorstores.qdrant.Qdrant object at 0x7fc4e5720a00>, search_type='similarity', search_kwargs={})
It might be also specified to use MMR as a search strategy, instead of similarity.
retriever = qdrant.as_retriever(search_type="mmr")
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/qdrant.html |
2f2cd9f0c37d-7 | Customizing Qdrant#
Qdrant stores your vector embeddings along with the optional JSON-like payload. Payloads are optional, but since LangChain assumes the embeddings are generated from the documents, we keep the context data, so you can extract the original texts as well.
By default, your document is going to be stored... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/qdrant.html |
f7aa214b1331-0 | .ipynb
.pdf
Hologres
Hologres#
Hologres is a unified real-time data warehousing service developed by Alibaba Cloud. You can use Hologres to write, update, process, and analyze large amounts of data in real time.
Hologres supports standard SQL syntax, is compatible with PostgreSQL, and supports most PostgreSQL functions... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/hologres.html |
f7aa214b1331-1 | export PG_PORT={port} # Optional, default is 80
export PG_DATABASE={db_name} # Optional, default is postgres
export PG_USER={username}
export PG_PASSWORD={password}
Then store your embeddings and documents into Hologres
import os
connection_string = Hologres.connection_string_from_db_params(
host=os.environ.get("PG... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/hologres.html |
f7aa214b1331-2 | previous
FAISS
next
LanceDB
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/hologres.html |
c95520b51c7a-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/sklearn.html |
c95520b51c7a-1 | persist_path = os.path.join(tempfile.gettempdir(), 'union.parquet')
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 Brow... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/sklearn.html |
c95520b51c7a-2 | )
print('A new instance of vector store was loaded from', persist_path)
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. ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/sklearn.html |
59bb4cf12b59-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/myscale.html |
59bb4cf12b59-1 | 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()
for d in docs:
d.metadata = {'some': 'metadata'}
docsearch = MyScale.from_documents... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/myscale.html |
59bb4cf12b59-2 | NOTE: Please be aware of SQL injection, this interface must not be directly called by end-user.
If you custimized your column_map under your setting, you search with filter like this:
from langchain.vectorstores import MyScale, MyScaleSettings
from langchain.document_loaders import TextLoader
loader = TextLoader('../..... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/myscale.html |
59bb4cf12b59-3 | Deleting your data#
docsearch.drop()
previous
<no title>
next
OpenSearch
Contents
Setting up envrionments
Get connection info and data schema
Filtering
Similarity search with score
Deleting your data
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/myscale.html |
0c38e6c875e9-0 | .ipynb
.pdf
AwaDB
Contents
Similarity search with score
Restore the table created and added data before
AwaDB#
AwaDB is an AI Native database for the search and storage of embedding vectors used by LLM Applications.
This notebook shows how to use functionality related to the AwaDB.
!pip install awadb
from langchain.t... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/awadb.html |
0c38e6c875e9-1 | Restore the table created and added data before#
AwaDB automatically persists added document data
If you can restore the table you created and added before, you can just do this as below:
awadb_client = awadb.Client()
ret = awadb_client.Load('langchain_awadb')
if ret : print('awadb load table success')
else:
print(... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/awadb.html |
5a7fed6b3c83-0 | .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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/chroma.html |
5a7fed6b3c83-1 | 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/chroma.html |
5a7fed6b3c83-2 | Initialize PeristedChromaDB#
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'
... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/chroma.html |
5a7fed6b3c83-3 | retriever.get_relevant_documents(query)[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 dedica... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/chroma.html |
5a7fed6b3c83-4 | ids=[document_id],
)
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 upda... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/chroma.html |
5ee3e7277e50-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... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/docarray_in_memory.html |
5ee3e7277e50-1 | 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/docarray_in_memory.html |
5ee3e7277e50-2 | Similarity search
Similarity search with score
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/docarray_in_memory.html |
56bd758afcb3-0 | .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 ... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/vectara.html |
56bd758afcb3-1 | print(found_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 his life to serve this country:... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/vectara.html |
56bd758afcb3-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.
Score: 0.7129974
Vectara as a Retriever#
Vectara, as all the other vector stores, is a LangChain Retriever, by using cosine simi... | rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/vectara.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.