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

community[minor]: Add puppeteer agent tool #5731

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

stevenmichaelthomas
Copy link

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!

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 11, 2024
Copy link

vercel bot commented Jun 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2024 9:23pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview Jun 13, 2024 9:23pm

@dosubot dosubot bot added the auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features label Jun 11, 2024
@stevenmichaelthomas stevenmichaelthomas changed the title Add puppeteer agent tool community[minor]: Add puppeteer agent tool Jun 12, 2024
@jacoblee93
Copy link
Collaborator

Hey @stevenmichaelthomas! Thanks for the PR. Looks really cool!

I ran yarn format and registered the entrypoint artifacts to langchain.config.js. Could you add some docs and possibly an integration test as well?

})
);

const vectorStore = await MemoryVectorStore.fromDocuments(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return bodyHtml;
};

const DEFAULT_HEADERS = {
Copy link
Collaborator

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>;
Copy link
Collaborator

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) {
Copy link
Collaborator

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

@stevenmichaelthomas
Copy link
Author

Thanks so much for the feedback! I'll incorporate changes and ping you when everything is added in and tests are passing.

@TimSusa
Copy link
Contributor

TimSusa commented Aug 28, 2024

I like this idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:enhancement A large net-new component, integration, or chain. Use sparingly. The largest features size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants