-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest_autogen.py
More file actions
27 lines (18 loc) · 1015 Bytes
/
test_autogen.py
File metadata and controls
27 lines (18 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pytest
from thirdweb_ai.tools.tool import Tool
def test_get_autogen_tools(test_tools: list[Tool]):
"""Test converting thirdweb tools to AutoGen tools."""
pytest.importorskip("autogen_core")
from autogen_core.tools import BaseTool as AutogenBaseTool # type: ignore[import]
from thirdweb_ai.adapters.autogen import get_autogen_tools
# Convert tools to AutoGen tools
autogen_tools = get_autogen_tools(test_tools)
# Assert we got the correct number of tools
assert len(autogen_tools) == len(test_tools)
# Check all tools were properly converted
assert all(isinstance(tool, AutogenBaseTool) for tool in autogen_tools)
# Check properties were preserved
assert [tool.name for tool in autogen_tools] == [tool.name for tool in test_tools]
assert [tool.description for tool in autogen_tools] == [tool.description for tool in test_tools]
# Check all tools have a run method
assert all(callable(getattr(tool, "run", None)) for tool in autogen_tools)