Skip to content

Commit 49ecabe

Browse files
committed
test: add sanity check for required field in tool calls
1 parent 1ad1ebb commit 49ecabe

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/integration/run_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
from collections.abc import AsyncIterator
33

4+
import pytest
45
from pydantic import BaseModel
56

67
import workflowai
@@ -150,6 +151,8 @@ async def city_to_capital(task_input: CityToCapitalTaskInput) -> CityToCapitalTa
150151

151152

152153
async def test_run_with_tool(test_client: IntTestClient):
154+
"""Test a round trip with a tool call request and a reply."""
155+
153156
class _SayHelloToolInput(BaseModel):
154157
name: str
155158

@@ -159,6 +162,10 @@ class _SayHelloToolOutput(BaseModel):
159162
def say_hello(tool_input: _SayHelloToolInput) -> _SayHelloToolOutput:
160163
return _SayHelloToolOutput(message=f"Hello {tool_input.name}")
161164

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+
162169
@workflowai.agent(id="city-to-capital", tools=[say_hello])
163170
async def city_to_capital(task_input: CityToCapitalTaskInput) -> CityToCapitalTaskOutput:
164171
"""Say hello to the user"""

0 commit comments

Comments
 (0)