-
Notifications
You must be signed in to change notification settings - Fork 111
nexus_operation_as_tool #949
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
4ddba85
to
9cde5d0
Compare
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.
LGTM as is. Admittedly I have never reviewed the activity as tool code in depth either. Would like @tconley1428 to approve.
} | ||
operation_callable.__name__ = operation.name | ||
|
||
schema = function_schema(operation_callable) |
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 support activities having access to an agent context as the first param but I am concerned Nexus operation limitations of single param forbid having context as the first param and input as the second. Suggestions? I think we may just have to document for now that tools backed by Nexus operations can't have access to context at this time.
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 that is ok since we provide nexus_operation_as_tool
as a convenience method. You should still be able to define a regular function tool, grab what you need from the context, and invoke the Nexus operation from there.
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.
Agreed behavior is ok, it's just the optics are confusing/inconsistent. "So, in-workflow tools can have mutable context, activity tools can have immutable context, and nexus tools can have no context?" We need to document this at least I 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.
I would like to see the tests left intact, but otherwise looks good.
"""Error that occurs when a tool output could not be serialized.""" | ||
|
||
|
||
def activity_as_tool( |
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 file got removed, now located in temporal_openai_agents.workflow
@@ -287,8 +306,11 @@ async def run(self, question: str) -> str: | |||
openai_agents.workflow.activity_as_tool( | |||
get_weather_object, start_to_close_timeout=timedelta(seconds=10) | |||
), | |||
openai_agents.workflow.activity_as_tool( | |||
get_weather_country, start_to_close_timeout=timedelta(seconds=10) | |||
nexus_operation_as_tool( |
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 should add the tool and extend the test to call it rather than replacing one.
Good call @tconley1428, done that. |
f329f07
to
4db4051
Compare
4db4051
to
f501b66
Compare
451d5c6
to
beb684a
Compare
Add a Nexus operation version of
activity_as_tool
.