id
stringlengths
14
15
text
stringlengths
23
2.21k
source
stringlengths
52
97
767d5b975f00-3
your application code.If running in Google Colab authenticate with google.colab.google.auth otherwise follow one of the supported methods to make sure that you Application Default Credentials are properly set.import sysif "google.colab" in sys.modules: from google.colab import auth as google_auth google_auth.auth...
https://python.langchain.com/docs/integrations/retrievers/google_cloud_enterprise_search
767d5b975f00-4
The ID of the data store you want to use. The project_id and search_engine_id parameters can be provided explicitly in the retriever's constructor or through the environment variables - PROJECT_ID and SEARCH_ENGINE_ID.You can also configure a number of optional parameters, including:max_documents - The maximum number o...
https://python.langchain.com/docs/integrations/retrievers/google_cloud_enterprise_search
767d5b975f00-5
At most 5 answers will be returnedmax_extractive_segment_count - The maximum number of extractive segments returned in each search result. Currently one segment will be returnedfilter - The filter expression that allows you filter the search results based on the metadata associated with the documents in the searched da...
https://python.langchain.com/docs/integrations/retrievers/google_cloud_enterprise_search
767d5b975f00-6
2 - Automatic query expansion built by the Search API.Configure and use the retriever with extractve segments​from langchain.retrievers import GoogleCloudEnterpriseSearchRetrieverPROJECT_ID = "<YOUR PROJECT ID>" # Set to your Project IDSEARCH_ENGINE_ID = "<YOUR SEARCH ENGINE ID>" # Set to your data store IDretrieve...
https://python.langchain.com/docs/integrations/retrievers/google_cloud_enterprise_search
3b0143863767-0
ChatGPT Plugin | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/chatgpt-plugin
3b0143863767-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/chatgpt-plugin
3b0143863767-2
typing import Listfrom langchain.docstore.document import Documentimport jsondef write_json(path: str, documents: List[Document]) -> None: results = [{"text": doc.page_content} for doc in documents] with open(path, "w") as f: json.dump(results, f, indent=2)write_json("foo.json", data)# STEP 3: Use# Ingest ...
https://python.langchain.com/docs/integrations/retrievers/chatgpt-plugin
3b0143863767-3
'score': 0.925571561}, lookup_index=0), Document(page_content='This is a document about something', lookup_str='', metadata={'id': '123_0', 'metadata': {'source': 'file', 'source_id': 'https://example.com/doc1', 'url': 'https://example.com/doc1', 'created_at': '1609502400.0', 'author': 'Alice', 'document_id': '123'...
https://python.langchain.com/docs/integrations/retrievers/chatgpt-plugin
9e5d720c0896-0
Cohere Reranker | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-2
base vector store retriever​Let's start by initializing a simple vector store retriever and storing the 2023 State of the Union speech (in chunks). We can set up the retriever to retrieve a high number (20) of docs.from langchain.text_splitter import RecursiveCharacterTextSplitterfrom langchain.embeddings import Open...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-3
preventing government shutdowns to protecting Asian-Americans from still-too-common hate crimes to reforming military justice. ---------------------------------------------------------------------------------------------------- Document 3: A former top litigator in private practice. A former federal public...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-4
know the neighborhood, and who can restore trust and safety. So let’s not abandon our streets. Or choose between safety and equal justice. ---------------------------------------------------------------------------------------------------- Document 6: Vice President Harris and I ran for office wi...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-5
years we were told that if we gave tax breaks to those at the very top, the benefits would trickle down to everyone else. But that trickle-down theory led to weaker economic growth, lower wages, bigger deficits, and the widest gap between those at the top and everyone else in nearly a century. Vice Pres...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-6
only to heart disease. ---------------------------------------------------------------------------------------------------- Document 11: He will never extinguish their love of freedom. He will never weaken the resolve of the free world. We meet tonight in an America that has lived through two of th...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-7
to finding out everything we can. Committed to military families like Danielle Robinson from Ohio. The widow of Sergeant First Class Heath Robinson. He was born a soldier. Army National Guard. Combat medic in Kosovo and Iraq. ------------------------------------------------------------------...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-8
done in a long time: build a better America. For more than two years, COVID-19 has impacted every decision in our lives and the life of the nation. And I know you’re tired, frustrated, and exhausted. But I also know this. ---------------------------------------------------------------------...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-9
suffering from nine respiratory cancers. ---------------------------------------------------------------------------------------------------- Document 19: I understand. I remember when my Dad had to leave our home in Scranton, Pennsylvania to find work. I grew up in a family where if the price of f...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-10
base_compressor=compressor, base_retriever=retriever)compressed_docs = compression_retriever.get_relevant_documents( "What did the president say about Ketanji Jackson Brown")pretty_print_docs(compressed_docs) Document 1: One of the most serious constitutional responsibilities a President has is nominating ...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
9e5d720c0896-11
And if we are to advance liberty and justice, we need to secure the Border and fix the immigration system.You can of course use this retriever within a QA pipelinefrom langchain.chains import RetrievalQAchain = RetrievalQA.from_chain_type( llm=OpenAI(temperature=0), retriever=compression_retriever)chain({"query": qu...
https://python.langchain.com/docs/integrations/retrievers/cohere-reranker
97078d20669d-0
Pinecone Hybrid Search | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/pinecone_hybrid_search
97078d20669d-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/pinecone_hybrid_search
97078d20669d-2
Here are the installation instructions.#!pip install pinecone-client pinecone-textimport osimport getpassos.environ["PINECONE_API_KEY"] = getpass.getpass("Pinecone API Key:")from langchain.retrievers import PineconeHybridSearchRetrieveros.environ["PINECONE_ENVIRONMENT"] = getpass.getpass("Pinecone Environment:")We want...
https://python.langchain.com/docs/integrations/retrievers/pinecone_hybrid_search
97078d20669d-3
embeddings and sparse encoders​Embeddings are used for the dense vectors, tokenizer is used for the sparse vectorfrom langchain.embeddings import OpenAIEmbeddingsembeddings = OpenAIEmbeddings()To encode the text to sparse values you can either choose SPLADE or BM25. For out of domain tasks we recommend using BM25.For...
https://python.langchain.com/docs/integrations/retrievers/pinecone_hybrid_search
97078d20669d-4
[00:02<00:00, 2.27s/it]Use Retriever​We can now use the retriever!result = retriever.get_relevant_documents("foo")result[0] Document(page_content='foo', metadata={})PreviousMetalNextPubMedSetup PineconeGet embeddings and sparse encodersLoad RetrieverAdd texts (if necessary)Use RetrieverCommunityDiscordTwitterGitH...
https://python.langchain.com/docs/integrations/retrievers/pinecone_hybrid_search
8c7b118da278-0
Chaindesk | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/chaindesk
8c7b118da278-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/chaindesk
8c7b118da278-2
Then your Datastores can be connected to ChatGPT via Plugins or any other Large Langue Model (LLM) via the Chaindesk API.This notebook shows how to use Chaindesk's retriever.First, you will need to sign up for Chaindesk, create a datastore, add some data and get your datastore api endpoint url. You need the API Key.Que...
https://python.langchain.com/docs/integrations/retrievers/chaindesk
8c7b118da278-3
help center—the one-stop shop for learning everything about building websites with Daftpage.Daftpage is the simplest way to create websites for all purposes in seconds. Without knowing how to code, and for free!Get StartedDaftpage is a new type of website builder that works like a doc.It makes website building easy, ...
https://python.langchain.com/docs/integrations/retrievers/chaindesk
8c7b118da278-4
Skeleton modeCant find the answer you're looking for?mail us at support@daftpage.comJoin the awesome Daftpage community on: 👾 DiscordDaftpageCopyright © 2022 Daftpage, Inc.All rights reserved.ProductPricingTemplatesHelp & SupportHelp CenterGetting startedBlogCompanyAboutRoadmapTwitterAffiliate Program👾 Discord",...
https://python.langchain.com/docs/integrations/retrievers/chaindesk
930fa87bfa4e-0
BM25 | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/bm25
930fa87bfa4e-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/bm25
930fa87bfa4e-2
[ Document(page_content="foo"), Document(page_content="bar"), Document(page_content="world"), Document(page_content="hello"), Document(page_content="foo bar"), ])Use Retriever​We can now use the retriever!result = retriever.get_relevant_documents("foo")result [Document(page_co...
https://python.langchain.com/docs/integrations/retrievers/bm25
d716d83358e3-0
Weaviate Hybrid Search | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/weaviate-hybrid
d716d83358e3-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/weaviate-hybrid
d716d83358e3-2
Document retriever = WeaviateHybridSearchRetriever( client=client, index_name="LangChain", text_key="text", attributes=[], create_schema_if_missing=True,)Add some data:docs = [ Document( metadata={ "title": "Embracing The Future: AI Unveiled", "author": "Dr. Rebecca Sim...
https://python.langchain.com/docs/integrations/retrievers/weaviate-hybrid
d716d83358e3-3
society at large.", ), Document( metadata={ "title": "Conscious Constructs: The Search for AI Sentience", "author": "Dr. Samuel Cortez", }, page_content="Dr. Cortez takes readers on a journey exploring the controversial topic of AI consciousness. The book provides compel...
https://python.langchain.com/docs/integrations/retrievers/weaviate-hybrid
d716d83358e3-4
'b83765f2-e5d2-471f-8c02-c3350ade4c4f']Do a hybrid search:retriever.get_relevant_documents("the ethical implications of AI") [Document(page_content='In her second book, Dr. Simmons delves deeper into the ethical considerations surrounding AI development and deployment. It is an eye-opening examination of the dilemma...
https://python.langchain.com/docs/integrations/retrievers/weaviate-hybrid
d716d83358e3-5
manner.', metadata={}), Document(page_content="In his follow-up to 'Symbiosis', Prof. Sterling takes a look at the subtle, unnoticed presence and influence of AI in our everyday lives. It reveals how AI has become woven into our routines, often without our explicit realization.", metadata={})]Do a hybrid search wit...
https://python.langchain.com/docs/integrations/retrievers/weaviate-hybrid
d716d83358e3-6
contributed 0.008064516129032258 to the score', 'score': '0.015877016'}}), Document(page_content='In her second book, Dr. Simmons delves deeper into the ethical considerations surrounding AI development and deployment. It is an eye-opening examination of the dilemmas faced by developers, policymakers, and society a...
https://python.langchain.com/docs/integrations/retrievers/weaviate-hybrid
e192fd5b7631-0
LOTR (Merger Retriever) | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/merger_retriever
e192fd5b7631-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/merger_retriever
e192fd5b7631-2
langchain.retrievers.document_compressors import DocumentCompressorPipelinefrom langchain.retrievers import ContextualCompressionRetriever# Get 3 diff embeddings.all_mini = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2")multi_qa_mini = HuggingFaceEmbeddings(model_name="multi-qa-MiniLM-L6-dot-v1")filter_embeddings ...
https://python.langchain.com/docs/integrations/retrievers/merger_retriever
e192fd5b7631-3
retriever_multi_qa])Remove redundant results from the merged retrievers.​# We can remove redundant results from both retrievers using yet another embedding.# Using multiples embeddings in diff steps could help reduce biases.filter = EmbeddingsRedundantFilter(embeddings=filter_embeddings)pipeline = DocumentCompressorP...
https://python.langchain.com/docs/integrations/retrievers/merger_retriever
e192fd5b7631-4
In brief: When models must access relevant information in the middle of long contexts, then tend to ignore the provided documents. See: https://arxiv.org/abs//2307.03172# You can use an additional document transformer to reorder documents after removing redudance.from langchain.document_transformers import LongContext...
https://python.langchain.com/docs/integrations/retrievers/merger_retriever
0da178c9509c-0
kNN | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/knn
0da178c9509c-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/knn
0da178c9509c-2
Document(page_content='bar', metadata={})]PreviousGoogle Cloud Enterprise SearchNextLOTR (Merger Retriever)Create New Retriever with TextsUse RetrieverCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc.
https://python.langchain.com/docs/integrations/retrievers/knn
b00519abbbd2-0
PubMed | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/pubmed
b00519abbbd2-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/pubmed
b00519abbbd2-2
nursing field has undergone notable changes over time and is projected to undergo further modifications in the future, owing to the advent of sophisticated technologies and growing healthcare needs. The advent of ChatGPT, an AI-powered language model, is expected to exert a significant influence on the nursing professi...
https://python.langchain.com/docs/integrations/retrievers/pubmed
6a6ad270345a-0
Arxiv | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/arxiv
6a6ad270345a-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/arxiv
6a6ad270345a-2
= ArxivRetriever(load_max_docs=2)docs = retriever.get_relevant_documents(query="1605.08386")docs[0].metadata # meta-information of the Document {'Published': '2016-05-26', 'Title': 'Heat-bath random walks with Markov bases', 'Authors': 'Caprice Stanley, Tobias Windisch', 'Summary': 'Graphs on lattice po...
https://python.langchain.com/docs/integrations/retrievers/arxiv
6a6ad270345a-3
getpass import getpassOPENAI_API_KEY = getpass() ········import osos.environ["OPENAI_API_KEY"] = OPENAI_API_KEYfrom langchain.chat_models import ChatOpenAIfrom langchain.chains import ConversationalRetrievalChainmodel = ChatOpenAI(model_name="gpt-3.5-turbo") # switch to 'gpt-4'qa = ConversationalRetrievalC...
https://python.langchain.com/docs/integrations/retrievers/arxiv
6a6ad270345a-4
depth, thermal, and IMU data. The approach uses the binding property of images to align each modality's embedding to image embeddings and achieve an emergent alignment across all modalities. This enables novel multimodal capabilities, including cross-modal retrieval, embedding-space arithmetic, and audio-to-image gener...
https://python.langchain.com/docs/integrations/retrievers/arxiv
6a6ad270345a-5
to evaluate its ability to encode and reason about compositional concepts. questions = [ "What are Heat-bath random walks with Markov base? Include references to answer.",]chat_history = []for question in questions: result = qa({"question": question, "chat_history": chat_history}) chat_history.append((ques...
https://python.langchain.com/docs/integrations/retrievers/arxiv
6a6ad270345a-6
& Heermann, D. W. (2010). Monte Carlo simulation in statistical physics: an introduction. Springer Science & Business Media. PreviousAmazon KendraNextAzure Cognitive SearchInstallationExamplesRunning retrieverQuestion Answering on factsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangCh...
https://python.langchain.com/docs/integrations/retrievers/arxiv
bedfadc9e0f7-0
Amazon Kendra | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/retrievers/amazon_kendra_retriever
bedfadc9e0f7-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversAmazon KendraArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArray RetrieverElasticSearch BM25Google Cloud Enterpr...
https://python.langchain.com/docs/integrations/retrievers/amazon_kendra_retriever
bedfadc9e0f7-2
Index RetrieverCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc.
https://python.langchain.com/docs/integrations/retrievers/amazon_kendra_retriever
055810621507-0
Vector stores | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/vectorstores/
055810621507-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesAlibaba Cloud OpenSearchAnalyticDBAnnoyAtlasAwaDBAzure Cognitive SearchCassandraChrom...
https://python.langchain.com/docs/integrations/vectorstores/
055810621507-2
creates large read-only file-based data structures that are mmapped into memory so that many processes may share the same data.📄� AtlasAtlas is a platform for interacting with both small and internet scale unstructured datasets by Nomic.📄� AwaDBAwaDB is an AI Native database for the search and storage of embe...
https://python.langchain.com/docs/integrations/vectorstores/
055810621507-3
Deep Lake as a Multi-Modal Vector Store that stores embeddings and their metadata including text, jsons, images, audio, video, and more. It saves the data locally, in your cloud, or on Activeloop storage. It performs hybrid search including embeddings and their attributes.📄� DocArrayHnswSearchDocArrayHnswSearch is...
https://python.langchain.com/docs/integrations/vectorstores/
055810621507-4
filtering and management of embeddings. Fully open source.📄� MarqoThis notebook shows how to use functionality related to the Marqo vectorstore.📄� MatchingEngineThis notebook shows how to use functionality related to the GCP Vertex AI MatchingEngine vector database.📄� MilvusMilvus is a database that stor...
https://python.langchain.com/docs/integrations/vectorstores/
055810621507-5
additional payload. Qdrant is tailored to extended filtering support. It makes it useful for all sorts of neural network or semantic-based matching, faceted search, and other applications.📄� RedisRedis (Remote Dictionary Server) is an in-memory data structure store, used as a distributed, in-memory key–value dat...
https://python.langchain.com/docs/integrations/vectorstores/
055810621507-6
TairTair is a cloud native in-memory database service developed by Alibaba Cloud.📄� TigrisTigris is an open source Serverless NoSQL Database and Search Platform designed to simplify building high-performance vector search applications.📄� TypesenseTypesense is an open source, in-memory search engine, that you ...
https://python.langchain.com/docs/integrations/vectorstores/
9051c1cc6979-0
Pinecone | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/vectorstores/pinecone
9051c1cc6979-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesAlibaba Cloud OpenSearchAnalyticDBAnnoyAtlasAwaDBAzure Cognitive SearchCassandraChrom...
https://python.langchain.com/docs/integrations/vectorstores/pinecone
9051c1cc6979-2
Here are the installation instructions.pip install pinecone-client openai tiktokenimport osimport getpassPINECONE_API_KEY = getpass.getpass("Pinecone API Key:")PINECONE_ENV = getpass.getpass("Pinecone Environment:")We want to use OpenAIEmbeddings so we have to get the OpenAI API Key.os.environ["OPENAI_API_KEY"] = getpa...
https://python.langchain.com/docs/integrations/vectorstores/pinecone
9051c1cc6979-3
"text")vectorstore.add_texts("More text!")Maximal Marginal Relevance Searches​In addition to using similarity search in the retriever object, you can also use mmr as retriever.retriever = docsearch.as_retriever(search_type="mmr")matched_docs = retriever.get_relevant_documents(query)for i, d in enumerate(matched_docs)...
https://python.langchain.com/docs/integrations/vectorstores/pinecone
68e2d9ca3c5f-0
DocArrayInMemorySearch | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/vectorstores/docarray_in_memory
68e2d9ca3c5f-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesAlibaba Cloud OpenSearchAnalyticDBAnnoyAtlasAwaDBAzure Cognitive SearchCassandraChrom...
https://python.langchain.com/docs/integrations/vectorstores/docarray_in_memory
68e2d9ca3c5f-2
import DocArrayInMemorySearchfrom langchain.document_loaders import TextLoaderdocuments = TextLoader("../../../state_of_the_union.txt").load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)docs = text_splitter.split_documents(documents)embeddings = OpenAIEmbeddings()db = DocArrayInMemorySearch.f...
https://python.langchain.com/docs/integrations/vectorstores/docarray_in_memory
68e2d9ca3c5f-3
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: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of ...
https://python.langchain.com/docs/integrations/vectorstores/docarray_in_memory
65a64c14a093-0
Supabase (Postgres) | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/vectorstores/supabase
65a64c14a093-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesAlibaba Cloud OpenSearchAnalyticDBAnnoyAtlasAwaDBAzure Cognitive SearchCassandraChrom...
https://python.langchain.com/docs/integrations/vectorstores/supabase
65a64c14a093-2
extension vector; -- Create a table to store your documents create table documents ( id bigserial primary key, content text, -- corresponds to Document.pageContent metadata jsonb, -- corresponds to Document.metadata embedding vector(1536) -- 1536 works for OpenAI embeddings, change i...
https://python.langchain.com/docs/integrations/vectorstores/supabase
65a64c14a093-3
embedding, 1 -(documents.embedding <=> query_embedding) AS similarity FROM documents ORDER BY documents.embedding <=> query_embedding LIMIT match_count; END; $$;# with pippip install supabase# with conda# !conda install -c conda-forge s...
https://python.langchain.com/docs/integrations/vectorstores/supabase
65a64c14a093-4
= TextLoader("../../../state_of_the_union.txt")documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)docs = text_splitter.split_documents(documents)embeddings = OpenAIEmbeddings()# We're using the default `documents` table here. You can modify this by passing in a `table_name` ...
https://python.langchain.com/docs/integrations/vectorstores/supabase
65a64c14a093-5
(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: Ju...
https://python.langchain.com/docs/integrations/vectorstores/supabase
65a64c14a093-6
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: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank...
https://python.langchain.com/docs/integrations/vectorstores/supabase
65a64c14a093-7
to finding out everything we can. Committed to military families like Danielle Robinson from Ohio. The widow of Sergeant First Class Heath Robinson. 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...
https://python.langchain.com/docs/integrations/vectorstores/supabase
65a64c14a093-8
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 Police...
https://python.langchain.com/docs/integrations/vectorstores/supabase
b3f08286718b-0
Vectara | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/vectorstores/vectara
b3f08286718b-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesAlibaba Cloud OpenSearchAnalyticDBAnnoyAtlasAwaDBAzure Cognitive SearchCassandraChrom...
https://python.langchain.com/docs/integrations/vectorstores/vectara
b3f08286718b-2
First let's ingest the documents using the from_documents() method: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)vectara = Vectara.from_documents( docs, embedding=...
https://python.langchain.com/docs/integrations/vectorstores/vectara
b3f08286718b-3
To use this, we added the add_files() method (and from_files()). Let's see this in action. We pick two PDF documents to upload: The "I have a dream" speech by Dr. KingChurchill's "We Shall Fight on the Beaches" speechimport tempfileimport urllib.requesturls = [ [ "https://www.gilderlehrman.org/sites/default/f...
https://python.langchain.com/docs/integrations/vectorstores/vectara
b3f08286718b-4
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: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Ju...
https://python.langchain.com/docs/integrations/vectorstores/vectara
b3f08286718b-5
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 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 App...
https://python.langchain.com/docs/integrations/vectorstores/vectara
b3f08286718b-6
'0'})query = "What did the president say about Ketanji Brown Jackson"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 fu...
https://python.langchain.com/docs/integrations/vectorstores/vectara
75b2d79c5eaf-0
FAISS | 🦜�🔗 Langchain
https://python.langchain.com/docs/integrations/vectorstores/faiss
75b2d79c5eaf-1
Skip to main content🦜�🔗 LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesAlibaba Cloud OpenSearchAnalyticDBAnnoyAtlasAwaDBAzure Cognitive SearchCassandraChrom...
https://python.langchain.com/docs/integrations/vectorstores/faiss
75b2d79c5eaf-2
langchain.vectorstores import FAISSfrom langchain.document_loaders import TextLoaderfrom langchain.document_loaders import TextLoaderloader = TextLoader("../../../state_of_the_union.txt")documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)docs = text_splitter.split_documents(...
https://python.langchain.com/docs/integrations/vectorstores/faiss
75b2d79c5eaf-3
The returned distance score is L2 distance. Therefore, a lower score is better.docs_and_scores = db.similarity_search_with_score(query)docs_and_scores[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 D...
https://python.langchain.com/docs/integrations/vectorstores/faiss
75b2d79c5eaf-4
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: Justice Stephen Breyer—an Army ve...
https://python.langchain.com/docs/integrations/vectorstores/faiss
75b2d79c5eaf-5
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 manually. This is done by first fetching more results than k and then filtering them. You can filter the documents based on meta...
https://python.langchain.com/docs/integrations/vectorstores/faiss
75b2d79c5eaf-6
Content: foo, Metadata: {'page': 4}, Score: 5.159960813797904e-15Now we make the same query call but we filter for only page = 1 results_with_scores = db.similarity_search_with_score("foo", filter=dict(page=1))for doc, score in results_with_scores: print(f"Content: {doc.page_content}, Metadata: {doc.metadata}, Score...
https://python.langchain.com/docs/integrations/vectorstores/faiss
75b2d79c5eaf-7
Search with scoreSaving and loadingMergingSimilarity Search with filteringCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright © 2023 LangChain, Inc.
https://python.langchain.com/docs/integrations/vectorstores/faiss