Python: api doc generation setup (#342)

* api doc generation setup

* remove old log file

* improved check md function

* update with sample code in docstring

* updated script

* docs update

* docs update and action

* removed all-extras

* fixed sync command

* moved install

* moved action

* renamed folder

* fixed syntax

* add python path

* fix mypy and reused steps

* updated merge test

* undo change

* slight update in poe commands

* dev setup update

* updated uvlock
This commit is contained in:
Eduard van Valkenburg
2025-09-16 12:02:53 +02:00
committed by GitHub
Unverified
parent 66fe1c957c
commit 65dd48aa1d
58 changed files with 676 additions and 2588 deletions
+2 -6
View File
@@ -82,10 +82,6 @@ include = "../../shared_tasks.toml"
mypy = "mypy --config-file $POE_ROOT/pyproject.toml agent_framework_azure"
test = "pytest --cov=agent_framework_azure --cov-report=term-missing:skip-covered tests"
[tool.uv.build-backend]
module-name = "agent_framework_azure"
module-root = ""
[build-system]
requires = ["uv_build>=0.8.2,<0.9.0"]
build-backend = "uv_build"
requires = ["flit-core >= 3.9,<4.0"]
build-backend = "flit_core.buildapi"
+7 -7
View File
@@ -23,7 +23,7 @@ Before using the Copilot Studio agent, you need:
The following environment variables are used for configuration:
- `COPILOTSTUDIOAGENT__ENVIRONMENTID` - Your Copilot Studio environment ID
- `COPILOTSTUDIOAGENT__SCHEMANAME` - Your copilot's agent identifier/schema name
- `COPILOTSTUDIOAGENT__SCHEMANAME` - Your copilot's agent identifier/schema name
- `COPILOTSTUDIOAGENT__AGENTAPPID` - Your App Registration client ID
- `COPILOTSTUDIOAGENT__TENANTID` - Your Azure AD tenant ID
@@ -36,7 +36,7 @@ from agent_framework.copilotstudio import CopilotStudioAgent
async def main():
# Create agent using environment variables
agent = CopilotStudioAgent()
# Run a simple query
result = await agent.run("What is the capital of France?")
print(result)
@@ -58,19 +58,20 @@ async def main():
client_id=os.environ["COPILOTSTUDIOAGENT__AGENTAPPID"],
tenant_id=os.environ["COPILOTSTUDIOAGENT__TENANTID"]
)
# Create connection settings
settings = ConnectionSettings(
environment_id=os.environ["COPILOTSTUDIOAGENT__ENVIRONMENTID"],
agent_identifier=os.environ["COPILOTSTUDIOAGENT__SCHEMANAME"],
cloud=PowerPlatformCloud.PROD,
copilot_agent_type=AgentType.PUBLISHED
copilot_agent_type=AgentType.PUBLISHED,
custom_power_platform_cloud=None
)
# Create client and agent
client = CopilotClient(settings=settings, token=token)
agent = CopilotStudioAgent(client=client)
# Run a query
result = await agent.run("What is the capital of Italy?")
print(result)
@@ -94,4 +95,3 @@ For more comprehensive examples, see the [Copilot Studio examples](https://githu
- Explicit settings and manual token acquisition
- Different authentication patterns
- Error handling and troubleshooting
+2 -6
View File
@@ -84,10 +84,6 @@ include = "../../shared_tasks.toml"
mypy = "mypy --config-file $POE_ROOT/pyproject.toml agent_framework_foundry"
test = "pytest --cov=agent_framework_foundry --cov-report=term-missing:skip-covered tests"
[tool.uv.build-backend]
module-name = "agent_framework_foundry"
module-root = ""
[build-system]
requires = ["uv_build>=0.8.2,<0.9.0"]
build-backend = "uv_build"
requires = ["flit-core >= 3.9,<4.0"]
build-backend = "flit_core.buildapi"
+4 -4
View File
@@ -50,10 +50,10 @@ You can also override environment variables by explicitly passing configuration
from agent_framework.azure import AzureChatClient
chat_client = AzureChatClient(
api_key=...,
endpoint=...,
deployment_name=...,
api_version=...,
api_key="",
endpoint="",
deployment_name="",
api_version="",
)
```
@@ -17,6 +17,8 @@ else:
# region Context
__all__ = ["AggregateContextProvider", "Context", "ContextProvider"]
class Context(AFBaseModel):
"""A class containing any context that should be provided to the AI model as supplied by an ContextProvider.
+15 -10
View File
@@ -73,6 +73,9 @@ DEFAULT_MAX_ITERATIONS: Final[int] = 10
TChatClient = TypeVar("TChatClient", bound="ChatClientProtocol")
# region Helpers
ArgsT = TypeVar("ArgsT", bound=BaseModel)
ReturnT = TypeVar("ReturnT")
def _parse_inputs(
inputs: "Contents | dict[str, Any] | str | list[Contents | dict[str, Any] | str] | None",
@@ -121,13 +124,10 @@ def _parse_inputs(
class ToolProtocol(Protocol):
"""Represents a generic tool that can be specified to an AI service.
Attributes:
Parameters:
name: The name of the tool.
description: A description of the tool.
additional_properties: Additional properties associated with the tool.
Methods:
parameters: The parameters accepted by the tool, in a json schema format.
"""
name: str
@@ -142,10 +142,6 @@ class ToolProtocol(Protocol):
...
ArgsT = TypeVar("ArgsT", bound=BaseModel)
ReturnT = TypeVar("ReturnT")
class BaseTool(AFBaseModel):
"""Base class for AI tools, providing common attributes and methods.
@@ -516,11 +512,20 @@ def ai_function(
In order to add descriptions to parameters, in your function signature,
use the `Annotated` type from `typing` and the `Field` class from `pydantic`:
from typing import Annotated
Example:
.. code-block:: python
from typing import Annotated
from pydantic import Field
<field_name>: Annotated[<type>, Field(description="<description>")]
def ai_function_example(
arg1: Annotated[str, Field(description="The first argument")],
arg2: Annotated[int, Field(description="The second argument")],
) -> str:
# An example function that takes two arguments and returns a string.
return f"arg1: {arg1}, arg2: {arg2}"
Args:
func: The function to wrap. If None, returns a decorator.
@@ -1297,7 +1297,7 @@ FinishReason.TOOL_CALLS = FinishReason(value="tool_calls") # type: ignore[assig
class ChatMessage(AFBaseModel):
"""Represents a chat message used by a `ModelClient`.
"""Represents a chat message.
Attributes:
role: The role of the author of the message.
+12 -6
View File
@@ -49,6 +49,16 @@ workflow = [
runtime = [
"agent-framework-runtime"
]
mem0 = [
"agent-framework-mem0"
]
all = [
"agent-framework-azure",
"agent-framework-foundry",
"agent-framework-workflow",
"agent-framework-runtime",
"agent-framework-mem0"
]
[tool.uv]
prerelease = "if-necessary-or-explicit"
@@ -106,10 +116,6 @@ include = "../../shared_tasks.toml"
mypy = "mypy --config-file $POE_ROOT/pyproject.toml agent_framework"
test = "pytest --cov=agent_framework --cov-report=term-missing:skip-covered tests"
[tool.uv.build-backend]
module-name = "agent_framework"
module-root = ""
[build-system]
requires = ["uv_build>=0.8.2,<0.9.0"]
build-backend = "uv_build"
requires = ["flit-core >= 3.9,<4.0"]
build-backend = "flit_core.buildapi"
+2 -6
View File
@@ -84,10 +84,6 @@ include = "../../shared_tasks.toml"
mypy = "mypy --config-file $POE_ROOT/pyproject.toml agent_framework_mem0"
test = "pytest --cov=agent_framework_mem0 --cov-report=term-missing:skip-covered tests"
[tool.uv.build-backend]
module-name = "agent_framework_mem0"
module-root = ""
[build-system]
requires = ["uv_build>=0.8.2,<0.9.0"]
build-backend = "uv_build"
requires = ["flit-core >= 3.9,<4.0"]
build-backend = "flit_core.buildapi"
+2 -6
View File
@@ -81,10 +81,6 @@ include = "../../shared_tasks.toml"
mypy = "mypy --config-file $POE_ROOT/pyproject.toml agent_framework_runtime"
test = "pytest --cov=agent_framework_runtime --cov-report=term-missing:skip-covered tests"
[tool.uv.build-backend]
module-name = "agent_framework_runtime"
module-root = ""
[build-system]
requires = ["uv_build>=0.8.2,<0.9.0"]
build-backend = "uv_build"
requires = ["flit-core >= 3.9,<4.0"]
build-backend = "flit_core.buildapi"
+2 -6
View File
@@ -86,10 +86,6 @@ include = "../../shared_tasks.toml"
mypy = "mypy --config-file $POE_ROOT/pyproject.toml agent_framework_workflow"
test = "pytest --cov=agent_framework_workflow --cov-report=term-missing:skip-covered tests"
[tool.uv.build-backend]
module-name = "agent_framework_workflow"
module-root = ""
[build-system]
requires = ["uv_build>=0.8.2,<0.9.0"]
build-backend = "uv_build"
requires = ["flit-core >= 3.9,<4.0"]
build-backend = "flit_core.buildapi"