-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Python] 0.1.64 |Accept RunnableConfig|Customize OAI wrapper name|@Tr…
…aceable typing|Cache default RunTree Client ## Read parent run info from RunnableConfig if passed to function decorated with traceable - pass config into wrapped func only if signature declares it - modify signature of wrapper func to declare config as a kw arg, otherwise runnables don't pass it in - extract client and project_name from tracer, in addition to parent run info - update as_runnable to delegate run tree creation to new method ## Custom Run Name support in OpenAI Client ## Improve @Traceable typing # Improves for python >= 3.10. Should in theory not change anything for users of 3.8 and 3.9 (at least, things pass in our 3.8 linting here... Apologies in advance to any mypy acolytes on 3.{8,9} who gain undesired linting errors after this change) Uses: 1. ParamSpec (available in 3.10 and onwards) 2. Protocols (already used) Even though python doesn't naturally support keyword-only concatenation, we can work around this with protocols and duck typing to communicate the actual returned type of "the same function signature + a keyword only langsmith_extra arg" Python's typing situation makes it hard to make everyone happy, but hopefully this strikes a better compromise than before (typing kwargs as Any in the wrapped function; too lenient) ## Cache default run tree client --------- Co-authored-by: William Fu-Hinthorn <[email protected]>
- Loading branch information
Showing
11 changed files
with
277 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.