mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: updated doc generation setup and some slight api enhancements (#267)
* updated doc generation setup and some slight api enhancements * small fix in index
This commit is contained in:
committed by
GitHub
Unverified
parent
139f033b05
commit
42c7a59640
@@ -146,15 +146,17 @@ def ai_function(
|
||||
) -> AIFunction[Any, ReturnT]:
|
||||
"""Decorate a function to turn it into a AIFunction that can be passed to models and executed automatically.
|
||||
|
||||
Remarks:
|
||||
In order to add descriptions to parameters, use:
|
||||
This function will create a Pydantic model from the function's signature,
|
||||
which will be used to validate the arguments passed to the function.
|
||||
And will be used to generate the JSON schema for the function's parameters.
|
||||
In order to add descriptions to parameters, in your function signature,
|
||||
use the `Annotated` type from `typing` and the `Field` class from `pydantic`:
|
||||
|
||||
```python
|
||||
from typing import Annotated
|
||||
from pydantic import Field
|
||||
from typing import Annotated
|
||||
|
||||
arg: Annotated[<type>, Field(description="<description>")]
|
||||
```
|
||||
from pydantic import Field
|
||||
|
||||
<field_name>: Annotated[<type>, Field(description="<description>")]
|
||||
|
||||
Args:
|
||||
func: The function to wrap. If None, returns a decorator.
|
||||
|
||||
Reference in New Issue
Block a user