Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs,examples[patch]: Replace .getRelevantDocuments with .invoke #5749

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/core_docs/docs/tutorials/agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ const vectorstore = await MemoryVectorStore.fromDocuments(
);
const retriever = vectorstore.asRetriever();

const retrieverResult = await retriever.getRelevantDocuments(
"how to upload a dataset"
);
const retrieverResult = await retriever.invoke("how to upload a dataset");
console.log(retrieverResult[0]);

/*
Expand Down
4 changes: 2 additions & 2 deletions docs/core_docs/docs/tutorials/rag.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
" outputParser: new StringOutputParser(),\n",
"})\n",
"\n",
"const retrievedDocs = await retriever.getRelevantDocuments(\"what is task decomposition\")"
"const retrievedDocs = await retriever.invoke(\"what is task decomposition\")"
]
},
{
Expand Down Expand Up @@ -817,7 +817,7 @@
" prompt: customRagPrompt,\n",
" outputParser: new StringOutputParser(),\n",
"})\n",
"const context = await retriever.getRelevantDocuments(\"what is task decomposition\");\n",
"const context = await retriever.invoke(\"what is task decomposition\");\n",
"\n",
"await ragChain.invoke({\n",
" question: \"What is Task Decomposition?\",\n",
Expand Down
4 changes: 1 addition & 3 deletions examples/src/retrievers/parent_document_retriever_rerank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ await retriever.addDocuments(docs);

// This will search for documents in vector store and return for LLM already reranked and sorted document
// with appropriate minimum relevance score
const retrievedDocs = await retriever.getRelevantDocuments(
"What is Pam's favorite color?"
);
const retrievedDocs = await retriever.invoke("What is Pam's favorite color?");

// Pam's favorite color is returned first!
console.log(JSON.stringify(retrievedDocs, null, 2));
Expand Down
8 changes: 4 additions & 4 deletions examples/src/retrievers/qdrant_self_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ const selfQueryRetriever = SelfQueryRetriever.fromLLM({
* 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 documents.
*/
const query1 = await selfQueryRetriever.getRelevantDocuments(
const query1 = await selfQueryRetriever.invoke(
"Which movies are less than 90 minutes?"
);
const query2 = await selfQueryRetriever.getRelevantDocuments(
const query2 = await selfQueryRetriever.invoke(
"Which movies are rated higher than 8.5?"
);
const query3 = await selfQueryRetriever.getRelevantDocuments(
const query3 = await selfQueryRetriever.invoke(
"Which cool movies are directed by Greta Gerwig?"
);
const query4 = await selfQueryRetriever.getRelevantDocuments(
const query4 = await selfQueryRetriever.invoke(
"Which movies are either comedy or drama and are less than 90 minutes?"
);
console.log(query1, query2, query3, query4);
Loading