id
stringlengths
14
17
text
stringlengths
42
2.11k
4e9727215e95-1900
childK: 20,});const textLoader = new TextLoader("../examples/state_of_the_union.txt");const parentDocuments = await textLoader.load();// We must add the parent documents via the retriever's addDocuments methodawait retriever.addDocuments(parentDocuments);const retrievedDocs = await retriever.getRelevantDocuments("justi...
4e9727215e95-1901
', metadata: { source: '../examples/state_of_the_union.txt', loc: [Object] } }, Document { pageContent: 'Justice Breyer, thank you for your service. Thank you, thank you, thank you. I mean it. Get up. Stand — let me see you. Thank you.\n' + '\n' + 'And we all know — no matter what your ide...
4e9727215e95-1902
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingTime-weighted vector store retrieverVector store-backed retrieverIntegrationsExperimentalCaching...
4e9727215e95-1903
This can either be the whole raw document OR a larger chunk.Usage​import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { MemoryVectorStore } from "langchain/vectorstores/memory";import { InMemoryDocstore } from "langchain/stores/doc/in_memory";import { ParentDocumentRetriever } from "langchain/retrieve...
4e9727215e95-1904
childK: 20,});const textLoader = new TextLoader("../examples/state_of_the_union.txt");const parentDocuments = await textLoader.load();// We must add the parent documents via the retriever's addDocuments methodawait retriever.addDocuments(parentDocuments);const retrievedDocs = await retriever.getRelevantDocuments("justi...
4e9727215e95-1905
', metadata: { source: '../examples/state_of_the_union.txt', loc: [Object] } }, Document { pageContent: 'Justice Breyer, thank you for your service. Thank you, thank you, thank you. I mean it. Get up. Stand — let me see you. Thank you.\n' + '\n' + 'And we all know — no matter what your ide...
4e9727215e95-1906
This can either be the whole raw document OR a larger chunk.Usage​import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { MemoryVectorStore } from "langchain/vectorstores/memory";import { InMemoryDocstore } from "langchain/stores/doc/in_memory";import { ParentDocumentRetriever } from "langchain/retrieve...
4e9727215e95-1907
childK: 20,});const textLoader = new TextLoader("../examples/state_of_the_union.txt");const parentDocuments = await textLoader.load();// We must add the parent documents via the retriever's addDocuments methodawait retriever.addDocuments(parentDocuments);const retrievedDocs = await retriever.getRelevantDocuments("justi...
4e9727215e95-1908
', metadata: { source: '../examples/state_of_the_union.txt', loc: [Object] } }, Document { pageContent: 'Justice Breyer, thank you for your service. Thank you, thank you, thank you. I mean it. Get up. Stand — let me see you. Thank you.\n' + '\n' + 'And we all know — no matter what your ide...
4e9727215e95-1909
This can either be the whole raw document OR a larger chunk.Usage​import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { MemoryVectorStore } from "langchain/vectorstores/memory";import { InMemoryDocstore } from "langchain/stores/doc/in_memory";import { ParentDocumentRetriever } from "langchain/retrieve...
4e9727215e95-1910
childK: 20,});const textLoader = new TextLoader("../examples/state_of_the_union.txt");const parentDocuments = await textLoader.load();// We must add the parent documents via the retriever's addDocuments methodawait retriever.addDocuments(parentDocuments);const retrievedDocs = await retriever.getRelevantDocuments("justi...
4e9727215e95-1911
', metadata: { source: '../examples/state_of_the_union.txt', loc: [Object] } }, Document { pageContent: 'Justice Breyer, thank you for your service. Thank you, thank you, thank you. I mean it. Get up. Stand — let me see you. Thank you.\n' + '\n' + 'And we all know — no matter what your ide...
4e9727215e95-1912
import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { MemoryVectorStore } from "langchain/vectorstores/memory";import { InMemoryDocstore } from "langchain/stores/doc/in_memory";import { ParentDocumentRetriever } from "langchain/retrievers/parent_document";import { RecursiveCharacterTextSplitter } from...
4e9727215e95-1913
childK: 20,});const textLoader = new TextLoader("../examples/state_of_the_union.txt");const parentDocuments = await textLoader.load();// We must add the parent documents via the retriever's addDocuments methodawait retriever.addDocuments(parentDocuments);const retrievedDocs = await retriever.getRelevantDocuments("justi...
4e9727215e95-1914
', metadata: { source: '../examples/state_of_the_union.txt', loc: [Object] } }, Document { pageContent: 'Justice Breyer, thank you for your service. Thank you, thank you, thank you. I mean it. Get up. Stand — let me see you. Thank you.\n' + '\n' + 'And we all know — no matter what your ide...
4e9727215e95-1915
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingChroma ...
4e9727215e95-1916
This allows the retriever to not only use the user-input query for semantic similarity comparison with the contents of stored documented, but to also extract filters from the user query on the metadata of stored documents and to execute those filters.All Self Query retrievers require peggy as a peer dependency:npmYarnp...
4e9727215e95-1917
/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-1918
/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-1919
/ structuredQueryTranslator: new FunctionalTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?"...
4e9727215e95-1920
you could initialize the above retriever as follows:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, structuredQueryTranslator: new FunctionalTranslator(), searchParams: { filter: (doc: Document) => doc.metadata && doc.metadata.genre === "animated...
4e9727215e95-1921
This allows the retriever to not only use the user-input query for semantic similarity comparison with the contents of stored documented, but to also extract filters from the user query on the metadata of stored documents and to execute those filters.All Self Query retrievers require peggy as a peer dependency:npmYarnp...
4e9727215e95-1922
/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-1923
/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-1924
/ structuredQueryTranslator: new FunctionalTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?"...
4e9727215e95-1925
you could initialize the above retriever as follows:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, structuredQueryTranslator: new FunctionalTranslator(), searchParams: { filter: (doc: Document) => doc.metadata && doc.metadata.genre === "animated...
4e9727215e95-1926
ModulesData connectionRetrieversHow-toSelf-queryingSelf-queryingA self-querying retriever is one that, as the name suggests, has the ability to query itself. Specifically, given any natural language query, the retriever uses a query-constructing LLM chain to write a structured query and then applies that structured que...
4e9727215e95-1927
/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-1928
/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-1929
/ structuredQueryTranslator: new FunctionalTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?"...
4e9727215e95-1930
you could initialize the above retriever as follows:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, structuredQueryTranslator: new FunctionalTranslator(), searchParams: { filter: (doc: Document) => doc.metadata && doc.metadata.genre === "animated...
4e9727215e95-1931
Self-queryingA self-querying retriever is one that, as the name suggests, has the ability to query itself. Specifically, given any natural language query, the retriever uses a query-constructing LLM chain to write a structured query and then applies that structured query to it's underlying VectorStore. This allows the ...
4e9727215e95-1932
/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-1933
/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-1934
/ structuredQueryTranslator: new FunctionalTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?"...
4e9727215e95-1935
you could initialize the above retriever as follows:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, structuredQueryTranslator: new FunctionalTranslator(), searchParams: { filter: (doc: Document) => doc.metadata && doc.metadata.genre === "animated...
4e9727215e95-1936
Here's a basic example with an in-memory, unoptimized vector store: import { MemoryVectorStore } from "langchain/vectorstores/memory";import { AttributeInfo } from "langchain/schema/query_constructor";import { Document } from "langchain/document";import { OpenAIEmbeddings } from "langchain/embeddings/openai";import { ...
4e9727215e95-1937
/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-1938
/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-1939
/ structuredQueryTranslator: new FunctionalTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?"...
4e9727215e95-1940
you could initialize the above retriever as follows: const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, structuredQueryTranslator: new FunctionalTranslator(), searchParams: { filter: (doc: Document) => doc.metadata && doc.metadata.genre === "animat...
4e9727215e95-1941
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingChroma ...
4e9727215e95-1942
Make sure your metadata matches the AttributeInfo below. */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 ...
4e9727215e95-1943
This is used to generate the query prompts. */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", descri...
4e9727215e95-1944
/ structuredQueryTranslator: new ChromaTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * ...
4e9727215e95-1945
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to create a basic translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * ...
4e9727215e95-1946
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingChroma Self Query RetrieverHNSWLib Self Query RetrieverMemory Vector Store Self Query RetrieverP...
4e9727215e95-1947
/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-1948
/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-1949
/ structuredQueryTranslator: new ChromaTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * ...
4e9727215e95-1950
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to create a basic translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * ...
4e9727215e95-1951
/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-1952
/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-1953
/ structuredQueryTranslator: new ChromaTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * ...
4e9727215e95-1954
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to create a basic translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * ...
4e9727215e95-1955
/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-1956
/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-1957
/ structuredQueryTranslator: new ChromaTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * ...
4e9727215e95-1958
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to create a basic translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * ...
4e9727215e95-1959
/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-1960
/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-1961
/ structuredQueryTranslator: new ChromaTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * ...
4e9727215e95-1962
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to create a basic translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * ...
4e9727215e95-1963
/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-1964
/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-1965
/ structuredQueryTranslator: new ChromaTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * ...
4e9727215e95-1966
addition to the generated query: const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to create a basic translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator ...
4e9727215e95-1967
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingChroma ...
4e9727215e95-1968
Make sure your metadata matches the AttributeInfo below. */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 ...
4e9727215e95-1969
This is used to generate the query prompts. */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", descri...
4e9727215e95-1970
/ structuredQueryTranslator: new FunctionalTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?"...
4e9727215e95-1971
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to use a translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * translato...
4e9727215e95-1972
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingChroma Self Query RetrieverHNSWLib Self Query RetrieverMemory Vector Store Self Query RetrieverP...
4e9727215e95-1973
/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-1974
/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-1975
We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * The retriever will automatically convert these questions into queries that can be used to retrieve ...
4e9727215e95-1976
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to use a translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * translato...
4e9727215e95-1977
/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-1978
/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-1979
We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * The retriever will automatically convert these questions into queries that can be used to retrieve ...
4e9727215e95-1980
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to use a translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * translato...
4e9727215e95-1981
/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-1982
/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-1983
We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * The retriever will automatically convert these questions into queries that can be used to retrieve ...
4e9727215e95-1984
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to use a translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * translato...
4e9727215e95-1985
/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-1986
/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-1987
We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * The retriever will automatically convert these questions into queries that can be used to retrieve ...
4e9727215e95-1988
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to use a translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * translato...
4e9727215e95-1989
/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-1990
/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-1991
We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5?". * We can also ask questions like "Which movies are either comedy or drama and are less than 90 minutes?". * The retriever will automatically convert these questions into queries that can be used to retrieve ...
4e9727215e95-1992
const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to use a translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * translator here, but you can create your ...
4e9727215e95-1993
Paragraphs: Skip to main content🦜️🔗 LangChainDocsUse casesAPILangSmithPython DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingChroma ...
4e9727215e95-1994
Each document has a pageContent and a metadata field. Make sure your metadata matches the AttributeInfo below. */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 Documen...
4e9727215e95-1995
We also provide a description of each attribute and the type of the attribute. * This is used to generate the query prompts. */const attributeInfo: AttributeInfo[] = [ { name: "genre", description: "The genre of the movie", type: "string or array of strings", }, { name: "year", description: "The year ...
4e9727215e95-1996
Note that the vector store needs to support filtering on the metadata * attributes you want to query on. */ structuredQueryTranslator: new FunctionalTranslator(),});/** * Now we can query the vector store. * We can ask questions like "Which movies are less than 90 minutes?" or "Which movies are rated higher than 8.5...
4e9727215e95-1997
addition to the generated query:const selfQueryRetriever = await SelfQueryRetriever.fromLLM({ llm, vectorStore, documentContents, attributeInfo, /** * We need to use a translator that translates the queries into a * filter format that the vector store can understand. We provide a basic translator * translato...
4e9727215e95-1998
Get startedIntroductionInstallationQuickstartModulesModel I/​OData connectionDocument loadersDocument transformersText embedding modelsVector storesRetrieversHow-toContextual compressionParent Document RetrieverSelf-queryingChroma Self Query RetrieverHNSWLib Self Query RetrieverMemory Vector Store Self Query RetrieverP...
4e9727215e95-1999
/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...