You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sdk/ai/azure-ai-projects/CHANGELOG.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,18 @@
1
1
# Release History
2
2
3
+
## 1.0.0b4 (2024-12-20)
4
+
5
+
### Bugs Fixed
6
+
7
+
* Fix for Agent streaming issue (see [GitHub issue 38918](https://github.com/Azure/azure-sdk-for-python/issues/38918))
8
+
* Fix for Agent async function `send_email_async` is not called (see [GitHub issue 38898](https://github.com/Azure/azure-sdk-for-python/issues/38898))
9
+
* Fix for Agent streaming with event handler fails with "AttributeError: 'MyEventHandler' object has no attribute 'buffer'" (see [GitHub issue 38897](https://github.com/Azure/azure-sdk-for-python/issues/38897))
10
+
11
+
### Features Added
12
+
13
+
* Add optional input argument `connection_name` to methods `.inference.get_chat_completions_client`,
14
+
`.inference.get_embeddings_client` and `.inference.get_azure_openai_client`.
weather = mock_weather_data.get(location, "Weather data not available for this location.")
20
+
weather_json = json.dumps({"weather": weather})
21
+
return weather_json
22
+
```
23
+
24
+
Here is an example to attach this function definition to create_agent
25
+
26
+
```python
27
+
functions = FunctionTool({fetch_weather})
28
+
29
+
agent = project_client.agents.create_agent(
30
+
model=os.environ["MODEL_DEPLOYMENT_NAME"],
31
+
name="my-assistant",
32
+
instructions="You are a helpful assistant",
33
+
tools=functions.definitions,
34
+
)
35
+
```
36
+
37
+
To verify that the SDK parsed the docstring properly, you can print the definition:
38
+
39
+
```python
40
+
[print(json.dumps(tool.as_dict(), indent=4)) for tool in functions.definitions]
41
+
```
42
+
43
+
Alternatively user can check the tools property in newly created agent:
44
+
45
+
```python
46
+
[print(json.dumps(tool.as_dict(), indent=4)) for tool in agent.tools if tool.type =="function"]
47
+
```
48
+
49
+
The terminal will display the definition as below:
50
+
51
+
```json
52
+
[
53
+
{
54
+
"type": "function",
55
+
"function": {
56
+
"name": "fetch_weather",
57
+
"description": "Fetches the weather information for the specified location.",
58
+
"parameters": {
59
+
"type": "object",
60
+
"properties": {
61
+
"location": {
62
+
"type": "string",
63
+
"description": "The location to fetch weather for."
64
+
}
65
+
},
66
+
"required": [
67
+
"location"
68
+
]
69
+
}
70
+
}
71
+
}
72
+
]
73
+
```
74
+
75
+
## Requirements for FunctionTool
76
+
77
+
To ensure `FunctionTool` operates correctly and generates accurate function definitions that agents can reliably call, adhere to the following standards:
78
+
79
+
1.**Type Annotations**
80
+
- All function parameters and return types should be explicitly type-annotated using Python's type hinting.
81
+
82
+
2.**Structured Docstrings**
83
+
- Utilize a consistent docstring format similar to the example above (see also related agent samples in this repository).
84
+
- Include clear descriptions for each function and parameter.
85
+
86
+
3.**Supported Types**
87
+
88
+
`FunctionTool` maps common Python types to their JSON Schema equivalents, ensuring accurate representation without complex type details:
# Create agent with AI search tool and process assistant run
463
466
with project_client:
464
467
agent = project_client.agents.create_agent(
465
-
model="gpt-4o-mini",
468
+
model=os.environ["MODEL_DEPLOYMENT_NAME"],
466
469
name="my-assistant",
467
470
instructions="You are a helpful assistant",
468
471
tools=ai_search.definitions,
@@ -482,6 +485,8 @@ You can enhance your Agents by defining callback functions as function tools. Th
482
485
483
486
For more details about calling functions by code, refer to [`sample_agents_stream_eventhandler_with_functions.py`](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_stream_eventhandler_with_functions.py) and [`sample_agents_functions.py`](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/sample_agents_functions.py).
484
487
488
+
For more details about requirements and specification of functions, refer to [Function Tool Specifications](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/FunctionTool.md)
489
+
485
490
Here is an example to use [user functions](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/ai/azure-ai-projects/samples/agents/user_functions.py) in `toolset`:
#### Create Message with Code Interpreter Attachment
663
674
664
-
To attach a file to a message for data analysis, you use `MessageAttachment` and `CodeInterpreterTool`. You must pass `CodeInterpreterTool` as `tools` or `toolset` in `create_agent` call or the file attachment cannot be opened for code interpreter.
675
+
To attach a file to a message for data analysis, use `MessageAttachment` and `CodeInterpreterTool` classes. You must pass `CodeInterpreterTool` as `tools` or `toolset` in `create_agent` call or the file attachment cannot be opened for code interpreter.
665
676
666
677
Here is an example to pass `CodeInterpreterTool` as tool:
667
678
@@ -671,7 +682,7 @@ Here is an example to pass `CodeInterpreterTool` as tool:
671
682
# Notice that CodeInterpreter must be enabled in the agent creation,
672
683
# otherwise the agent will not be able to see the file attachment for code interpretation
0 commit comments