-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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[patch]: Fix Playwright Tools bug with Pydantic schemas #27050
community[patch]: Fix Playwright Tools bug with Pydantic schemas #27050
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
|
||
class BaseBrowserTool(BaseTool): | ||
"""Base class for browser tools.""" | ||
|
||
args_schema: Type[BaseModel] = BaseBrowserToolInput |
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.
@colriot why do we need to define a default schema on the base class? Ideally sub-classes would be forced to define the schema? Could we remove it here and add an appropriate schema in each tool that uses it?
I think definition here would make sense if this was called "ParameterlessBaseBrowserTool", but I think it's meant to capture any sort of tool and the main role of the base abstraction is to make sure that it accepts the browser attributes properly
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.
@eyurtsev because my suggestion was to have a default NoArgs schema applied. And only tools that actually require non-empty params will need to explicitly override it. I.e. I don't see the reason for subclasses to define their own schema if it's NoArgs (same as it was before the fix, but actually working).
I have a few suggested options:
- Rename
BaseBrowserToolInput
toNoArgsToolInput
(or smth along the lines) and have it used as default schema value inBaseBrowserTool
- Rename input, but remove default value from
BaseBrowserTool
and explicitly use it in every tool - Keep your suggestion, but then we'll have a few empty classes of no real use, that have identical purpose
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.
I don't see the reason for subclasses to define their own schema if it's NoArgs
For me the main reason is that it's an abstract class with an incorrect default. I don't feel strongly in this case -- end users aren't expected to use these types or subclass from the base playwright tool, so all the solutions are equivalent for end-users (and this can vary by personal style).
Do you want me to revert to the previous iteration or do you want to make the update?
Can merge if we can package the schema for the tool inputs together with the appropriate tools |
Taking a look at rolling out the fix right now |
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.
Incorporated changes
Head branch was pushed to by a user without write access
Left a comment in the above discussion for a final decision, @eyurtsev |
Any plans to merge this? It's a super simple PR and I am sure a lot of people are being blocked from upgrading to langchain@0.3 by not having it merged. |
It looks like the test is unable to run in CI and also messes up the event loop for other tests - aware of any other testing strategies that could work (e.g. mocking the relevant playwright calls, not relying on the sdk), or would recommendation just be to remove the test? |
also appreciate your patience on this one! sorry for the delays in review cycle |
merging with a mock - can do something different in a future PR if desired |
And it's already on 0.3.6! Thanks, @efriis! |
Thank you @efriis ! Sorry about the CI, I wonder why it originally didn't blow up, might be related to some updates in between PR creation and merging it, maybe playwright version... Thanks for fixing it! |
Test Plan:
poetry run pytest tests/unit_tests/tools/playwright/test_all.py
Fixes #26758