-
Notifications
You must be signed in to change notification settings - Fork 166
chore: Xin/improve unnamed runtree naming #2124
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: main
Are you sure you want to change the base?
Conversation
c962563 to
431ceae
Compare
| values["name"] = "Unnamed" | ||
| name = None | ||
| try: | ||
| import inspect |
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.
Imports like this should be top level right?
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.
it should be rare case we even need to enter "make a name" mode. so i don't worry too much about perf.
yeah inspect can go to top
| import os | ||
|
|
||
| # Look up the stack, skipping internal frames | ||
| for frame_info in inspect.stack()[1:8]: |
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.
Any perf concerns here?
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.
it should be rare case we even need to enter "make a name" mode. i.e, this conditoin should not be entered.
so i don't worry too much about perf.
| name = frame_locals["self"].__class__.__name__ | ||
| break | ||
| elif "cls" in frame_locals: | ||
| name = frame_locals["cls"].__name__ |
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 know enough about Python to know if this is a good idea
Is there no easier fallback?
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.
there's try catch so at least it won't error, no better fallback afaik
https://langchain.slack.com/archives/C04GMBZ9Y1Y/p1763061096088929