-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
DOC: exam of using a deprecated package in the "Retriever" tutorial #5743
Comments
Hello, @well-balanced! I'm here to assist you with any issues you may have. If you need help with bugs, have questions, or want to become a contributor, feel free to ask! The "Retriever" tutorial documentation can indeed be updated to reflect the correct package path and method. Here is the revised version of the document: Updated Code Example:import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
import { CheerioWebBaseLoader } from "@langchain/community/document_loaders/web/cheerio";
import { MemoryVectorStore } from "langchain/vectorstores/memory";
import { OpenAIEmbeddings } from "@langchain/openai";
const loader = new CheerioWebBaseLoader(
"https://docs.smith.langchain.com/user_guide"
);
const rawDocs = await loader.load();
const splitter = new RecursiveCharacterTextSplitter({
chunkSize: 1000,
chunkOverlap: 200,
});
const docs = await splitter.splitDocuments(rawDocs);
const vectorstore = await MemoryVectorStore.fromDocuments(
docs,
new OpenAIEmbeddings()
);
const retriever = vectorstore.asRetriever();
const retrieverResult = await retriever.invoke('how to upload a dataset');
console.log(retrieverResult[0]);
/*
Document {
pageContent: "your application progresses through the beta testing phase, it's essential to continue collecting data to refine and improve its performance. LangSmith enables you to add runs as examples to datasets (from both the project page and within an annotation queue), expanding your test coverage on real-world scenarios. This is a key benefit in having your logging system and your evaluation/testing system in the same platform.ProductionClosely inspecting key data points, growing benchmarking datasets, annotating traces, and drilling down into important data in trace view are workflows you’ll also want to do once your app hits production. However, especially at the production stage, it’s crucial to get a high-level overview of application performance with respect to latency, cost, and feedback scores. This ensures that it's delivering desirable results at scale.Monitoring and A/B TestingLangSmith provides monitoring charts that allow you to track key metrics over time. You can expand to",
metadata: {
source: 'https://docs.smith.langchain.com/user_guide',
loc: { lines: [Object] }
}
}
*/ This update ensures the correct package path and method are used, aligning with the latest changes in the LangChain JS repository [1][2]. |
@dosu thanks for the updated code example! Can I go ahead and open a PR to update the documentation with this revised version? |
Checklist
Issue with current documentation:
There is a code example of using a deprecated package(langchain/document_loaders/web/cheerio) in the Retriever tutorial part.
Below is the current version of the document
Idea or request for content:
Could the document be updated as follows?
New package path:
As it is now:
The updated version should be:
Using another method:
As it is now:
The updated version should be:
The text was updated successfully, but these errors were encountered: