Files
agent-framework/python/packages/main/tests/unit/conftest.py
T
Eduard van Valkenburg 62917ee5e5 Python: simple Agent sample (#180)
* tweaks to agents and sample

* updated clients and agents

* single line run and print

* improved tool handling

* added note on setting max iterations

* fixed streaming param name

* updated tools test

* made kwargs alphabetical

* added params to run methods

* tweak to ensure right overload
2025-07-15 14:01:21 +00:00

39 lines
931 B
Python

# Copyright (c) Microsoft. All rights reserved.
from typing import Any
from pydantic import BaseModel
from pytest import fixture
from agent_framework import AITool, ai_function
@fixture
def ai_tool() -> AITool:
"""Returns a generic AITool."""
class GenericTool(BaseModel):
name: str
description: str | None = None
additional_properties: dict[str, Any] | None = None
def parameters(self) -> dict[str, Any]:
"""Return the parameters of the tool as a JSON schema."""
return {
"name": {"type": "string"},
}
return GenericTool(name="generic_tool", description="A generic tool")
@fixture
def ai_function_tool() -> AITool:
"""Returns a executable AITool."""
@ai_function
def simple_function(x: int, y: int) -> int:
"""A simple function that adds two numbers."""
return x + y
return simple_function