-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
community[minor]: Add puppeteer agent tool #5731
base: main
Are you sure you want to change the base?
community[minor]: Add puppeteer agent tool #5731
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Hey @stevenmichaelthomas! Thanks for the PR. Looks really cool! I ran |
}) | ||
); | ||
|
||
const vectorStore = await MemoryVectorStore.fromDocuments( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using contextual compression - likely no need for an explicit vectorstore:
https://js.langchain.com/v0.2/docs/how_to/contextual_compression
https://github.com/langchain-ai/weblangchain/blob/main/nextjs/app/api/chat/stream_log/route.ts#L101
return bodyHtml; | ||
}; | ||
|
||
const DEFAULT_HEADERS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move above usage to avoid linter issue
}; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
type Headers = Record<string, any>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be Record<string, string>
}); | ||
} | ||
|
||
async _call(inputs: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make this extend StructuredTool
and give it a schema instead, might be a bit nicer/more reliable than comma separated values
Thanks so much for the feedback! I'll incorporate changes and ping you when everything is added in and tests are passing. |
I like this idea |
Adds puppeteer agent tool. When testing out projects using the in-built
WebBrowser
, we found the lack of JS execution with Cheerio to be challenging.This instead leverages Puppeteer to handle full page execution, returning a lightly cleaned version of HTML, plus the ability to generate embeddings and send valid chunks to the specified model.
This is my first contribution here, so please let me know if I've missed anything, or if there is any feedback. Thank you!