File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 11import json
22from collections .abc import AsyncIterator
33
4+ import pytest
45from pydantic import BaseModel
56
67import workflowai
@@ -150,6 +151,8 @@ async def city_to_capital(task_input: CityToCapitalTaskInput) -> CityToCapitalTa
150151
151152
152153async 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"""
Original file line number Diff line number Diff line change 1+ from workflowai .core .fields .file import File
2+
3+
4+ class PDF (File ):
5+ """A field representing a PDF file.
6+
7+ This field is used to handle PDF inputs.
8+ The PDF can be provided either as base64-encoded data or as a URL.
9+ """
10+
11+ pass
Original file line number Diff line number Diff line change 66from workflowai .core .fields .http_url import HttpUrl as HttpUrl
77from workflowai .core .fields .image import Image as Image
88from workflowai .core .fields .local_date_time import DatetimeLocal as DatetimeLocal
9+ from workflowai .core .fields .pdf import PDF as PDF
910from workflowai .core .fields .price import Price as Price
1011from workflowai .core .fields .surface_area import SurfaceArea as SurfaceArea
1112from workflowai .core .fields .zone_info import TimezoneInfo as TimezoneInfo
You can’t perform that action at this time.
0 commit comments