-
Notifications
You must be signed in to change notification settings - Fork 160
feat(python): OpenAI Agents Tracing Interoperability #2070
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
python/langsmith/__init__.py
Outdated
# Avoid calling into importlib on every call to __version__ | ||
|
||
__version__ = "0.4.34" | ||
__version__ = "0.4.35rc1" |
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.
Revert before merging
new_run.post() | ||
|
||
ctx = copy_context() | ||
ctx.run(_context._PARENT_RUN_TREE.set, new_run) |
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 is storing context necessary? We're just pulling the parent out of the span maps aren't we?
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.
modifying the context is what enables @traceable
and wrap_openai
to automatically find the agent span as a parent without us having to pass it explicitly
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.
via setting _PARENT_RUN_TREE
project_name: Optional[str] | ||
name: Optional[str] | ||
run_tree: rt.RunTree | ||
context: contextvars.Context |
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.
See below, do we need to store context
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.
This is correct though, we don't need to actually store it in the RunData map
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.
removed
parent_run_id: Optional[str] | ||
project_name: Optional[str] | ||
name: Optional[str] | ||
run_tree: rt.RunTree |
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.
nit: why not just store RunTrees directly
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 are, just importing from langsmith import run_trees as rt
Description
Use RunTree API for openai agents sdk to improve tracing devex by allowing for input/output processing, nested traces with
@traceable
andwrap_openai
.Test Plan
Resolves #2063