File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
2
from collections .abc import AsyncIterator
3
3
4
+ import pytest
4
5
from pydantic import BaseModel
5
6
6
7
import workflowai
@@ -150,6 +151,8 @@ async def city_to_capital(task_input: CityToCapitalTaskInput) -> CityToCapitalTa
150
151
151
152
152
153
async def test_run_with_tool (test_client : IntTestClient ):
154
+ """Test a round trip with a tool call request and a reply."""
155
+
153
156
class _SayHelloToolInput (BaseModel ):
154
157
name : str
155
158
@@ -159,6 +162,10 @@ class _SayHelloToolOutput(BaseModel):
159
162
def say_hello (tool_input : _SayHelloToolInput ) -> _SayHelloToolOutput :
160
163
return _SayHelloToolOutput (message = f"Hello { tool_input .name } " )
161
164
165
+ # Sanity check to make sure that CityToCapitalTaskOutput.capital is a field required by pydantic
166
+ with pytest .raises (AttributeError ):
167
+ _ = CityToCapitalTaskOutput .model_construct (None ).capital
168
+
162
169
@workflowai .agent (id = "city-to-capital" , tools = [say_hello ])
163
170
async def city_to_capital (task_input : CityToCapitalTaskInput ) -> CityToCapitalTaskOutput :
164
171
"""Say hello to the user"""
You can’t perform that action at this time.
0 commit comments