Skip to content

Commit f9f56ee

Browse files
committed
Update tests
1 parent 0f71092 commit f9f56ee

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

coagent/agents/aswarm/util.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
from datetime import datetime
12
import inspect
23
import typing
3-
from datetime import datetime
4-
from typing import Any
54

65
from pydantic import Field, create_model
76
from pydantic.fields import FieldInfo
@@ -237,7 +236,7 @@ def transfer_back_to_triage():
237236
agent.functions.append(transfer_back_to_triage)
238237

239238

240-
def normalize_function_result(result: Any) -> ChatMessage:
239+
def normalize_function_result(result: typing.Any) -> ChatMessage:
241240
if isinstance(result, ChatMessage):
242241
return result
243242
return ChatMessage(role="assistant", content=str(result))

tests/agents/test_util.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ def func(a: int, b: str = "ok") -> None:
5656

5757

5858
def test_function_to_jsonschema_annotated():
59-
def func(a: Annotated[int, "Param a"], b: Annotated[str, "Param b"] = "ok") -> None:
59+
def func(
60+
a: Annotated[int, "The description for parameter a"],
61+
b: Annotated[str, "The description for parameter b"] = "ok",
62+
) -> None:
6063
"""This is a test function."""
6164
pass
6265

@@ -67,10 +70,14 @@ def func(a: Annotated[int, "Param a"], b: Annotated[str, "Param b"] = "ok") -> N
6770
"name": "func",
6871
"parameters": {
6972
"properties": {
70-
"a": {"description": "Param a", "title": "A", "type": "integer"},
73+
"a": {
74+
"description": "The description for parameter a",
75+
"title": "A",
76+
"type": "integer",
77+
},
7178
"b": {
7279
"default": "ok",
73-
"description": "Param b",
80+
"description": "The description for parameter b",
7481
"title": "B",
7582
"type": "string",
7683
},
@@ -86,8 +93,8 @@ def func(a: Annotated[int, "Param a"], b: Annotated[str, "Param b"] = "ok") -> N
8693

8794
def test_function_to_jsonschema_pydantic_field():
8895
def func(
89-
a: int = Field(description="Param a"),
90-
b: str = Field(default="ok", description="Param b"),
96+
a: int = Field(description="The description for parameter a"),
97+
b: str = Field(default="ok", description="The description for parameter b"),
9198
) -> None:
9299
"""This is a test function."""
93100
pass
@@ -99,10 +106,14 @@ def func(
99106
"name": "func",
100107
"parameters": {
101108
"properties": {
102-
"a": {"description": "Param a", "title": "A", "type": "integer"},
109+
"a": {
110+
"description": "The description for parameter a",
111+
"title": "A",
112+
"type": "integer",
113+
},
103114
"b": {
104115
"default": "ok",
105-
"description": "Param b",
116+
"description": "The description for parameter b",
106117
"title": "B",
107118
"type": "string",
108119
},

0 commit comments

Comments
 (0)