id
stringlengths
14
17
text
stringlengths
42
2.11k
4e9727215e95-2100
/const attributeInfo: AttributeInfo[] = [ { name: "genre", description: "The genre of the movie", type: "string or array of strings", }, { name: "year", description: "The year the movie was released", type: "number", }, { name: "director", description: "The director of the movie", type: ...
4e9727215e95-2101
// eslint-disable-next-line @typescript-eslint/no-explicit-any new (weaviate as any).ApiKey(process.env.WEAVIATE_API_KEY) : undefined,});const vectorStore = await WeaviateStore.fromDocuments(docs, embeddings, { client, indexName: "Test", textKey: "text", metadataKeys: ["year", "director", "rating", "genre"]...
4e9727215e95-2102
");const query2 = await selfQueryRetriever.getRelevantDocuments( "Which movies are directed by Greta Gerwig? ");console.log(query1, query2);API Reference:AttributeInfo from langchain/schema/query_constructorDocument from langchain/documentOpenAIEmbeddings from langchain/embeddings/openaiSelfQueryRetriever from langcha...
4e9727215e95-2103
This example shows how to intialize a SelfQueryRetriever with a vector store: import weaviate from "weaviate-ts-client";import { AttributeInfo } from "langchain/schema/query_constructor";import { Document } from "langchain/document";import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { SelfQueryRetri...
4e9727215e95-2104
/const docs = [ new Document({ pageContent: "A bunch of scientists bring back dinosaurs and mayhem breaks loose", metadata: { year: 1993, rating: 7.7, genre: "science fiction" }, }), new Document({ pageContent: "Leo DiCaprio gets lost in a dream within a dream within a dream within a ...", meta...
4e9727215e95-2105
/const attributeInfo: AttributeInfo[] = [ { name: "genre", description: "The genre of the movie", type: "string or array of strings", }, { name: "year", description: "The year the movie was released", type: "number", }, { name: "director", description: "The director of the movie", type: ...
4e9727215e95-2106
// eslint-disable-next-line @typescript-eslint/no-explicit-any new (weaviate as any).ApiKey(process.env.WEAVIATE_API_KEY) : undefined,});const vectorStore = await WeaviateStore.fromDocuments(docs, embeddings, { client, indexName: "Test", textKey: "text", metadataKeys: ["year", "director", "rating", "genre"]...
4e9727215e95-2107
API Reference:AttributeInfo from langchain/schema/query_constructorDocument from langchain/documentOpenAIEmbeddings from langchain/embeddings/openaiSelfQueryRetriever from langchain/retrievers/self_queryOpenAI from langchain/llms/openaiWeaviateStore from langchain/vectorstores/weaviateWeaviateTranslator from langchain/...
4e9727215e95-2108
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingTime-we...
4e9727215e95-2109
It is important to note that due to required metadata, all documents must be added to the backing vector store using the addDocuments method on the retriever, not the vector store itself.import { TimeWeightedVectorStoreRetriever } from "langchain/retrievers/time_weighted";import { MemoryVectorStore } from "langchain/ve...
4e9727215e95-2110
', metadata: {} }] */API Reference:TimeWeightedVectorStoreRetriever from langchain/retrievers/time_weightedMemoryVectorStore from langchain/vectorstores/memoryOpenAIEmbeddings from langchain/embeddings/openaiPreviousWeaviate Self Query RetrieverNextVector store-backed retrieverCommunityDiscordTwitterGitHubPythonJS/TSMo...
4e9727215e95-2111
It is important to note that due to required metadata, all documents must be added to the backing vector store using the addDocuments method on the retriever, not the vector store itself.import { TimeWeightedVectorStoreRetriever } from "langchain/retrievers/time_weighted";import { MemoryVectorStore } from "langchain/ve...
4e9727215e95-2112
ModulesData connectionRetrieversHow-toTime-weighted vector store retrieverTime-weighted vector store retrieverThis retriever uses a combination of semantic similarity and a time decay.The algorithm for scoring them is:semantic_similarity + (1.0 - decay_rate) ^ hours_passedNotably, hours_passed refers to the hours passe...
4e9727215e95-2113
It is important to note that due to required metadata, all documents must be added to the backing vector store using the addDocuments method on the retriever, not the vector store itself.import { TimeWeightedVectorStoreRetriever } from "langchain/retrievers/time_weighted";import { MemoryVectorStore } from "langchain/ve...
4e9727215e95-2114
Time-weighted vector store retrieverThis retriever uses a combination of semantic similarity and a time decay.The algorithm for scoring them is:semantic_similarity + (1.0 - decay_rate) ^ hours_passedNotably, hours_passed refers to the hours passed since the object in the retriever was last accessed, not since it was cr...
4e9727215e95-2115
It is important to note that due to required metadata, all documents must be added to the backing vector store using the addDocuments method on the retriever, not the vector store itself.import { TimeWeightedVectorStoreRetriever } from "langchain/retrievers/time_weighted";import { MemoryVectorStore } from "langchain/ve...
4e9727215e95-2116
The algorithm for scoring them is: semantic_similarity + (1.0 - decay_rate) ^ hours_passed Notably, hours_passed refers to the hours passed since the object in the retriever was last accessed, not since it was created. This means that frequently accessed objects remain "fresh." let score = (1.0 - this.decayRate) ** ...
4e9727215e95-2117
import { TimeWeightedVectorStoreRetriever } from "langchain/retrievers/time_weighted";import { MemoryVectorStore } from "langchain/vectorstores/memory";import { OpenAIEmbeddings } from "langchain/embeddings/openai";const vectorStore = new MemoryVectorStore(new OpenAIEmbeddings());const retriever = new TimeWeightedVecto...
4e9727215e95-2118
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingTime-we...
4e9727215e95-2119
await HNSWLib.fromDocuments(docs, new OpenAIEmbeddings());// Initialize a retriever wrapper around the vector storeconst vectorStoreRetriever = vectorStore.asRetriever();const docs = retriever.getRelevantDocuments("what did he say about ketanji brown jackson");Configuration​You can specify a maximum number of documents...
4e9727215e95-2120
Let's walk through an example.const vectorStore = ...const retriever = vectorStore.asRetriever();Here's a more end-to-end example:import { OpenAI } from "langchain/llms/openai";import { RetrievalQAChain } from "langchain/chains";import { HNSWLib } from "langchain/vectorstores/hnswlib";import { OpenAIEmbeddings } from "...
4e9727215e95-2121
ModulesData connectionRetrieversHow-toVector store-backed retrieverVector store-backed retrieverA vector store retriever is a retriever that uses a vector store to retrieve documents. It is a lightweight wrapper around the Vector Store class to make it conform to the Retriever interface. It uses the search methods imp...
4e9727215e95-2122
Let's walk through an example.const vectorStore = ...const retriever = vectorStore.asRetriever();Here's a more end-to-end example:import { OpenAI } from "langchain/llms/openai";import { RetrievalQAChain } from "langchain/chains";import { HNSWLib } from "langchain/vectorstores/hnswlib";import { OpenAIEmbeddings } from "...
4e9727215e95-2123
Vector store-backed retrieverA vector store retriever is a retriever that uses a vector store to retrieve documents. It is a lightweight wrapper around the Vector Store class to make it conform to the Retriever interface. It uses the search methods implemented by a vector store, like similarity search and MMR, to quer...
4e9727215e95-2124
Let's walk through an example.const vectorStore = ...const retriever = vectorStore.asRetriever();Here's a more end-to-end example:import { OpenAI } from "langchain/llms/openai";import { RetrievalQAChain } from "langchain/chains";import { HNSWLib } from "langchain/vectorstores/hnswlib";import { OpenAIEmbeddings } from "...
4e9727215e95-2125
It uses the search methods implemented by a vector store, like similarity search and MMR, to query the texts in the vector store. Once you construct a Vector store, it's very easy to construct a retriever. Let's walk through an example. const vectorStore = ...const retriever = vectorStore.asRetriever(); Here's a mor...
4e9727215e95-2126
ChatGPT Plugin Retriever Page Title: ChatGPT Plugin Retriever | 🦜️🔗 Langchain Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesR...
4e9727215e95-2127
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression RetrieverDataberry RetrieverHyDE RetrieverAmazon Kendra RetrieverMetal RetrieverRemote RetrieverS...
4e9727215e95-2128
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression RetrieverDataberry RetrieverHyDE RetrieverAmazon Kendra RetrieverMetal RetrieverRemote RetrieverS...
4e9727215e95-2129
ChatGPT Plugin RetrieverThis example shows how to use the ChatGPT Retriever Plugin within LangChain.To set up the ChatGPT Retriever Plugin, please follow instructions here.Usage​import { ChatGPTPluginRetriever } from "langchain/retrievers/remote";export const run = async () => { const retriever = new ChatGPTPluginRetr...
4e9727215e95-2130
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression Retrieve...
4e9727215e95-2131
This reduces the amount of distraction a subsequent chain has to deal with when parsing the retrieved documents and making its final judgements.Usage​This example shows how to intialize a ContextualCompressionRetriever with a vector store and a document compressor:import * as fs from "fs";import { OpenAI } from "langch...
4e9727215e95-2132
",});console.log({ res });API Reference:OpenAI from langchain/llms/openaiRecursiveCharacterTextSplitter from langchain/text_splitterRetrievalQAChain from langchain/chainsHNSWLib from langchain/vectorstores/hnswlibOpenAIEmbeddings from langchain/embeddings/openaiContextualCompressionRetriever from langchain/retrievers/c...
4e9727215e95-2133
This reduces the amount of distraction a subsequent chain has to deal with when parsing the retrieved documents and making its final judgements.Usage​This example shows how to intialize a ContextualCompressionRetriever with a vector store and a document compressor:import * as fs from "fs";import { OpenAI } from "langch...
4e9727215e95-2134
",});console.log({ res });API Reference:OpenAI from langchain/llms/openaiRecursiveCharacterTextSplitter from langchain/text_splitterRetrievalQAChain from langchain/chainsHNSWLib from langchain/vectorstores/hnswlibOpenAIEmbeddings from langchain/embeddings/openaiContextualCompressionRetriever from langchain/retrievers/c...
4e9727215e95-2135
This reduces the amount of distraction a subsequent chain has to deal with when parsing the retrieved documents and making its final judgements.Usage​This example shows how to intialize a ContextualCompressionRetriever with a vector store and a document compressor:import * as fs from "fs";import { OpenAI } from "langch...
4e9727215e95-2136
",});console.log({ res });API Reference:OpenAI from langchain/llms/openaiRecursiveCharacterTextSplitter from langchain/text_splitterRetrievalQAChain from langchain/chainsHNSWLib from langchain/vectorstores/hnswlibOpenAIEmbeddings from langchain/embeddings/openaiContextualCompressionRetriever from langchain/retrievers/c...
4e9727215e95-2137
This reduces the amount of distraction a subsequent chain has to deal with when parsing the retrieved documents and making its final judgements.Usage​This example shows how to intialize a ContextualCompressionRetriever with a vector store and a document compressor:import * as fs from "fs";import { OpenAI } from "langch...
4e9727215e95-2138
",});console.log({ res });API Reference:OpenAI from langchain/llms/openaiRecursiveCharacterTextSplitter from langchain/text_splitterRetrievalQAChain from langchain/chainsHNSWLib from langchain/vectorstores/hnswlibOpenAIEmbeddings from langchain/embeddings/openaiContextualCompressionRetriever from langchain/retrievers/c...
4e9727215e95-2139
This reduces the amount of distraction a subsequent chain has to deal with when parsing the retrieved documents and making its final judgements.Usage​This example shows how to intialize a ContextualCompressionRetriever with a vector store and a document compressor:import * as fs from "fs";import { OpenAI } from "langch...
4e9727215e95-2140
",});console.log({ res });API Reference:OpenAI from langchain/llms/openaiRecursiveCharacterTextSplitter from langchain/text_splitterRetrievalQAChain from langchain/chainsHNSWLib from langchain/vectorstores/hnswlibOpenAIEmbeddings from langchain/embeddings/openaiContextualCompressionRetriever from langchain/retrievers/c...
4e9727215e95-2141
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression Retrieve...
4e9727215e95-2142
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression RetrieverDataberry RetrieverHyDE RetrieverAmazon Kendra RetrieverMetal RetrieverRemote RetrieverS...
4e9727215e95-2143
ModulesData connectionRetrieversIntegrationsDataberry RetrieverOn this pageDataberry RetrieverThis example shows how to use the Databerry Retriever in a RetrievalQAChain to retrieve documents from a Databerry.ai datastore.Usage​import { DataberryRetriever } from "langchain/retrievers/databerry";export const run = async...
4e9727215e95-2144
ModulesData connectionRetrieversIntegrationsDataberry RetrieverOn this pageDataberry RetrieverThis example shows how to use the Databerry Retriever in a RetrievalQAChain to retrieve documents from a Databerry.ai datastore.Usage​import { DataberryRetriever } from "langchain/retrievers/databerry";export const run = async...
4e9727215e95-2145
This example shows how to use the Databerry Retriever in a RetrievalQAChain to retrieve documents from a Databerry.ai datastore. import { DataberryRetriever } from "langchain/retrievers/databerry";export const run = async () => { const retriever = new DataberryRetriever({ datastoreUrl: "https://api.databerry.ai/qu...
4e9727215e95-2146
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression Retrieve...
4e9727215e95-2147
By default, the HyDE class comes with some default prompts to use (see the paper for more details on them), but we can also create our own, which should have a single input variable {question}.Usage​import { OpenAI } from "langchain/llms/openai";import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { Me...
4e9727215e95-2148
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression RetrieverDataberry RetrieverHyDE RetrieverAmazon Kendra RetrieverMetal RetrieverRemote RetrieverS...
4e9727215e95-2149
By default, the HyDE class comes with some default prompts to use (see the paper for more details on them), but we can also create our own, which should have a single input variable {question}.Usage​import { OpenAI } from "langchain/llms/openai";import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { Me...
4e9727215e95-2150
ModulesData connectionRetrieversIntegrationsHyDE RetrieverHyDE RetrieverThis example shows how to use the HyDE Retriever, which implements Hypothetical Document Embeddings (HyDE) as described in this paper.At a high level, HyDE is an embedding technique that takes queries, generates a hypothetical answer, and then embe...
4e9727215e95-2151
");console.log(results);/*[ Document { pageContent: 'My favourite food is pasta. ', metadata: {} }]*/API Reference:OpenAI from langchain/llms/openaiOpenAIEmbeddings from langchain/embeddings/openaiMemoryVectorStore from langchain/vectorstores/memoryHydeRetriever from langchain/retrievers/hydeDocument from langchain/do...
4e9727215e95-2152
HyDE RetrieverThis example shows how to use the HyDE Retriever, which implements Hypothetical Document Embeddings (HyDE) as described in this paper.At a high level, HyDE is an embedding technique that takes queries, generates a hypothetical answer, and then embeds that generated document and uses that as the final exam...
4e9727215e95-2153
");console.log(results);/*[ Document { pageContent: 'My favourite food is pasta. ', metadata: {} }]*/API Reference:OpenAI from langchain/llms/openaiOpenAIEmbeddings from langchain/embeddings/openaiMemoryVectorStore from langchain/vectorstores/memoryHydeRetriever from langchain/retrievers/hydeDocument from langchain/do...
4e9727215e95-2154
import { OpenAI } from "langchain/llms/openai";import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { MemoryVectorStore } from "langchain/vectorstores/memory";import { HydeRetriever } from "langchain/retrievers/hyde";import { Document } from "langchain/document";const embeddings = new OpenAIEmbeddings(...
4e9727215e95-2155
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression Retrieve...
4e9727215e95-2156
It supports multiple languages and can understand complex queries, synonyms, and contextual meanings to provide highly relevant search results.Setup​npmYarnpnpmnpm i @aws-sdk/client-kendrayarn add @aws-sdk/client-kendrapnpm add @aws-sdk/client-kendraUsage​import { AmazonKendraRetriever } from "langchain/retrievers/amaz...
4e9727215e95-2157
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression RetrieverDataberry RetrieverHyDE RetrieverAmazon Kendra RetrieverMetal RetrieverRemote RetrieverS...
4e9727215e95-2158
It supports multiple languages and can understand complex queries, synonyms, and contextual meanings to provide highly relevant search results.Setup​npmYarnpnpmnpm i @aws-sdk/client-kendrayarn add @aws-sdk/client-kendrapnpm add @aws-sdk/client-kendraUsage​import { AmazonKendraRetriever } from "langchain/retrievers/amaz...
4e9727215e95-2159
ModulesData connectionRetrieversIntegrationsAmazon Kendra RetrieverAmazon Kendra RetrieverAmazon Kendra is an intelligent search service provided by Amazon Web Services (AWS). It utilizes advanced natural language processing (NLP) and machine learning algorithms to enable powerful search capabilities across various dat...
4e9727215e95-2160
Amazon Kendra RetrieverAmazon Kendra is an intelligent search service provided by Amazon Web Services (AWS). It utilizes advanced natural language processing (NLP) and machine learning algorithms to enable powerful search capabilities across various data sources within an organization. Kendra is designed to help users ...
4e9727215e95-2161
With Kendra, users can search across a wide range of content types, including documents, FAQs, knowledge bases, manuals, and websites. It supports multiple languages and can understand complex queries, synonyms, and contextual meanings to provide highly relevant search results. npmYarnpnpmnpm i @aws-sdk/client-kendray...
4e9727215e95-2162
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression Retrieve...
4e9727215e95-2163
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression RetrieverDataberry RetrieverHyDE RetrieverAmazon Kendra RetrieverMetal RetrieverRemote RetrieverS...
4e9727215e95-2164
ModulesData connectionRetrieversIntegrationsMetal RetrieverMetal RetrieverThis example shows how to use the Metal Retriever in a RetrievalQAChain to retrieve documents from a Metal index.Setup​npmYarnpnpmnpm i @getmetal/metal-sdkyarn add @getmetal/metal-sdkpnpm add @getmetal/metal-sdkUsage​/* eslint-disable @typescript...
4e9727215e95-2165
Metal RetrieverThis example shows how to use the Metal Retriever in a RetrievalQAChain to retrieve documents from a Metal index.Setup​npmYarnpnpmnpm i @getmetal/metal-sdkyarn add @getmetal/metal-sdkpnpm add @getmetal/metal-sdkUsage​/* eslint-disable @typescript-eslint/no-non-null-assertion */import Metal from "@getmeta...
4e9727215e95-2166
yarn add @getmetal/metal-sdk pnpm add @getmetal/metal-sdk /* eslint-disable @typescript-eslint/no-non-null-assertion */import Metal from "@getmetal/metal-sdk";import { MetalRetriever } from "langchain/retrievers/metal";export const run = async () => { const MetalSDK = Metal; const client = new MetalSDK( process....
4e9727215e95-2167
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression Retrieve...
4e9727215e95-2168
const chain = RetrievalQAChain.fromLLM(model, retriever); // Call the chain with a query. const res = await chain.call({ query: "What did the president say about Justice Breyer? ", }); console.log({ res }); /* { res: { text: 'The president said that Justice Breyer was an Army veteran, Constitutional sch...
4e9727215e95-2169
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression RetrieverDataberry RetrieverHyDE RetrieverAmazon Kendra RetrieverMetal RetrieverRemote RetrieverS...
4e9727215e95-2170
const res = await chain.call({ query: "What did the president say about Justice Breyer? ", }); console.log({ res }); /* { res: { text: 'The president said that Justice Breyer was an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court and thanked him for his ...
4e9727215e95-2171
ModulesData connectionRetrieversIntegrationsRemote RetrieverRemote RetrieverThis example shows how to use a Remote Retriever in a RetrievalQAChain to retrieve documents from a remote server.Usage​import { OpenAI } from "langchain/llms/openai";import { RetrievalQAChain } from "langchain/chains";import { RemoteLangChainR...
4e9727215e95-2172
Remote RetrieverThis example shows how to use a Remote Retriever in a RetrievalQAChain to retrieve documents from a remote server.Usage​import { OpenAI } from "langchain/llms/openai";import { RetrievalQAChain } from "langchain/chains";import { RemoteLangChainRetriever } from "langchain/retrievers/remote";export const r...
4e9727215e95-2173
import { OpenAI } from "langchain/llms/openai";import { RetrievalQAChain } from "langchain/chains";import { RemoteLangChainRetriever } from "langchain/retrievers/remote";export const run = async () => { // Initialize the LLM to use to answer the question. const model = new OpenAI({}); // Initialize the remote retriev...
4e9727215e95-2174
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression Retrieve...
4e9727215e95-2175
The getRelevantDocuments function produces a list of documents that has duplicates removed and is sorted by relevance score.Setup​Install the library with​npmYarnpnpmnpm install -S @supabase/supabase-jsyarn add @supabase/supabase-jspnpm add @supabase/supabase-jsCreate a table and search functions in your database​Run t...
4e9727215e95-2176
where metadata @> filter order by documents.embedding <=> query_embedding limit match_count;end;$$;-- Create a function to keyword search for documentscreate function kw_match_documents(query_text text, match_count int)returns table (id bigint, content text, metadata jsonb, similarity real)as $$beginreturn query exec...
4e9727215e95-2177
similarityK: 2, keywordK: 2, tableName: "documents", similarityQueryName: "match_documents", keywordQueryName: "kw_match_documents", }); const results = await retriever.getRelevantDocuments("hello bye"); console.log(results);};API Reference:OpenAIEmbeddings from langchain/embeddings/openaiSupabaseHybridS...
4e9727215e95-2178
The getRelevantDocuments function produces a list of documents that has duplicates removed and is sorted by relevance score.Setup​Install the library with​npmYarnpnpmnpm install -S @supabase/supabase-jsyarn add @supabase/supabase-jspnpm add @supabase/supabase-jsCreate a table and search functions in your database​Run t...
4e9727215e95-2179
where metadata @> filter order by documents.embedding <=> query_embedding limit match_count;end;$$;-- Create a function to keyword search for documentscreate function kw_match_documents(query_text text, match_count int)returns table (id bigint, content text, metadata jsonb, similarity real)as $$beginreturn query exec...
4e9727215e95-2180
similarityK: 2, keywordK: 2, tableName: "documents", similarityQueryName: "match_documents", keywordQueryName: "kw_match_documents", }); const results = await retriever.getRelevantDocuments("hello bye"); console.log(results);};API Reference:OpenAIEmbeddings from langchain/embeddings/openaiSupabaseHybridS...
4e9727215e95-2181
The getRelevantDocuments function produces a list of documents that has duplicates removed and is sorted by relevance score.Setup​Install the library with​npmYarnpnpmnpm install -S @supabase/supabase-jsyarn add @supabase/supabase-jspnpm add @supabase/supabase-jsCreate a table and search functions in your database​Run t...
4e9727215e95-2182
where metadata @> filter order by documents.embedding <=> query_embedding limit match_count;end;$$;-- Create a function to keyword search for documentscreate function kw_match_documents(query_text text, match_count int)returns table (id bigint, content text, metadata jsonb, similarity real)as $$beginreturn query exec...
4e9727215e95-2183
similarityK: 2, keywordK: 2, tableName: "documents", similarityQueryName: "match_documents", keywordQueryName: "kw_match_documents", }); const results = await retriever.getRelevantDocuments("hello bye"); console.log(results);};API Reference:OpenAIEmbeddings from langchain/embeddings/openaiSupabaseHybridS...
4e9727215e95-2184
The getRelevantDocuments function produces a list of documents that has duplicates removed and is sorted by relevance score.Setup​Install the library with​npmYarnpnpmnpm install -S @supabase/supabase-jsyarn add @supabase/supabase-jspnpm add @supabase/supabase-jsCreate a table and search functions in your database​Run t...
4e9727215e95-2185
where metadata @> filter order by documents.embedding <=> query_embedding limit match_count;end;$$;-- Create a function to keyword search for documentscreate function kw_match_documents(query_text text, match_count int)returns table (id bigint, content text, metadata jsonb, similarity real)as $$beginreturn query exec...
4e9727215e95-2186
Supabase Hybrid SearchLangchain supports hybrid search with a Supabase Postgres database. The hybrid search combines the postgres pgvector extension (similarity search) and Full-Text Search (keyword search) to retrieve documents. You can add documents via SupabaseVectorStore addDocuments function. SupabaseHybridKeyWord...
4e9727215e95-2187
where metadata @> filter order by documents.embedding <=> query_embedding limit match_count;end;$$;-- Create a function to keyword search for documentscreate function kw_match_documents(query_text text, match_count int)returns table (id bigint, content text, metadata jsonb, similarity real)as $$beginreturn query exec...
4e9727215e95-2188
Langchain supports hybrid search with a Supabase Postgres database. The hybrid search combines the postgres pgvector extension (similarity search) and Full-Text Search (keyword search) to retrieve documents. You can add documents via SupabaseVectorStore addDocuments function. SupabaseHybridKeyWordSearch accepts embeddi...
4e9727215e95-2189
-- Enable the pgvector extension to work with embedding vectorscreate extension vector;-- Create a table to store your documentscreate table documents ( id bigserial primary key, content text, -- corresponds to Document.pageContent metadata jsonb, -- corresponds to Document.metadata embedding vector(1536) -- 1536 w...
4e9727215e95-2190
import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { createClient } from "@supabase/supabase-js";import { SupabaseHybridSearch } from "langchain/retrievers/supabase";export const run = async () => { const client = createClient( process.env.SUPABASE_URL || "", process.env.SUPABASE_PRIVATE_KEY |...
4e9727215e95-2191
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression Retrieve...
4e9727215e95-2192
It is important to note that due to required metadata, all documents must be added to the backing vector store using the addDocuments method on the retriever, not the vector store itself.import { TimeWeightedVectorStoreRetriever } from "langchain/retrievers/time_weighted";import { MemoryVectorStore } from "langchain/ve...
4e9727215e95-2193
', metadata: {} }] */API Reference:TimeWeightedVectorStoreRetriever from langchain/retrievers/time_weightedMemoryVectorStore from langchain/vectorstores/memoryOpenAIEmbeddings from langchain/embeddings/openaiPreviousSupabase Hybrid SearchNextVector StoreUsageCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyr...
4e9727215e95-2194
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toIntegrationsChatGPT Plugin RetrieverContextual Compression RetrieverDataberry RetrieverHyDE RetrieverAmazon Kendra RetrieverMetal RetrieverRemote RetrieverS...
4e9727215e95-2195
It is important to note that due to required metadata, all documents must be added to the backing vector store using the addDocuments method on the retriever, not the vector store itself.import { TimeWeightedVectorStoreRetriever } from "langchain/retrievers/time_weighted";import { MemoryVectorStore } from "langchain/ve...
4e9727215e95-2196
ModulesData connectionRetrieversIntegrationsTime-Weighted RetrieverOn this pageTime-Weighted RetrieverA Time-Weighted Retriever is a retriever that takes into account recency in addition to similarity. The scoring algorithm is:let score = (1.0 - this.decayRate) ** hoursPassed + vectorRelevance;Notably, hoursPassed abov...
4e9727215e95-2197
It is important to note that due to required metadata, all documents must be added to the backing vector store using the addDocuments method on the retriever, not the vector store itself.import { TimeWeightedVectorStoreRetriever } from "langchain/retrievers/time_weighted";import { MemoryVectorStore } from "langchain/ve...
4e9727215e95-2198
ModulesData connectionRetrieversIntegrationsTime-Weighted RetrieverOn this pageTime-Weighted RetrieverA Time-Weighted Retriever is a retriever that takes into account recency in addition to similarity. The scoring algorithm is:let score = (1.0 - this.decayRate) ** hoursPassed + vectorRelevance;Notably, hoursPassed abov...
4e9727215e95-2199
It is important to note that due to required metadata, all documents must be added to the backing vector store using the addDocuments method on the retriever, not the vector store itself.import { TimeWeightedVectorStoreRetriever } from "langchain/retrievers/time_weighted";import { MemoryVectorStore } from "langchain/ve...