id
stringlengths
14
15
text
stringlengths
17
2.72k
source
stringlengths
47
115
fb1b9029f3b3-1
client = vectordb.Client() vector_store = Epsilla.from_documents( documents, embeddings, client, db_path="/tmp/mypath", db_name="MyDB", collection_name="MyCollection" ) query = "What did the president say about Ketanji Brown Jackson" docs = vector_store.similarity_search(query) print(docs[0].page_content) In state afte...
https://python.langchain.com/docs/integrations/vectorstores/epsilla
806d1e9ef3a4-0
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. Hologres supports online anal...
https://python.langchain.com/docs/integrations/vectorstores/hologres
9d6fefeef2e6-0
Faiss Facebook AI Similarity Search (Faiss) is a library for efficient similarity search and clustering of dense vectors. It contains algorithms that search in sets of vectors of any size, up to ones that possibly do not fit in RAM. It also contains supporting code for evaluation and parameter tuning. Faiss documentati...
https://python.langchain.com/docs/integrations/vectorstores/faiss
9d6fefeef2e6-1
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. Similarity Search with score​ There are some FAISS specific methods. One of them is similarity_search_with_score, which allows y...
https://python.langchain.com/docs/integrations/vectorstores/faiss
9d6fefeef2e6-2
docs = new_db.similarity_search(query) 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 ...
https://python.langchain.com/docs/integrations/vectorstores/faiss
9d6fefeef2e6-3
{'068c473b-d420-487a-806b-fb0ccea7f711': Document(page_content='foo', metadata={}), '807e0c63-13f6-4070-9774-5c6f0fbb9866': Document(page_content='bar', metadata={})} Similarity Search with filtering​ FAISS vectorstore can also support filtering, since the FAISS does not natively support filtering we have to do it manu...
https://python.langchain.com/docs/integrations/vectorstores/faiss
9d6fefeef2e6-4
list_of_documents = [ Document(page_content="foo", metadata=dict(page=1)), Document(page_content="bar", metadata=dict(page=1)), Document(page_content="foo", metadata=dict(page=2)), Document(page_content="barbar", metadata=dict(page=2)), Document(page_content="foo", metadata=dict(page=3)), Document(page_content="bar bur...
https://python.langchain.com/docs/integrations/vectorstores/faiss
9d6fefeef2e6-5
Content: bar, Metadata: {'page': 1} Here is an example of how to set fetch_k parameter when calling similarity_search. Usually you would want the fetch_k parameter >> k parameter. This is because the fetch_k parameter is the number of documents that will be fetched before filtering. If you set fetch_k to a low number, ...
https://python.langchain.com/docs/integrations/vectorstores/faiss
8fe6552faa14-0
This notebook shows how to use functionality related to the LanceDB vector database based on the Lance data format. We want to use OpenAIEmbeddings so we have to get the OpenAI API Key. import lancedb db = lancedb.connect("/tmp/lancedb") table = db.create_table( "my_table", data=[ { "vector": embeddings.embed_query("...
https://python.langchain.com/docs/integrations/vectorstores/lancedb
8fe6552faa14-1
I ask Democrats and Republicans alike: Pass my budget and keep our neighborhoods safe. And I will keep doing everything in my power to crack down on gun trafficking and ghost guns you can buy online and make at home—they have no serial numbers and can’t be traced. And I ask Congress to pass proven measures to reduc...
https://python.langchain.com/docs/integrations/vectorstores/lancedb
8fe6552faa14-2
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.
https://python.langchain.com/docs/integrations/vectorstores/lancedb
711af5008774-0
Marqo This notebook shows how to use functionality related to the Marqo vectorstore. Marqo is an open-source vector search engine. Marqo allows you to store and query multimodal data such as text and images. Marqo creates the vectors for you using a huge selection of opensource models, you can also provide your own fin...
https://python.langchain.com/docs/integrations/vectorstores/marqo
711af5008774-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 ...
https://python.langchain.com/docs/integrations/vectorstores/marqo
711af5008774-2
# incase the demo is re-run try: client.delete_index(index_name) except Exception: print(f"Creating {index_name}") # This index could have been created by another system settings = {"treat_urls_and_pointers_as_images": True, "model": "ViT-L/14"} client.create_index(index_name, **settings) client.index(index_name).add_...
https://python.langchain.com/docs/integrations/vectorstores/marqo
711af5008774-3
# This index could have been created by another system client.create_index(index_name) client.index(index_name).add_documents( [ { "Title": "Smartphone", "Description": "A smartphone is a portable computer device that combines mobile telephone " "functions and computing functions into one unit.", }, { "Title": "Telepho...
https://python.langchain.com/docs/integrations/vectorstores/marqo
711af5008774-4
print(doc_results[0].page_content) This is a document that is about elephants Weighted Queries​ We also expose marqos weighted queries which are a powerful way to compose complex semantic searches. query = {"communications devices": 1.0} doc_results = docsearch.similarity_search(query) print(doc_results[0].page_content...
https://python.langchain.com/docs/integrations/vectorstores/marqo
ae6c4b0fdd74-0
Google Vertex AI MatchingEngine This notebook shows how to use functionality related to the GCP Vertex AI MatchingEngine vector database. Vertex AI Matching Engine provides the industry's leading high-scale low latency vector database. These vector databases are commonly referred to as vector similarity-matching or an ...
https://python.langchain.com/docs/integrations/vectorstores/matchingengine
ae6c4b0fdd74-1
# Change this if you need the VPC to be created. CREATE_VPC = False # Set the project id gcloud config set project {PROJECT_ID} # Remove the if condition to run the encapsulated code if CREATE_VPC: # Create a VPC network gcloud compute networks create {VPC_NETWORK} --bgp-routing-mode=regional --subnet-mode=auto --proje...
https://python.langchain.com/docs/integrations/vectorstores/matchingengine
ae6c4b0fdd74-2
with open("data.json", "w") as f: json.dump(initial_config, f) gsutil cp data.json {EMBEDDING_DIR}/file.json aiplatform.init(project=PROJECT_ID, location=REGION, staging_bucket=BUCKET_URI) Creating Index​ my_index = aiplatform.MatchingEngineIndex.create_tree_ah_index( display_name=DISPLAY_NAME, contents_delta_uri=EMBED...
https://python.langchain.com/docs/integrations/vectorstores/matchingengine
848a0967d864-0
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 running. We want to use O...
https://python.langchain.com/docs/integrations/vectorstores/milvus
6a4ee69f16de-0
Meilisearch Meilisearch is an open-source, lightning-fast, and hyper relevant search engine. It comes with great defaults to help developers build snappy search experiences. You can self-host Meilisearch or run on Meilisearch Cloud. Meilisearch v1.3 supports vector search. This page guides you through integrating Meil...
https://python.langchain.com/docs/integrations/vectorstores/meilisearch
6a4ee69f16de-1
os.environ["MEILI_HTTP_ADDR"] = getpass.getpass("Meilisearch HTTP address and port:") os.environ["MEILI_MASTER_KEY"] = getpass.getpass("Meilisearch API Key:") We want to use OpenAIEmbeddings so we have to get the OpenAI API Key. os.environ["OPENAI_API_KEY"] = getpass.getpass("OpenAI API Key:") Adding text and embedding...
https://python.langchain.com/docs/integrations/vectorstores/meilisearch
6a4ee69f16de-2
client = meilisearch.Client(url="http://127.0.0.1:7700", api_key="***") vector_store = Meilisearch( embedding=embeddings, client=client, index_name="langchain_demo", text_key="text" ) vector_store.add_documents(documents) Similarity Search with score​ This specific method allows you to return the documents and the dist...
https://python.langchain.com/docs/integrations/vectorstores/meilisearch
96e0d4c3960a-0
MongoDB Atlas 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 embeddings in MongoDB documents, create a vector search index, and perform K...
https://python.langchain.com/docs/integrations/vectorstores/mongodb_atlas
96e0d4c3960a-1
# initialize MongoDB python client client = MongoClient(MONGODB_ATLAS_CLUSTER_URI) db_name = "langchain_db" collection_name = "langchain_col" collection = client[db_name][collection_name] index_name = "langchain_demo" # insert the documents in MongoDB Atlas with their embedding docsearch = MongoDBAtlasVectorSearch.fr...
https://python.langchain.com/docs/integrations/vectorstores/mongodb_atlas
17f2855cf2a8-0
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 related to the MyScale vector database. Setting up envrionments​ pip install clickhouse-connect We want to use OpenAIEmbeddings so we have to get the ...
https://python.langchain.com/docs/integrations/vectorstores/myscale
17f2855cf2a8-1
query = "What did the president say about Ketanji Brown Jackson" docs = docsearch.similarity_search(query) print(docs[0].page_content) Get connection info and data schema​ Filtering​ You can have direct access to myscale SQL where statement. You can write WHERE clause following standard SQL. NOTE: Please be aware of SQ...
https://python.langchain.com/docs/integrations/vectorstores/myscale
8074ad1d06d8-0
Neo4j Vector Index Neo4j is an open-source graph database with integrated support for vector similarity search It supports: approximate nearest neighbor search L2 distance and cosine distance This notebook shows how to use the Neo4j vector index (Neo4jVector). See the installation instruction. # Pip install necessary p...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector
8074ad1d06d8-1
Requirement already satisfied: certifi>=2017.4.17 in /home/tomaz/anaconda3/envs/myenv/lib/python3.11/site-packages (from requests>=2.20->openai) (2023.7.22) Requirement already satisfied: attrs>=17.3.0 in /home/tomaz/anaconda3/envs/myenv/lib/python3.11/site-packages (from aiohttp->openai) (23.1.0) Requirement already s...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector
8074ad1d06d8-2
Requirement already satisfied: charset-normalizer<4,>=2 in /home/tomaz/anaconda3/envs/myenv/lib/python3.11/site-packages (from requests>=2.26.0->tiktoken) (3.2.0) Requirement already satisfied: idna<4,>=2.5 in /home/tomaz/anaconda3/envs/myenv/lib/python3.11/site-packages (from requests>=2.26.0->tiktoken) (3.4) Requirem...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector
8074ad1d06d8-3
os.environ["OPENAI_API_KEY"] = getpass.getpass("OpenAI API Key:") from langchain.embeddings.openai import OpenAIEmbeddings from langchain.text_splitter import CharacterTextSplitter from langchain.vectorstores import Neo4jVector from langchain.document_loaders import TextLoader from langchain.docstore.document import Do...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector
8074ad1d06d8-4
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. -------------------------------------------------------------------------------- -----------------------------------------------...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector
8074ad1d06d8-5
We’re securing commitments and supporting partners in South and Central America to host more refugees and secure their own borders. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- Score: 0.891287088394165 A...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector
8074ad1d06d8-6
store = Neo4jVector.from_existing_index( OpenAIEmbeddings(), url=url, username=username, password=password, index_name=index_name, ) Add documents​ We can add documents to the existing vectorstore. store.add_documents([Document(page_content="foo")]) ['2f70679a-4416-11ee-b7c3-d46a6aa24f5b'] docs_with_score = store.simil...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector
8074ad1d06d8-7
return_only_outputs=True, ) {'answer': "The president honored Justice Stephen Breyer, who is retiring from the United States Supreme Court, and thanked him for his service. The president also mentioned that he nominated Circuit Court of Appeals Judge Ketanji Brown Jackson to continue Justice Breyer's legacy of excellen...
https://python.langchain.com/docs/integrations/vectorstores/neo4jvector
43d1023f68b3-0
OpenSearch OpenSearch is a scalable, flexible, and extensible open-source software suite for search, analytics, and observability applications licensed under Apache 2.0. OpenSearch is a distributed search and analytics engine based on Apache Lucene. This notebook shows how to use functionality related to the OpenSearch...
https://python.langchain.com/docs/integrations/vectorstores/opensearch
43d1023f68b3-1
# If using the default Docker installation, use this instantiation instead: # docsearch = OpenSearchVectorSearch.from_documents( # docs, # embeddings, # opensearch_url="https://localhost:9200", # http_auth=("admin", "admin"), # use_ssl = False, # verify_certs = False, # ssl_assert_hostname = False, # ssl_show_warn = Fa...
https://python.langchain.com/docs/integrations/vectorstores/opensearch
43d1023f68b3-2
query = "What did the president say about Ketanji Brown Jackson" docs = docsearch.similarity_search( "What did the president say about Ketanji Brown Jackson", k=1, search_type="script_scoring", ) print(docs[0].page_content) similarity_search using Painless Scripting​ similarity_search using Painless Scripting with Cust...
https://python.langchain.com/docs/integrations/vectorstores/opensearch
43d1023f68b3-3
service = 'aoss' # must set the service as 'aoss' region = 'us-east-2' credentials = boto3.Session(aws_access_key_id='xxxxxx',aws_secret_access_key='xxxxx').get_credentials() awsauth = AWS4Auth('xxxxx', 'xxxxxx', region,service, session_token=credentials.token) docsearch = OpenSearchVectorSearch.from_documents( docs, ...
https://python.langchain.com/docs/integrations/vectorstores/opensearch
6ea442208a3a-0
Postgres Embedding Postgres Embedding is an open-source vector similarity search for Postgres that uses Hierarchical Navigable Small Worlds (HNSW) for approximate nearest neighbor search. It supports: exact and approximate nearest neighbor search using HNSW L2 distance This notebook shows how to use the Postgres vector...
https://python.langchain.com/docs/integrations/vectorstores/pgembedding
6ea442208a3a-1
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) Working with vectorstore in Postgres​ Uploading a vec...
https://python.langchain.com/docs/integrations/vectorstores/pgembedding
6ea442208a3a-2
m: Defines the maximum number of bi-directional links (also referred to as "edges") created for each node during graph construction. The following additional index options are supported: efConstruction: Defines the number of nearest neighbors considered during index construction. The default value is 32. efsearch: Defi...
https://python.langchain.com/docs/integrations/vectorstores/pgembedding
6ea442208a3a-3
retriever = store.as_retriever() VectorStoreRetriever(vectorstore=<langchain.vectorstores.pghnsw.HNSWVectoreStore object at 0x121d3c8b0>, search_type='similarity', search_kwargs={}) db1 = PGEmbedding.from_existing_index( embedding=embeddings, collection_name=collection_name, pre_delete_collection=False, connection_stri...
https://python.langchain.com/docs/integrations/vectorstores/pgembedding
a822e2d9cc5f-0
This notebook shows how to use the Postgres vector database (PGVector). We want to use OpenAIEmbeddings so we have to get the OpenAI API Key. # PGVector needs the connection string to the database. CONNECTION_STRING = "postgresql+psycopg2://harrisonchase@localhost:5432/test3" # # Alternatively, you can create it from ...
https://python.langchain.com/docs/integrations/vectorstores/pgvector
a822e2d9cc5f-1
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. -------------------------------------------------------------------------------- -----------------------------------------------...
https://python.langchain.com/docs/integrations/vectorstores/pgvector
a822e2d9cc5f-2
And if we are to advance liberty and justice, we need to secure the Border and fix the immigration system. We can do both. At our border, we’ve installed new technology like cutting-edge scanners to better detect drug smuggling. We’ve set up joint patrols with Mexico and Guatemala to catch more human traffickers. ...
https://python.langchain.com/docs/integrations/vectorstores/pgvector
83997d0ea1ff-0
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 openai tiktoken langchain import os import getpass os.env...
https://python.langchain.com/docs/integrations/vectorstores/pinecone
83997d0ea1ff-1
query = "What did the president say about Ketanji Brown Jackson" docs = docsearch.similarity_search(query) print(docs[0].page_content) Adding More Text to an Existing Index​ More text can embedded and upserted to an existing Pinecone index using the add_texts function index = pinecone.Index("langchain-demo") vectorstor...
https://python.langchain.com/docs/integrations/vectorstores/pinecone
cde62f900797-0
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 points - vectors with an additional payload. Qdrant is tailored to extended filtering support. It makes it useful for all sorts of neural network or semantic-ba...
https://python.langchain.com/docs/integrations/vectorstores/qdrant
cde62f900797-1
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 vectors. The embeddings might be fully kepy in ...
https://python.langchain.com/docs/integrations/vectorstores/qdrant
cde62f900797-2
prefer_grpc=True, api_key=api_key, collection_name="my_documents", ) Recreating the collection​ Both Qdrant.from_texts and Qdrant.from_documents methods are great to start using Qdrant with Langchain. In the previous versions the collection was recreated every time you called any of them. That behaviour has changed. Cu...
https://python.langchain.com/docs/integrations/vectorstores/qdrant
cde62f900797-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 ...
https://python.langchain.com/docs/integrations/vectorstores/qdrant
cde62f900797-4
query = "What did the president say about Ketanji Brown Jackson" found_docs = qdrant.similarity_search_with_score(query, filter=rest.Filter(...)) Maximum marginal relevance search (MMR)​ If you'd like to look up for some similar documents, but you'd also like to receive diverse results, MMR is method you should conside...
https://python.langchain.com/docs/integrations/vectorstores/qdrant
cde62f900797-5
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.
https://python.langchain.com/docs/integrations/vectorstores/qdrant
cde62f900797-6
Qdrant as a Retriever​ Qdrant, as all the other vector stores, is a LangChain Retriever, by using cosine similarity. retriever = qdrant.as_retriever() retriever VectorStoreRetriever(vectorstore=<langchain.vectorstores.qdrant.Qdrant object at 0x7fc4e5720a00>, search_type='similarity', search_kwargs={}) It might be also...
https://python.langchain.com/docs/integrations/vectorstores/qdrant
cde62f900797-7
Named vectors​ Qdrant supports multiple vectors per point by named vectors. Langchain requires just a single embedding per document and, by default, uses a single vector. However, if you work with a collection created externally or want to have the named vector used, you can configure it by providing its name. Qdrant.f...
https://python.langchain.com/docs/integrations/vectorstores/qdrant
8edda8e85cae-0
Redis Redis vector database introduction and langchain integration guide. What is Redis?​ Most developers from a web services background are probably familiar with Redis. At it's core, Redis is an open-source key-value store that can be used as a cache, message broker, and database. Developers choice Redis because it i...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-1
redis-py Python MIT Redis node-redis Node.js MIT Redis nredisstack .NET MIT Redis Deployment Options​ There are many ways to deploy Redis with RediSearch. The easiest way to get started is to use Docker, but there are are many potential options for deployment such as Redis Cloud Docker (Redis Stack) Cloud marketp...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-2
os.environ["OPENAI_API_KEY"] = getpass.getpass("OpenAI API Key:") from langchain.embeddings import OpenAIEmbeddings embeddings = OpenAIEmbeddings() Sample Data​ First we will describe some sample data so that the various attributes of the Redis vector store can be demonstrated. metadata = [ { "user": "john", "age": 18...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-3
documents = [Document(page_content=t, metadata=m) for t, m in zip(texts, metadata)] rds = Redis.from_documents( documents, embeddings, redis_url="redis://localhost:6379", index_name="users" ) Inspecting the Created Index​ Once the Redis VectorStore object has been constructed, an index will have been created in Redis i...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-4
Index Information: ╭──────────────┬────────────────┬───────────────┬─────────────────┬────────────╮ │ Index Name │ Storage Type │ Prefixes │ Index Options │ Indexing │ ├──────────────┼────────────────┼───────────────┼─────────────────┼────────────┤ │ users │ HASH │ ['doc:users'] │ [] │ 0 │ ╰──────────────┴─────────────...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-5
Statistics: ╭─────────────────────────────┬─────────────╮ │ Stat Key │ Value │ ├─────────────────────────────┼─────────────┤ │ num_docs │ 5 │ │ num_terms │ 15 │ │ max_doc_id │ 5 │ │ num_records │ 33 │ │ percent_indexed │ 1 │ │ hash_indexing_failures │ 0 │ │ number_of_uses │ 4 │ │ bytes_per_record_avg │ 4.60606 │ │ doc_...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-6
meta = results[1].metadata print("Key of the document in Redis: ", meta.pop("id")) print("Metadata of the document: ", meta) Key of the document in Redis: doc:users:a70ca43b3a4e4168bae57c78753a200f Metadata of the document: {'user': 'derrick', 'job': 'doctor', 'credit_score': 'low', 'age': '45'} # with scores (distance...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-7
Content: foo --- Similarity: 1.0 Content: foo --- Similarity: 1.0 Content: foo --- Similarity: 1.0 # you can also add new documents as follows new_document = ["baz"] new_metadata = [{ "user": "sam", "age": 50, "job": "janitor", "credit_score": "high" }] # both the document and metadata must be lists rds.add_texts(new_d...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-8
dims: 1536 distance_metric: COSINE initial_cap: 20000 name: content_vector Notice, this include all possible fields for the schema. You can remove any fields that you don't need. # now we can connect to our existing index as follows
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-9
new_rds = Redis.from_existing_index( embeddings, index_name="users", redis_url="redis://localhost:6379", schema="redis_schema.yaml" ) results = new_rds.similarity_search("foo", k=3) print(results[0].metadata) {'id': 'doc:users:8484c48a032d4c4cbe3cc2ed6845fabb', 'user': 'john', 'job': 'engineer', 'credit_score': 'high',...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-10
rds, keys = Redis.from_texts_return_keys( texts, embeddings, metadatas=metadata, redis_url="redis://localhost:6379", index_name="users_modified", index_schema=index_schema, # pass in the new index schema ) `index_schema` does not match generated metadata schema. If you meant to manually override the schema, please igno...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-11
# numeric filtering age_is_18 = RedisNum("age") == 18 age_is_not_18 = RedisNum("age") != 18 age_is_greater_than_18 = RedisNum("age") > 18 age_is_less_than_18 = RedisNum("age") < 18 age_is_greater_than_or_equal_to_18 = RedisNum("age") >= 18 age_is_less_than_or_equal_to_18 = RedisNum("age") <= 18 The RedisFilter class c...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-12
for result in results: print("User:", result.metadata["user"], "is", result.metadata["age"]) User: derrick is 45 User: nancy is 94 User: joe is 35 # make sure to use parenthesis around FilterExpressions # if initializing them while constructing them age_range = (RedisNum("age") > 18) & (RedisNum("age") < 99) results = ...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-13
for result in results: print("Content:", result[0].page_content, " --- Score: ", result[1]) Content: foo --- Score: 0.0 Content: foo --- Score: 0.0 Content: foo --- Score: 0.0 retriever = rds.as_retriever(search_type="similarity", search_kwargs={"k": 4}) docs = retriever.get_relevant_documents(query) docs [Document(pag...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-14
Document(page_content='foo', metadata={'id': 'doc:users_modified:009b1afeb4084cc6bdef858c7a99b48e', 'user': 'derrick', 'job': 'doctor', 'credit_score': 'low', 'age': '45'}), Document(page_content='foo', metadata={'id': 'doc:users_modified:7087cee9be5b4eca93c30fbdd09a2731', 'user': 'nancy', 'job': 'doctor', 'credit_scor...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-15
Valid Redis Url scheme are: redis:// - Connection to Redis standalone, unencrypted rediss:// - Connection to Redis standalone, with TLS encryption redis+sentinel:// - Connection to Redis server via Redis Sentinel, unencrypted rediss+sentinel:// - Connection to Redis server via Redis Sentinel, booth connections with TLS...
https://python.langchain.com/docs/integrations/vectorstores/redis
8edda8e85cae-16
# connection to sentinel at localhost with default group mymaster and db 0, no password redis_url = "redis+sentinel://localhost:26379" # connection to sentinel at host redis with default port 26379 and user "joe" with password "secret" with default group mymaster and db 0 redis_url = "redis+sentinel://joe:secret@redis"...
https://python.langchain.com/docs/integrations/vectorstores/redis
37a715ec1525-0
ScaNN ScaNN (Scalable Nearest Neighbors) is a method for efficient vector similarity search at scale. ScaNN includes search space pruning and quantization for Maximum Inner Product Search and also supports other distance functions such as Euclidean distance. The implementation is optimized for x86 processors with AVX2 ...
https://python.langchain.com/docs/integrations/vectorstores/scann
37a715ec1525-1
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 country:...
https://python.langchain.com/docs/integrations/vectorstores/scann
9577cdbcccad-0
Rockset Rockset is a real-time search and analytics database built for the cloud. Rockset uses a Converged Index™ with an efficient store for vector embeddings to serve low latency, high concurrency search queries at scale. Rockset has full support for metadata filtering and handles real-time ingestion for constantly u...
https://python.langchain.com/docs/integrations/vectorstores/rockset
9577cdbcccad-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) 3. Insert Documents​ embeddings = OpenAIEmbeddings() # Verify OPENAI_API_KEY environment variable docsearch = Rockset(...
https://python.langchain.com/docs/integrations/vectorstores/rockset
9577cdbcccad-2
## # output length: 4 # 0.7651359650263554 {'source': '../../../state_of_the_union.txt'} Madam Speaker, Madam... # 0.7486265516824893 {'source': '../../../state_of_the_union.txt'} And I’m taking robus... # 0.7469625542348115 {'source': '../../../state_of_the_union.txt'} And so many families... # 0.7344177777547739 {'so...
https://python.langchain.com/docs/integrations/vectorstores/rockset
82354a158103-0
SingleStoreDB SingleStoreDB is a high-performance distributed SQL database that supports deployment both in the cloud and on-premises. It provides vector storage, and vector functions including dot_product and euclidean_distance, thereby supporting AI applications that require text similarity matching. This tutorial i...
https://python.langchain.com/docs/integrations/vectorstores/singlestoredb
cf7cec8a0245-0
scikit-learn scikit-learn is an open source collection of machine learning algorithms, including some implementations of the k nearest neighbors. SKLearnVectorStore wraps this implementation and adds the possibility to persist the vector store in json, bson (binary json) or Apache Parquet format. This notebook shows ho...
https://python.langchain.com/docs/integrations/vectorstores/sklearn
cf7cec8a0245-1
One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of...
https://python.langchain.com/docs/integrations/vectorstores/sklearn
4492ae6f4509-0
StarRocks StarRocks is a High-Performance Analytical Database. StarRocks is a next-gen sub-second MPP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics and ad-hoc query. Usually StarRocks is categorized into OLAP, and it has showed excellent performance in ClickBench — a ...
https://python.langchain.com/docs/integrations/vectorstores/starrocks
4492ae6f4509-1
update_vectordb = False API Reference: OpenAIEmbeddings StarRocks StarRocksSettings Chroma CharacterTextSplitter TokenTextSplitter DirectoryLoader RetrievalQA TextLoader UnstructuredMarkdownLoader /Users/dirlt/utils/py3env/lib/python3.9/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.7)...
https://python.langchain.com/docs/integrations/vectorstores/starrocks
4492ae6f4509-2
# tell vectordb to update text embeddings update_vectordb = True Document(page_content='Compile StarRocks with Docker\n\nThis topic describes how to compile StarRocks using Docker.\n\nOverview\n\nStarRocks provides development environment images for both Ubuntu 22.04 and CentOS 7.9. With the image, you can launch a Doc...
https://python.langchain.com/docs/integrations/vectorstores/starrocks
4492ae6f4509-3
Configuring StarRocks instance is pretty much like configuring mysql instance. You need to specify: host/port username(default: 'root') password(default: '') database(default: 'default') table(default: 'langchain') embeddings = OpenAIEmbeddings()
https://python.langchain.com/docs/integrations/vectorstores/starrocks
4492ae6f4509-4
# configure starrocks settings(host/port/user/pw/db) settings = StarRocksSettings() settings.port = 41003 settings.host = "127.0.0.1" settings.username = "root" settings.password = "" settings.database = "zya" docsearch = gen_starrocks(update_vectordb, embeddings, settings) print(docsearch) update_vectordb = False In...
https://python.langchain.com/docs/integrations/vectorstores/starrocks
37f5d5e493a1-0
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 already-existing tools and frameworks. PostgreSQL also known as Postgres, is a free and open-source relational database managemen...
https://python.langchain.com/docs/integrations/vectorstores/supabase
37f5d5e493a1-1
load_dotenv() import os from supabase.client import Client, create_client supabase_url = os.environ.get("SUPABASE_URL") supabase_key = os.environ.get("SUPABASE_SERVICE_KEY") supabase: Client = create_client(supabase_url, supabase_key) from langchain.embeddings.openai import OpenAIEmbeddings from langchain.text_splitte...
https://python.langchain.com/docs/integrations/vectorstores/supabase
37f5d5e493a1-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. Similarity search with score​ The returned distance score is cosine distance. Therefore, a lower score is better. matched_docs =...
https://python.langchain.com/docs/integrations/vectorstores/supabase
37f5d5e493a1-3
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://python.langchain.com/docs/integrations/vectorstores/supabase
37f5d5e493a1-4
While it shouldn’t have taken something so terrible for people around the world to see what’s at stake now everyone sees it clearly. ## Document 3 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 together. I recently visited the New York City Po...
https://python.langchain.com/docs/integrations/vectorstores/supabase
946bb18472e5-0
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 instances that are ba...
https://python.langchain.com/docs/integrations/vectorstores/tair
946bb18472e5-1
RuntimeError: Error loading ../../../state_of_the_union.txt Connect to Tair using the TAIR_URL environment variable export TAIR_URL="redis://{username}:{password}@{tair_address}:{tair_port}" or the keyword argument tair_url. Then store documents and embeddings into Tair. tair_url = "redis://localhost:6379" # drop fir...
https://python.langchain.com/docs/integrations/vectorstores/tair
946bb18472e5-2
vector_store = Tair.from_documents(docs, embeddings, tair_url=tair_url, index_params={"lexical_algorithm":"bm25"}) Tair Hybrid Search query = "What did the president say about Ketanji Brown Jackson" # hybrid_ratio: 0.5 hybrid search, 0.9999 vector search, 0.0001 text search kwargs = {"TEXT" : query, "hybrid_ratio" : 0....
https://python.langchain.com/docs/integrations/vectorstores/tair
41312aadf7ab-0
Tencent Cloud VectorDB Tencent Cloud VectorDB is a fully managed, self-developed, enterprise-level distributed database service designed for storing, retrieving, and analyzing multi-dimensional vector data. The database supports multiple index types and similarity calculation methods. A single index can support a vecto...
https://python.langchain.com/docs/integrations/vectorstores/tencentvectordb
0064c17e5be0-0
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 complexity of managing, operating, and synchronizing multiple tools, allowing you to focus on building great applications instead....
https://python.langchain.com/docs/integrations/vectorstores/tigris
0064c17e5be0-1
embeddings = OpenAIEmbeddings() vector_store = Tigris.from_documents(docs, embeddings, index_name="my_embeddings") Similarity Search​ query = "What did the president say about Ketanji Brown Jackson" found_docs = vector_store.similarity_search(query) print(found_docs) Similarity Search with score (vector distance)​ quer...
https://python.langchain.com/docs/integrations/vectorstores/tigris
5f4e50dc9d42-0
Typesense Typesense is an open source, in-memory search engine, that you can either self-host or run on Typesense Cloud. Typesense focuses on performance by storing the entire index in RAM (with a backup on disk) and also focuses on providing an out-of-the-box developer experience by simplifying available options and s...
https://python.langchain.com/docs/integrations/vectorstores/typesense
107a694eb3d6-0
USearch USearch is a Smaller & Faster Single-File Vector Search Engine USearch's base functionality is identical to FAISS, and the interface should look familiar if you have ever investigated Approximate Nearest Neigbors search. FAISS is a widely recognized standard for high-performance vector search engines. USearch a...
https://python.langchain.com/docs/integrations/vectorstores/usearch
107a694eb3d6-1
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. Similarity Search with score​ The similarity_search_with_score method allows you to return not only the documents but also the d...
https://python.langchain.com/docs/integrations/vectorstores/usearch