-
Notifications
You must be signed in to change notification settings - Fork 18.5k
chore(langchain): add ruff rules N #32098
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
CodSpeed WallTime Performance ReportMerging #32098 will not alter performanceComparing
|
CodSpeed Instrumentation Performance ReportMerging #32098 will not alter performanceComparing Summary
|
187a642
to
1e48184
Compare
1e48184
to
a6cfb9f
Compare
|
||
def __getattr__(name: str) -> Any: | ||
"""Get attr name.""" | ||
|
||
if name == "create_csv_agent": | ||
# Get directory of langchain package |
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 think there was an edge case here which is why i did it this way rather
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.
This change replaces the dynamic determination of the package names with a static one.
I don't see how it could be wrong.
It even fixes the target path as the dynamic way resolves to langchain_experimental.agents.agent_toolkits.csv. create_csv_agent
which doesn't exist.
@@ -20,28 +20,28 @@ def __eq__(self, other: object) -> bool: | |||
# subclassed strings. | |||
|
|||
|
|||
def _AnyIdDocument(**kwargs: Any) -> Document: | |||
def any_id_document(**kwargs: Any) -> Document: |
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'd prefer to keep these as they were as they stand in for replacement classes
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.
How about using real classes then ?
Something like
class _AnyIDMixin(BaseModel):
def __eq__(self, other):
if isinstance(other, BaseModel):
dump = self.model_dump()
dump.pop("id")
other_dump = other.model_dump()
other_dump.pop("id")
return dump == other_dump
return False
class AnyIdAiMessage(AIMessage, _AnyIDMixin):
pass
class AnyIdAiMessageChunk(AIMessageChunk, _AnyIDMixin):
pass
class AnyIdHumanMessage(HumanMessage, _AnyIDMixin):
pass
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 opened #32209 .
LMK what you think.
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.
done.
a6cfb9f
to
7ab006e
Compare
08408b3
to
861027e
Compare
See https://docs.astral.sh/ruff/rules/#pep8-naming-n