Skip to content

Commit c2a9aa8

Browse files
committed
Fix titles
1 parent 38601dc commit c2a9aa8

File tree

2 files changed

+101
-101
lines changed

2 files changed

+101
-101
lines changed

learn-pr/wwl-data-ai/build-agent-with-custom-tools/includes/3-custom-tool-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Azure AI Agent Service offers various custom tools that enhance the capabilities and efficiency of your AI agents. These tools allow for scalable interoperability with various applications, making it easier to integrate with existing infrastructure or web services.
22

3-
## Custom tool options available in Azure AI services
3+
## Custom tool options available in Azure AI Agent Service
44

55
Azure AI services provide several custom tool options, including OpenAPI specified tools, Azure Functions, and function calling. These tools enable seamless integration with external APIs, event-driven applications, and custom functions.
66

learn-pr/wwl-data-ai/build-agent-with-custom-tools/includes/4-how-use-custom-tools.md

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Custom tools in an agent can be defined in a handful of ways, depending on what works best for your scenario. You may find that your company already has Azure Functions implemented for your agent to use, or a public OpenAPI specification gives your agent the functionality you're looking for.
22

3-
## Agents function calling
3+
## Function Calling
44

55
Function calling allows agents to execute predefined functions dynamically based on user input. This feature is ideal for scenarios where agents need to perform specific tasks, such as retrieving data or processing user queries, and can be done in code from within the agent. Your function may call out to other APIs to get additional information or initiate a program.
66

