id stringlengths 14 16 | text stringlengths 31 3.14k | source stringlengths 58 124 |
|---|---|---|
2946e19b4e2b-178 | that one\r\n Nigger Detective who threatened me.\r\n RON STALLWORTH\r\n Goddamn Coloreds sure know how to\r\n spoil a Celebration.\r\n \r\n Flip and Jimmy snort. Ron holds ... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/imsdb.html |
2946e19b4e2b-179 | RON STALLWORTH (CONT\'D)\r\n Cuz\' dat Niggah Coon, Gator Bait,\r\n Spade, Spook, Sambo, Spear Flippin\',\r\n Jungle Bunny, Mississippi Wind\r\n Chime...Detective is Ron Stallworth\r\n you Redneck, Racist Pecke... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/imsdb.html |
2946e19b4e2b-180 | CLOSE - Ron Stallworth\r\n KKK Member in Good Standing\r\n \r\n Patrice comes up from behind.\r\n CLOSE - PATRICE\r\n She pulls out a small handgun from her pocketbook.\r\n \r\n 2 - SHOT - PATRICE AND RON\r\n ... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/imsdb.html |
2946e19b4e2b-181 | HEAR a KNOCK on\r\n Ron\'s DOOR. Ron, who is startled, slowly rises. We HEAR\r\n another KNOCK.\r\n \r\n QUICK FLASHES - of a an OLD TIME KLAN RALLY. Ron moves\r\n quietly to pull out his SERVICE REVOLVER from the COUNTER\r\n DRAWER. WE HEAR ANOTHER K... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/imsdb.html |
2946e19b4e2b-182 | into The BLACK, Colorado Sky.\r\n OMITTED\r\n \r\n EXT. UVA CAMPUS - NIGHT\r\n \r\n WE SEE FOOTAGE of NEO-NAZIS, ALT RIGHT, THE KLAN, NEO-\r\n CONFEDERATES AND WHITE NATIONALISTS MARCHING, HOLDING UP\r\n THEIR TI... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/imsdb.html |
2946e19b4e2b-183 | previous
Image captions
next
Markdown
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 26, 2023. | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/imsdb.html |
85118b188b30-0 | .ipynb
.pdf
Azure Blob Storage Container
Contents
Specifying a prefix
Azure Blob Storage Container#
This covers how to load document objects from a container on Azure Blob Storage.
from langchain.document_loaders import AzureBlobStorageContainerLoader
#!pip install azure-storage-blob
loader = AzureBlobStorageContaine... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azure_blob_storage_container.html |
85118b188b30-1 | Contents
Specifying a prefix
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 26, 2023. | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/azure_blob_storage_container.html |
f68873634978-0 | .ipynb
.pdf
Sitemap Loader
Contents
Filtering sitemap URLs
Sitemap Loader#
Extends from the WebBaseLoader, this will load a sitemap from a given URL, and then scrape and load all the pages in the sitemap, returning each page as a document.
The scraping is done concurrently, using WebBaseLoader. There are reasonable ... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-1 | Document(page_content='\n\n\n\n\n\nWelcome to LangChain — 🦜🔗 LangChain 0.0.123\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSkip to main content\n\n\n\n\n\n\n\n\n\n\nCtrl+K\n\n\n\n\n\n\n\n\n\n\n\n\n🦜🔗 LangChain 0.0.123\n\n\n\nGetting Started\n\nQuickstart Guide\n\nMod... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-2 | LLM\nLLM Caching\nLLM Serialization\nToken Usage Tracking\n\n\nIntegrations\nAI21\nAleph Alpha\nAnthropic\nAzure OpenAI LLM Example\nBanana\nCerebriumAI LLM Example\nCohere\nDeepInfra LLM Example\nForefrontAI LLM Example\nGooseAI LLM Example\nHugging Face Hub\nManifest\nModal\nOpenAI\nPetals LLM Example\nPromptLayer Op... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-3 | File\nSubtitle Files\nTelegram\nUnstructured File Loader\nURL\nWeb Base\nWord Documents\nYouTube\n\n\n\n\nUtils\nKey Concepts\nGeneric Utilities\nBash\nBing Search\nGoogle Search\nGoogle Serper API\nIFTTT WebHooks\nPython REPL\nRequests\nSearxNG Search API\nSerpAPI\nWolfram Alpha\nZapier Natural Language Actions API\n\... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-4 | Started\nHow-To Guides\nGeneric Chains\nLoading from LangChainHub\nLLM Chain\nSequential Chains\nSerialization\nTransformation Chain\n\n\nUtility Chains\nAPI Chains\nSelf-Critique Chain with Constitutional AI\nBashChain\nLLMCheckerChain\nLLM Math\nLLMRequestsChain\nLLMSummarizationCheckerChain\nModeration\nPAL\nSQLite ... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-5 | Started\nKey Concepts\nHow-To Guides\nConversationBufferMemory\nConversationBufferWindowMemory\nEntity Memory\nConversation Knowledge Graph Memory\nConversationSummaryMemory\nConversationSummaryBufferMemory\nConversationTokenBufferMemory\nAdding Memory To an LLMChain\nAdding Memory to a Multi-Input Chain\nAdding Memory... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-6 | Essay\nQuestion Answering Benchmarking: State of the Union Address\nQA Generation\nQuestion Answering\nSQL Question Answering Benchmarking: Chinook\n\n\nModel Comparison\n\nReference\n\nInstallation\nIntegrations\nAPI References\nPrompts\nPromptTemplates\nExample Selector\n\n\nUtilities\nPython REPL\nSerpAPI\nSearxNG S... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-7 | Gallery\nDeployments\nTracing\nDiscord\nProduction Support\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n.rst\n\n\n\n\n\n\n\n.pdf\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nWelcome to LangChain\n\n\n\n\n Contents \n\n\n\nGetting Started\nModules\nUse Cases\nReference Docs\nLangChain Ecosy... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-8 | Example: Question Answering over Notion Database\n\n💬 Chatbots\n\nDocumentation\nEnd-to-end Example: Chat-LangChain\n\n🤖 Agents\n\nDocumentation\nEnd-to-end Example: GPT+WolframAlpha\n\n\nGetting Started#\nCheckout the below guide for a walkthrough of how to get started using LangChain to create an Language Model app... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-9 | chains, lots of integrations with other tools, and end-to-end chains for common applications.\nIndexes: Language models are often more powerful when combined with your own text data - this module covers best practices for doing exactly that.\nAgents: Agents involve an LLM making decisions about which Actions to take, t... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-10 | to fetch data to use in the generation step. Examples of this include summarization of long pieces of text and question/answering over specific data sources.\nQuestion Answering: Answering questions over specific documents, only utilizing the information in those documents to construct an answer. A type of Data Augment... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-11 | Ecosystem#\nGuides for how other companies/products can be used with LangChain\n\nLangChain Ecosystem\n\n\n\n\n\nAdditional Resources#\nAdditional collection of resources we think may be useful as you develop your application!\n\nLangChainHub: The LangChainHub is a place to share and explore other prompts, chains, and ... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-12 | Docs\nLangChain Ecosystem\nAdditional Resources\n\n\n\n\n\n\n\n\n\nBy Harrison Chase\n\n\n\n\n \n © Copyright 2023, Harrison Chase.\n \n\n\n\n\n Last updated on Mar 24, 2023.\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n', lookup_str='', metadata={'source': 'https://python.langchain.com/en/stable/', 'loc': 'https:/... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-13 | Filtering sitemap URLs#
Sitemaps can be massive files, with thousands of urls. Often you don’t need every single one of them. You can filter the urls by passing a list of strings or regex patterns to the url_filter parameter. Only urls that match one of the patterns will be loaded.
loader = SitemapLoader(
"https... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-14 | Document(page_content='\n\n\n\n\n\nWelcome to LangChain — 🦜🔗 LangChain 0.0.123\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSkip to main content\n\n\n\n\n\n\n\n\n\n\nCtrl+K\n\n\n\n\n\n\n\n\n\n\n\n\n🦜🔗 LangChain 0.0.123\n\n\n\nGetting Started\n\nQuickstart Guide\n\nMod... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-15 | Example\nForefrontAI LLM Example\nGooseAI LLM Example\nHugging Face Hub\nManifest\nModal\nOpenAI\nPetals LLM Example\nPromptLayer OpenAI\nSageMakerEndpoint\nSelf-Hosted Models via Runhouse\nStochasticAI\nWriter\n\n\nReference\n\n\nChat Models\nGetting Started\nHow-To Guides\nHow to use few shot examples\nHow to stream ... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-16 | ExampleSelector\nMaximal Marginal Relevance ExampleSelector\nNGram Overlap ExampleSelector\nSimilarity ExampleSelector\n\n\nOutput Parsers\nOutput Parsers\nCommaSeparatedListOutputParser\nOutputFixingParser\nPydanticOutputParser\nRetryOutputParser\nStructured Output Parser\n\n\n\n\nIndexes\nGetting Started\nDocument Lo... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-17 | Text Splitter\nRecursiveCharacterTextSplitter\nSpacy Text Splitter\ntiktoken (OpenAI) Length Function\nTiktokenText Splitter\n\n\nVectorstores\nGetting Started\nAtlasDB\nChroma\nDeep Lake\nElasticSearch\nFAISS\nMilvus\nOpenSearch\nPGVector\nPinecone\nQdrant\nRedis\nWeaviate\n\n\nRetrievers\nChatGPT Plugin Retriever\nVe... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-18 | Document\nChat Index\nGraph QA\nHypothetical Document Embeddings\nQuestion Answering with Sources\nQuestion Answering\nSummarization\nRetrieval Question/Answering\nRetrieval Question Answering with Sources\nVector DB Text Generation\nAPI Chains\nSelf-Critique Chain with Constitutional AI\nBashChain\nLLMCheckerChain\nLL... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-19 | Agent\n\n\nAgent Executors\nHow to combine agents and vectorstores\nHow to use the async API for Agents\nHow to create ChatGPT Clone\nHow to access intermediate steps\nHow to cap the max number of iterations\nHow to add SharedMemory to an Agent and its Tools\n\n\n\n\n\nUse Cases\n\nPersonal Assistants\nQuestion Answeri... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-20 | Ecosystem\nAI21 Labs\nAtlasDB\nBanana\nCerebriumAI\nChroma\nCohere\nDeepInfra\nDeep Lake\nForefrontAI\nGoogle Search Wrapper\nGoogle Serper Wrapper\nGooseAI\nGraphsignal\nHazy Research\nHelicone\nHugging Face\nMilvus\nModal\nNLPCloud\nOpenAI\nOpenSearch\nPetals\nPGVector\nPinecone\nPromptLayer\nQdrant\nRunhouse\nSearxN... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-21 | to LangChain\n\n\n\n\n Contents \n\n\n\nGetting Started\nModules\nUse Cases\nReference Docs\nLangChain Ecosystem\nAdditional Resources\n\n\n\n\n\n\n\n\nWelcome to LangChain#\nLangChain is a framework for developing applications powered by language models. We believe that the most powerful and differentiated application... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-22 | Memory is the concept of persisting state between calls of a chain/agent. LangChain provides a standard interface for memory, a collection of memory implementations, and examples of chains/agents that use memory.\nIndexes: Language models are often more powerful when combined with your own text data - this module cover... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-23 | to understand how to use LLMs to query data that is stored in a tabular format (csvs, SQL, dataframes, etc) you should read this page.\nInteracting with APIs: Enabling LLMs to interact with APIs is extremely powerful in order to give them more up-to-date information and allow them to take actions.\nExtraction: Extract ... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-24 | methods, etc. Whether implemented in LangChain or not!\nGallery: A collection of our favorite projects that use LangChain. Useful for finding inspiration or seeing how things were done in other applications.\nDeployments: A collection of instructions, code snippets, and template repositories for deploying LangChain app... | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-25 | \n\n\n\n\n Last updated on Mar 27, 2023.\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n', lookup_str='', metadata={'source': 'https://python.langchain.com/en/latest/', 'loc': 'https://python.langchain.com/en/latest/', 'lastmod': '2023-03-27T22:50:49.790324+00:00', 'changefreq': 'daily', 'priority': '0.9'}, lookup_index=0) | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
f68873634978-26 | previous
s3 File
next
Slack (Local Exported Zipfile)
Contents
Filtering sitemap URLs
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Apr 26, 2023. | /content/https://python.langchain.com/en/latest/modules/indexes/document_loaders/examples/sitemap.html |
69f1add1e098-0 | .ipynb
.pdf
Getting Started
Contents
Add texts
From Documents
Getting Started#
This notebook showcases basic functionality related to VectorStores. A key part of working with vectorstores is creating the vector to put in them, which is usually created via embeddings. Therefore, it is recommended that you familiarize ... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/getting_started.html |
69f1add1e098-1 | We cannot let this happen.
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: Justi... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/getting_started.html |
69f1add1e098-2 | documents = text_splitter.create_documents([state_of_the_union], metadatas=[{"source": "State of the Union"}])
docsearch = Chroma.from_documents(documents, embeddings)
query = "What did the president say about Ketanji Brown Jackson"
docs = docsearch.similarity_search(query)
Running Chroma using direct local API.
Using ... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/getting_started.html |
cedd2ca340c6-0 | .ipynb
.pdf
Pinecone
Pinecone#
This notebook shows how to use functionality related to the Pinecone vector database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Pinecone
from langchain.document_loaders import TextL... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pinecone.html |
887e2c9d202a-0 | .ipynb
.pdf
Zilliz
Zilliz#
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: https://zilliz.com/cloud
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterText... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/zilliz.html |
8d1c9d4cf776-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
Maximum marginal relevance search (MMR)
Qdrant as a Retriever
Customizing Qdrant
Qdrant#
This notebo... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
8d1c9d4cf776-1 | In-memory#
For some testing scenarios and quick experiments, you may prefer to keep all the data in memory only, so it gets lost when the client is destroyed - usually at the end of your script/notebook.
qdrant = Qdrant.from_documents(
docs, embeddings,
location=":memory:", # Local mode with in-memory storage... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
8d1c9d4cf776-2 | url = "<---qdrant cloud cluster url here --->"
api_key = "<---api key here--->"
qdrant = Qdrant.from_documents(
docs, embeddings,
url, prefer_grpc=True, api_key=api_key,
collection_name="my_documents",
)
Reusing the same collection#
Both Qdrant.from_texts and Qdrant.from_documents methods are great to sta... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
8d1c9d4cf776-3 | 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:... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
8d1c9d4cf776-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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
8d1c9d4cf776-5 | One of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court.
And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of ... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
8d1c9d4cf776-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")
... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
8d1c9d4cf776-7 | 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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
8d1c9d4cf776-8 | "metadata": {
"foo": "bar"
}
}
You can, however, decide to use different keys for the page content and metadata. That’s useful if you already have a collection that you’d like to reuse. You can always change the
Qdrant.from_documents(
docs, embeddings,
location=":memory:",
collection_name="my_d... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/qdrant.html |
9479406f4869-0 | .ipynb
.pdf
SupabaseVectorStore
Contents
Similarity search with score
Retriever options
Maximal Marginal Relevance Searches
SupabaseVectorStore#
This notebook shows how to use Supabase and pgvector as your VectorStore.
To run this notebook, please ensure:
the pgvector extension is enabled
you have installed the supab... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
9479406f4869-1 | LIMIT match_count;
END;
$$;
# with pip
# !pip install supabase
# with conda
# !conda install -c conda-forge supabase
# If you're storing your Supabase and OpenAI API keys in a .env file, you can load them with dotenv
from dotenv import load_dotenv
load_dotenv()
True
import os
from supabase.client import C... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
9479406f4869-2 | vector_store = SupabaseVectorStore.from_documents(
docs, embeddings, client=supabase
)
query = "What did the president say about Ketanji Brown Jackson"
matched_docs = vector_store.similarity_search(query)
print(matched_docs[0].page_content)
Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the Jo... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
9479406f4869-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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
9479406f4869-4 | print(d.page_content)
## Document 0
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 countr... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
9479406f4869-5 | He was born a soldier. Army National Guard. Combat medic in Kosovo and Iraq.
Stationed near Baghdad, just yards from burn pits the size of football fields.
Heath’s widow Danielle is here with us tonight. They loved going to Ohio State football games. He loved building Legos with their daughter.
## Document 2
And I’m ... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
9479406f4869-6 | Officer Mora was 27 years old.
Officer Rivera was 22.
Both Dominican Americans who’d grown up on the same streets they later chose to patrol as police officers.
I spoke with their families and told them that we are forever in debt for their sacrifice, and we will carry on their mission to restore the trust and safet... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/supabase.html |
efc304d8b1b4-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
Chroma#
This notebook shows how to use functionality related to the Chroma vector database.
from langchain.embeddings.openai imp... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html |
efc304d8b1b4-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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html |
efc304d8b1b4-2 | docs[0]
(Document(page_content='In state after state, new laws have been passed, not only to suppress the vote, but to subvert entire elections. \n\nWe cannot let this happen. \n\nTonight. 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 Disc... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html |
efc304d8b1b4-3 | # Supplying a persist_directory will store the embeddings on disk
persist_directory = 'db'
embedding = OpenAIEmbeddings()
vectordb = Chroma.from_documents(documents=docs, embedding=embedding, persist_directory=persist_directory)
Running Chroma using direct local API.
No existing DB found in db, skipping load
No existin... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html |
efc304d8b1b4-4 | 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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/chroma.html |
524ebcbf5735-0 | .ipynb
.pdf
AtlasDB
AtlasDB#
This notebook shows you how to use functionality related to the AtlasDB
import time
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import SpacyTextSplitter
from langchain.vectorstores import AtlasDB
from langchain.document_loaders import TextLoader
!py... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/atlas.html |
524ebcbf5735-1 | A description for your project 508 datums inserted.
1 index built.
Projections
test_index_1677255228.136989_index. Status Completed. view online
Projection ID: db996d77-8981-48a0-897a-ff2c22bbf541
Hide embedded project
Explore on atlas.nomic.ai
previous
Annoy
next
Chroma
By Harrison... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/atlas.html |
b3205df28a51-0 | .ipynb
.pdf
AnalyticDB
AnalyticDB#
This notebook shows how to use functionality related to the AnalyticDB vector database.
To run, you should have an AnalyticDB instance up and running:
Using AnalyticDB Cloud Vector Database. Click here to fast deploy it.
from langchain.embeddings.openai import OpenAIEmbeddings
from la... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/analyticdb.html |
b3205df28a51-1 | host=os.environ.get("PG_HOST", "localhost"),
port=int(os.environ.get("PG_PORT", "5432")),
database=os.environ.get("PG_DATABASE", "postgres"),
user=os.environ.get("PG_USER", "postgres"),
password=os.environ.get("PG_PASSWORD", "postgres"),
)
vector_db = AnalyticDB.from_documents(
docs,
embeddings,... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/analyticdb.html |
bce4694dc16d-0 | .ipynb
.pdf
FAISS
Contents
Similarity Search with score
Saving and loading
Merging
FAISS#
This notebook shows how to use functionality related to the FAISS vector database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores im... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/faiss.html |
bce4694dc16d-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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/faiss.html |
bce4694dc16d-2 | docs_and_scores[0]
(Document(page_content='In state after state, new laws have been passed, not only to suppress the vote, but to subvert entire elections. \n\nWe cannot let this happen. \n\nTonight. 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, pa... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/faiss.html |
bce4694dc16d-3 | Saving and loading#
You can also save and load a FAISS index. This is useful so you don’t have to recreate it everytime you use it.
db.save_local("faiss_index")
new_db = FAISS.load_local("faiss_index", embeddings)
docs = new_db.similarity_search(query)
docs[0]
Document(page_content='In state after state, new laws have ... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/faiss.html |
bce4694dc16d-4 | Merging#
You can also merge two FAISS vectorstores
db1 = FAISS.from_texts(["foo"], embeddings)
db2 = FAISS.from_texts(["bar"], embeddings)
db1.docstore._dict
{'e0b74348-6c93-4893-8764-943139ec1d17': Document(page_content='foo', lookup_str='', metadata={}, lookup_index=0)}
db2.docstore._dict
{'bdc50ae3-a1bb-4678-9260-1b... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/faiss.html |
c9732770c5e3-0 | .ipynb
.pdf
ElasticSearch
ElasticSearch#
This notebook shows how to use functionality related to the ElasticSearch database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import ElasticVectorSearch
from langchain.document_l... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/elasticsearch.html |
c9732770c5e3-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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/elasticsearch.html |
04e8bdbc8483-0 | .ipynb
.pdf
Milvus
Milvus#
This notebook shows how to use functionality related to the Milvus vector database.
To run, you should have a Milvus instance up and running: https://milvus.io/docs/install_standalone-docker.md
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import Charac... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/milvus.html |
cac3181e62e9-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#
This notebook shows how to use functionality related to the Annoy vector database.
“Annoy (Approxima... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-1 | )
vector_store.similarity_search("food", k=3)
[Document(page_content='pizza is great', metadata={}),
Document(page_content='I love salad', metadata={}),
Document(page_content='my car', metadata={})]
# the score is a distance metric, so lower is better
vector_store.similarity_search_with_score("food", k=3)
[(Document(... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-2 | 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 again. \n\nTonight, we meet as Democrats Republican... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-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. ... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-7 | Create VectorStore via existing embeddings#
embs = embeddings_func.embed_documents(texts)
data = list(zip(texts, embs))
vector_store_from_embeddings = Annoy.from_embeddings(data, embeddings_func)
vector_store_from_embeddings.similarity_search_with_score("food", k=3)
[(Document(page_content='pizza is great', metadata={}... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-8 | (Document(page_content='pizza is great', metadata={}), 1.3254905939102173)]
Search via docstore id#
vector_store.index_to_docstore_id
{0: '2d1498a8-a37c-4798-acb9-0016504ed798',
1: '2d30aecc-88e0-4469-9d51-0ef7e9858e6d',
2: '927f1120-985b-4691-b577-ad5cb42e011c',
3: '3056ddcf-a62f-48c8-bd98-b9e57a3dfcae'}
some_docst... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-9 | saving config
loaded_vector_store = Annoy.load_local(
"my_annoy_index_and_docstore", embeddings=embeddings_func
)
# same document has distance 0
loaded_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 l... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
cac3181e62e9-10 | metadata = metadatas[i] if metadatas else {}
documents.append(Document(page_content=text, metadata=metadata))
index_to_docstore_id = {i: str(uuid.uuid4()) for i in range(len(documents))}
docstore = InMemoryDocstore(
{index_to_docstore_id[i]: doc for i, doc in enumerate(documents)}
)
db_manually = Annoy(
emb... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/annoy.html |
a13fd677f128-0 | .ipynb
.pdf
Redis
Contents
RedisVectorStoreRetriever
Redis#
This notebook shows how to use functionality related to the Redis vector database.
from langchain.embeddings import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores.redis import Redis
from langchain.docum... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/redis.html |
a13fd677f128-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 ... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/redis.html |
a13fd677f128-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.
RedisVectorStoreRetriever#
Here we go over different options for using the vector store as a retriever.
There are three differen... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/redis.html |
3265b8866b37-0 | .ipynb
.pdf
Weaviate
Weaviate#
This notebook shows how to use functionality related to the Weaviate vector database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Weaviate
from langchain.document_loaders import TextL... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html |
3265b8866b37-1 | "description": "The content of the paragraph",
"moduleConfig": {
"text2vec-openai": {
"skip": False,
"vectorizePropertyName": False
}
},
"name": "content",
... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/weaviate.html |
68b49ac5ecc5-0 | .ipynb
.pdf
MyScale
Contents
Setting up envrionments
Get connection info and data schema
Filtering
Deleting your data
MyScale#
This notebook shows how to use functionality related to the MyScale vector database.
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterText... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/myscale.html |
68b49ac5ecc5-1 | 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(docs, embeddings)
query = "What did the president say ... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/myscale.html |
68b49ac5ecc5-2 | Get connection info and data schema#
print(str(docsearch))
Filtering#
You can have direct access to myscale SQL where statement. You can write WHERE clause following standard SQL.
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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/myscale.html |
68b49ac5ecc5-3 | 0.252379834651947 {'doc_id': 6, 'some': ''} And I’m taking robus...
0.25022566318511963 {'doc_id': 1, 'some': ''} Groups of citizens b...
0.2469480037689209 {'doc_id': 8, 'some': ''} And so many families...
0.2428302764892578 {'doc_id': 0, 'some': 'metadata'} As Frances Haugen, w...
Deleting your data#
docsearch.drop()... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/myscale.html |
ca8da7fdfce9-0 | .ipynb
.pdf
OpenSearch
Contents
similarity_search using Approximate k-NN Search with Custom Parameters
similarity_search using Script Scoring with Custom Parameters
similarity_search using Painless Scripting with Custom Parameters
Using a preexisting OpenSearch instance
OpenSearch#
This notebook shows how to use func... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/opensearch.html |
ca8da7fdfce9-1 | query = "What did the president say about Ketanji Brown Jackson"
docs = docsearch.similarity_search(query)
print(docs[0].page_content)
similarity_search using Approximate k-NN Search with Custom Parameters#
docsearch = OpenSearchVectorSearch.from_documents(docs, embeddings, opensearch_url="http://localhost:9200", engin... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/opensearch.html |
ca8da7fdfce9-2 | query = "What did the president say about Ketanji Brown Jackson"
docs = docsearch.similarity_search("What did the president say about Ketanji Brown Jackson", search_type="painless_scripting", space_type="cosineSimilarity", pre_filter=filter)
print(docs[0].page_content)
Using a preexisting OpenSearch instance#
It’s also... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/opensearch.html |
35575b995100-0 | .ipynb
.pdf
PGVector
Contents
Similarity search with score
Similarity Search with Euclidean Distance (Default)
PGVector#
This notebook shows how to use functionality related to the Postgres vector database (PGVector).
## Loading Environment Variables
from typing import List, Tuple
from dotenv import load_dotenv
load_... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html |
35575b995100-1 | user=os.environ.get("PGVECTOR_USER", "postgres"),
password=os.environ.get("PGVECTOR_PASSWORD", "postgres"),
)
## Example
# postgresql+psycopg2://username:password@localhost:5432/database_name
Similarity search with score#
Similarity Search with Euclidean Distance (Default)#
# The PGVector Module will try to create ... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html |
35575b995100-2 | 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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html |
35575b995100-3 | --------------------------------------------------------------------------------
Score: 0.6076804780049968
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... | /content/https://python.langchain.com/en/latest/modules/indexes/vectorstores/examples/pgvector.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.