id
stringlengths
14
15
text
stringlengths
17
2.72k
source
stringlengths
47
115
5da393ee57c7-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.html
5da393ee57c7-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.html
5da393ee57c7-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.html
5da393ee57c7-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.html
d9aee4ecd873-0
Page Not Found We could not find what you were looking for. Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
https://python.langchain.com/docs/integrations/providers/www.reddit.com
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-4
Index Information: โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ Index Name โ”‚ Storage Type โ”‚ Prefixes โ”‚ Index Options โ”‚ Indexing โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ users โ”‚ HASH โ”‚ ['doc:users'] โ”‚ [] โ”‚ 0 โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€...
https://python.langchain.com/docs/integrations/vectorstores/redis.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
6cca510d489f-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.html
ed0773789dd4-0
This notebook goes over how to use Redis to store chat message history. [AIMessage(content='whats up?', additional_kwargs={}), HumanMessage(content='hi!', additional_kwargs={})]
https://python.langchain.com/docs/integrations/memory/redis_chat_message_history.html
bba11073a839-0
SerpAPI This notebook goes over how to use the SerpAPI component to search the web. from langchain.utilities import SerpAPIWrapper search = SerpAPIWrapper() search.run("Obama's first name?") 'Barack Hussein Obama II' Custom Parametersโ€‹ You can also customize the SerpAPI wrapper with arbitrary parameters. For example, i...
https://python.langchain.com/docs/integrations/tools/serpapi.html
cc20564cd66c-0
Self Hosted Embeddings Let's load the SelfHostedEmbeddings, SelfHostedHuggingFaceEmbeddings, and SelfHostedHuggingFaceInstructEmbeddings classes. from langchain.embeddings import ( SelfHostedEmbeddings, SelfHostedHuggingFaceEmbeddings, SelfHostedHuggingFaceInstructEmbeddings, ) import runhouse as rh # For an on-demand ...
https://python.langchain.com/docs/integrations/text_embedding/self-hosted.html
f092c8a9178f-0
Runhouse The Runhouse allows remote compute and data across environments and users. See the Runhouse docs. This example goes over how to use LangChain and Runhouse to interact with models hosted on your own GPU, or on-demand GPUs on AWS, GCP, AWS, or Lambda. Note: Code uses SelfHosted name instead of the Runhouse. from...
https://python.langchain.com/docs/integrations/llms/runhouse.html
f092c8a9178f-1
"\n\nLet's say we're talking sports teams who won the Super Bowl in the year Justin Beiber" You can also load more custom models through the SelfHostedHuggingFaceLLM interface: llm = SelfHostedHuggingFaceLLM( model_id="google/flan-t5-small", task="text2text-generation", hardware=gpu, ) llm("What is the capital of Germa...
https://python.langchain.com/docs/integrations/llms/runhouse.html
f092c8a9178f-2
llm = SelfHostedPipeline.from_pipeline(pipeline="models/pipeline.pkl", hardware=gpu)
https://python.langchain.com/docs/integrations/llms/runhouse.html
43849f22be32-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.html
43849f22be32-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.html
176ecdae61ee-0
Airtable from langchain.document_loaders import AirtableLoader Get your API key here. Get ID of your base here. Get your table ID from the table url as shown here. api_key = "xxx" base_id = "xxx" table_id = "xxx" loader = AirtableLoader(api_key, table_id, base_id) docs = loader.load() Returns each table row as dict. ev...
https://python.langchain.com/docs/integrations/document_loaders/airtable.html
7be12d94c618-0
Page Not Found We could not find what you were looking for. Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
https://python.langchain.com/docs/integrations/modules/indexes/vectorstores/examples/alibabacloud_opensearch.ipynb
997bc0e0c0b1-0
Page Not Found We could not find what you were looking for. Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
https://python.langchain.com/docs/integrations/providers/xingshaomin.xsm@alibaba-inc.com
5110e0f363f8-0
This notebook shows how to use functionality related to the AnalyticDB vector database. To run, you should have an AnalyticDB instance up and running: from langchain.document_loaders import TextLoader loader = TextLoader("../../../state_of_the_union.txt") documents = loader.load() text_splitter = CharacterTextSplitter...
https://python.langchain.com/docs/integrations/vectorstores/analyticdb.html
56b539a93455-0
Argilla Argilla is an open-source data curation platform for LLMs. Using Argilla, everyone can build robust language models through faster data curation using both human and machine feedback. We provide support for each step in the MLOps cycle, from data labeling to model monitoring. In this guide we will demonstrate h...
https://python.langchain.com/docs/integrations/callbacks/argilla.html
56b539a93455-1
if parse_version(rg.__version__) < parse_version("1.8.0"): raise RuntimeError( "`FeedbackDataset` is only available in Argilla v1.8.0 or higher, please " "upgrade `argilla` as `pip install argilla --upgrade`." ) dataset = rg.FeedbackDataset( fields=[ rg.TextField(name="prompt"), rg.TextField(name="response"), ], questi...
https://python.langchain.com/docs/integrations/callbacks/argilla.html
56b539a93455-2
llm = OpenAI(temperature=0.9, callbacks=callbacks) llm.generate(["Tell me a joke", "Tell me a poem"] * 3)
https://python.langchain.com/docs/integrations/callbacks/argilla.html
56b539a93455-3
LLMResult(generations=[[Generation(text='\n\nQ: What did the fish say when he hit the wall? \nA: Dam.', generation_info={'finish_reason': 'stop', 'logprobs': None})], [Generation(text='\n\nThe Moon \n\nThe moon is high in the midnight sky,\nSparkling like a star above.\nThe night so peaceful, so serene,\nFilling up the...
https://python.langchain.com/docs/integrations/callbacks/argilla.html
56b539a93455-4
'stop', 'logprobs': None})], [Generation(text="\n\nA poem for you\n\nOn a field of green\n\nThe sky so blue\n\nA gentle breeze, the sun above\n\nA beautiful world, for us to love\n\nLife is a journey, full of surprise\n\nFull of joy and full of surprise\n\nBe brave and take small steps\n\nThe future will be revealed wi...
https://python.langchain.com/docs/integrations/callbacks/argilla.html
56b539a93455-5
Scenario 2: Tracking an LLM in a chainโ€‹ Then we can create a chain using a prompt template, and then track the initial prompt and the final response in Argilla. from langchain.callbacks import ArgillaCallbackHandler, StdOutCallbackHandler from langchain.llms import OpenAI from langchain.chains import LLMChain from lang...
https://python.langchain.com/docs/integrations/callbacks/argilla.html
56b539a93455-6
argilla_callback = ArgillaCallbackHandler( dataset_name="langchain-dataset", api_url=os.environ["ARGILLA_API_URL"], api_key=os.environ["ARGILLA_API_KEY"], ) callbacks = [StdOutCallbackHandler(), argilla_callback] llm = OpenAI(temperature=0.9, callbacks=callbacks) template = """You are a playwright. Given the title of ...
https://python.langchain.com/docs/integrations/callbacks/argilla.html
56b539a93455-7
> Finished chain. [{'text': "\n\nDocumentary about Bigfoot in Paris focuses on the story of a documentary filmmaker and their search for evidence of the legendary Bigfoot creature in the city of Paris. The play follows the filmmaker as they explore the city, meeting people from all walks of life who have had encou...
https://python.langchain.com/docs/integrations/callbacks/argilla.html
56b539a93455-8
> Entering new AgentExecutor chain... I need to answer a historical question Action: Search Action Input: "who was the first president of the United States of America" Observation: George Washington Thought: George Washington was the first president Final Answer: George Washington was the first president of the United...
https://python.langchain.com/docs/integrations/callbacks/argilla.html
af657d88e6e9-0
AWS S3 Directory Amazon Simple Storage Service (Amazon S3) is an object storage service AWS S3 Directory This covers how to load document objects from an AWS S3 Directory object. from langchain.document_loaders import S3DirectoryLoader loader = S3DirectoryLoader("testing-hwc") Specifying a prefixโ€‹ You can also specify ...
https://python.langchain.com/docs/integrations/document_loaders/aws_s3_directory.html
b160f85171f0-0
Azure Blob Storage Container Azure Blob Storage is Microsoft's object storage solution for the cloud. Blob Storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that doesn't adhere to a particular data model or definition, such as text or binary data. Azure Blob Storage is des...
https://python.langchain.com/docs/integrations/document_loaders/azure_blob_storage_container.html
2bbd7a0c52ef-0
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. from langchain.text_splitter import CharacterTextSplitter from langchain.vectorstores import AwaDB from langchain.document_loaders import Text...
https://python.langchain.com/docs/integrations/vectorstores/awadb.html
2877dd23c105-0
AWS S3 File Amazon Simple Storage Service (Amazon S3) is an object storage service. AWS S3 Buckets This covers how to load document objects from an AWS S3 File object. from langchain.document_loaders import S3FileLoader loader = S3FileLoader("testing-hwc", "fake.docx") [Document(page_content='Lorem ipsum dolor sit amet...
https://python.langchain.com/docs/integrations/document_loaders/aws_s3_file.html
f8a9aeb5c0ac-0
Azure Blob Storage File Azure Files offers fully managed file shares in the cloud that are accessible via the industry standard Server Message Block (SMB) protocol, Network File System (NFS) protocol, and Azure Files REST API. This covers how to load document objects from a Azure Files. #!pip install azure-storage-blob...
https://python.langchain.com/docs/integrations/document_loaders/azure_blob_storage_file.html