@@ -43,51 +43,93 @@ agent = project_client.agents.create_agent(
4343
)
4444
```
4545

46-
The agent can now call `recent_snowfall` dynamically when it determines that the prompt requires information that can be retrieved by the function.
46+
The agent can now call *recent_snowfall* dynamically when it determines that the prompt requires information that can be retrieved by the function.
4747

48-
## OpenAPI defined tools
48+
## Azure Functions
49+
50+
Azure Functions provide serverless computing capabilities for real-time processing. This integration is ideal for event-driven workflows, enabling agents to respond to triggers such as HTTP requests or queue messages.
51+
52+
### Example: Using Azure Functions with a queue trigger
53+
54+
First, develop and deploy your Azure Function. In this example, imagine we have a function in our Azure subscription to fetch the snowfall for a given location.
55+
56+
When your Azure Function is in place, integrate add it to the agent definition as an Azure Function tool:
57+
58+
```python
59+
storage_service_endpoint = "https://<your-storage>.queue.core.windows.net"
60+
61+
azure_function_tool = AzureFunctionTool(
62+
name="get_snowfall",
63+
description="Get snowfall information using Azure Function",
64+
parameters={
65+
"type": "object",
66+
"properties": {
67+
"location": {"type": "string", "description": "The location to check snowfall."},
68+
},
69+
"required": ["location"],
70+
},
71+
input_queue=AzureFunctionStorageQueue(
72+
queue_name="input",
73+
storage_service_endpoint=storage_service_endpoint,
74+
),
75+
output_queue=AzureFunctionStorageQueue(
76+
queue_name="output",
77+
storage_service_endpoint=storage_service_endpoint,
78+
),
79+
)
80+
81+
agent = project_client.agents.create_agent(
82+
model=os.environ["MODEL_DEPLOYMENT_NAME"],
83+
name="azure-function-agent",
84+
instructions="You are a snowfall tracking agent. Use the provided Azure Function to fetch snowfall based on location.",
85+
tools=azure_function_tool.definitions,
86+
)
87+
```
88+
89+
The agent can now send requests to the Azure Function via a storage queue and process the results.
90+
91+
## OpenAPI Specification
4992

5093
OpenAPI defined tools allow agents to interact with external APIs using standardized specifications. This approach simplifies API integration and ensures compatibility with various services. Azure AI Agent Service uses OpenAPI 3.0 specified tools.
5194

5295
> [!TIP]
53-
> Currently, three authentication types are supported with OpenAPI 3.0 tools: `anonymous`, `API key`, and `managed identity`.
96+
> Currently, three authentication types are supported with OpenAPI 3.0 tools: *anonymous*, *API key*, and *managed identity*.
5497
5598
### Example: Using an OpenAPI specification
5699

57-
1. **Prepare the OpenAPI spec**: Create a JSON file (`snowfall_openapi.json`) describing the API.
58-
59-
```json
60-
{
61-
"openapi": "3.0.0",
62-
"info": {
63-
"title": "Snowfall API",
64-
"version": "1.0.0"
65-
},
66-
"paths": {
67-
"/snow": {
68-
"get": {
69-
"summary": "Get snowfall information",
70-
"parameters": [
71-
{
72-
"name": "location",
73-
"in": "query",
74-
"required": true,
75-
"schema": {
76-
"type": "string"
77-
}
100+
First, create a JSON file ( in this example, called *snowfall_openapi.json*) describing the API.
101+
102+
```json
103+
{
104+
"openapi": "3.0.0",
105+
"info": {
106+
"title": "Snowfall API",
107+
"version": "1.0.0"
108+
},
109+
"paths": {
110+
"/snow": {
111+
"get": {
112+
"summary": "Get snowfall information",
113+
"parameters": [
114+
{
115+
"name": "location",
116+
"in": "query",
117+
"required": true,
118+
"schema": {
119+
"type": "string"
78120
}
79-
],
80-
"responses": {
81-
"200": {
82-
"description": "Successful response",
83-
"content": {
84-
"application/json": {
85-
"schema": {
86-
"type": "object",
87-
"properties": {
88-
"location": {"type": "string"},
89-
"snow": {"type": "string"}
90-
}
121+
}
122+
],
123+
"responses": {
124+
"200": {
125+
"description": "Successful response",
126+
"content": {
127+
"application/json": {
128+
"schema": {
129+
"type": "object",
130+
"properties": {
131+
"location": {"type": "string"},
132+
"snow": {"type": "string"}
91133
}
92134
}
93135
}
@@ -97,72 +139,30 @@ OpenAPI defined tools allow agents to interact with external APIs using standard
97139
}
98140
}
99141
}
100-
```
101-
102-
1. **Register the OpenAPI tool**:
103-
104-
```python
105-
from azure.ai.projects.models import OpenApiTool, OpenApiAnonymousAuthDetails
106-
107-
with open("snowfall_openapi.json", "r") as f:
108-
openapi_spec = json.load(f)
109-
110-
auth = OpenApiAnonymousAuthDetails()
111-
openapi_tool = OpenApiTool(name="snowfall_api", spec=openapi_spec, auth=auth)
112-
113-
agent = project_client.agents.create_agent(
114-
model="gpt-4o-mini",
115-
name="openapi-agent",
116-
instructions="You are a snowfall tracking assistant. Use the API to fetch snowfall data.",
117-
tools=[openapi_tool]
118-
)
119-
```
142+
}
143+
```
144+
145+
Then, register the OpenAPI tool in the agent defintion:
146+
147+
```python
148+
from azure.ai.projects.models import OpenApiTool, OpenApiAnonymousAuthDetails
149+
150+
with open("snowfall_openapi.json", "r") as f:
151+
openapi_spec = json.load(f)
152+
153+
auth = OpenApiAnonymousAuthDetails()
154+
openapi_tool = OpenApiTool(name="snowfall_api", spec=openapi_spec, auth=auth)
155+
156+
agent = project_client.agents.create_agent(
157+
model="gpt-4o-mini",
158+
name="openapi-agent",
159+
instructions="You are a snowfall tracking assistant. Use the API to fetch snowfall data.",
160+
tools=[openapi_tool]
161+
)
162+
```
120163

121164
The agent can now use the OpenAPI tool to fetch snowfall data dynamically.
122165

123-
## Azure Functions integration
124-
125-
Azure Functions provide serverless computing capabilities for real-time processing. This integration is ideal for event-driven workflows, enabling agents to respond to triggers such as HTTP requests or queue messages.
126-
127-
### Example: Using Azure Functions with a queue trigger
128-
129-
1. **Define an Azure Function**: Develop and deploy your Azure Function. In this example, imagine we have a function in our Azure subscription to fetch the snowfall for a given location.
130-
131-
1. **Integrate the Azure Function with the agent**:
132-
133-
```python
134-
storage_service_endpoint = "https://<your-storage>.queue.core.windows.net"
135-
136-
azure_function_tool = AzureFunctionTool(
137-
name="get_snowfall",
138-
description="Get snowfall information using Azure Function",
139-
parameters={
140-
"type": "object",
141-
"properties": {
142-
"location": {"type": "string", "description": "The location to check snowfall."},
143-
},
144-
"required": ["location"],
145-
},
146-
input_queue=AzureFunctionStorageQueue(
147-
queue_name="input",
148-
storage_service_endpoint=storage_service_endpoint,
149-
),
150-
output_queue=AzureFunctionStorageQueue(
151-
queue_name="output",
152-
storage_service_endpoint=storage_service_endpoint,
153-
),
154-
)
155-
156-
agent = project_client.agents.create_agent(
157-
model=os.environ["MODEL_DEPLOYMENT_NAME"],
158-
name="azure-function-agent",
159-
instructions="You are a snowfall tracking agent. Use the provided Azure Function to fetch snowfall based on location.",
160-
tools=azure_function_tool.definitions,
161-
)
162-
```
163-
164-
The agent can now send requests to the Azure Function via a storage queue and process the results.
165-
166166
> [!NOTE]
167167
> One of the concepts related to agents and custom tools that developers often have difficulty with is the *declarative* nature of the solution. You don't need to write code that explicitly *calls* your custom tool functions - the agent itself decides to call tool functions based on messages in prompts. By providing the agent with functions that have meaningful names and well-documented parameters, the agent can "figure out" when and how to call the function all by itself!
168168

0 commit comments

Comments
 (0)