-
Notifications
You must be signed in to change notification settings - Fork 17.4k
[performance]: Use hard coded langchain-core
version to avoid importlib
import
#30744
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
Waiting on merging this until we have benchmarks from #30747 in place so that we can track progress. |
CodSpeed Performance ReportMerging #30744 will improve performances by 27.77%Comparing Summary
Benchmarks breakdown
|
@@ -0,0 +1,29 @@ | |||
name: Check `langchain-core` version equality |
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.
We need to generalize this I think. How about we do this as part of the release pipeline so it'll apply to all libraries. We can put logic in workflow to only apply it to libraries that we fixed already (or even skip and force all libraries to include version which I would prefer!)
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.
Yeah, I think generalizing this would be good... maybe in a separate PR where we automate some of the manual and redundant release tasks (like version bumping, etc).
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.
Why not leverage dynamic versioning? https://backend.pdm-project.org/metadata/#dynamic-project-version
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.
Good idea @Viicos, thanks! Will do :)
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.
Yeah, maybe I should just do the version stuff across all of our libs at once then :)
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 PR aims to reduce import time of
langchain-core
tools by removing theimportlib.metadata
import previously used in__init__.py
. This is the first in a sequence of PRs to reduce import time delays forlangchain-core
features and structures 🚀.Because we're now hard coding the version, we need to make sure
version.py
andpyproject.toml
stay in sync, so I've added a new CI job that runs whenever either of those files are modified. This run demonstrates the failure that occurs whenever the version gets out of sync (thus blocking a PR).Before, note the ~15% of time spent on the
importlib.metadata
/related importsAfter (note, lack of
importlib.metadata
time sink):