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: articles/ai-services/agents/concepts/tracing.md
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,11 +26,12 @@ Tracing solves this by allowing you to clearly see the inputs and outputs of eac
26
26
The Agents playground in the Azure AI Foundry portal lets you trace threads and runs that your agents produce. To open a trace, select **Thread info** in an active thread. You can also optionally select **Metrics** to enable automatic evaluations of the model's performance across several dimensions of **AI quality** and **Risk and safety**.
27
27
28
28
> [!NOTE]
29
-
> Evaluations are not available in the following regions.
30
-
> * australiaeast
31
-
> * japaneast
32
-
> * southindia
33
-
> * uksouth
29
+
> * Evaluations are available for 24 hours after they're generated.
30
+
> * Evaluations are not available in the following regions.
31
+
> * australiaeast
32
+
> * japaneast
33
+
> * southindia
34
+
> * uksouth
34
35
35
36
:::image type="content" source="../media/ai-foundry-tracing.png" alt-text="A screenshot of the agent playground in the Azure AI Foundry portal." lightbox="../media/ai-foundry-tracing.png":::
## Step 2: Get the connection ID for the Azure AI Search resource
61
-
Get the connection ID of the Azure AI Search connection in the project. You can use the code snippet to print the connection ID of all the Azure AI Search connections in the project.
56
+
## Step 2: Configure the Azure AI Search tool
57
+
Using the connection ID of your Azure AI Search resource, configure the Azure AI Search tool to use your Azure AI Search index.
62
58
63
59
```python
64
-
# AI Search resource connection ID
65
-
# This code looks for the AI Search Connection ID and saves it as variable conn_id
66
-
67
-
# If you have more than one AI search connection, try to establish the value in your .env file.
## Step 4: Create an agent with the Azure AI Search tool enabled
94
-
Change the model to the one deployed in your project. You can find the model name in the Azure AI Foundry under the **Models** tab. You can also change the name and instructions of the agent to suit your needs.
## Step 5: Ask the agent questions about data in the index
108
-
Now that the agent is created, ask it questions about the data in your Azure AI Search index. The example assumes your Azure AI Search index contains information about health care plans.
94
+
## Step 4: Ask the agent questions about data in the index
95
+
Now that the agent is created, ask it questions about the data in your Azure AI Search index.
109
96
110
97
```python
111
-
# Create a thread
112
-
thread = project_client.agents.create_thread()
113
-
print(f"Created thread, thread ID: {thread.id}")
114
-
115
-
# Create a message
116
-
message = project_client.agents.create_message(
98
+
from azure.ai.agents.models import MessageRole, ListSortOrder
99
+
100
+
# Create a thread for communication
101
+
thread = project_client.agents.threads.create()
102
+
print(f"Created thread, ID: {thread.id}")
103
+
104
+
# Send a message to the thread
105
+
message = project_client.agents.messages.create(
117
106
thread_id=thread.id,
118
-
role="user",
119
-
content="what are my health insurance plan coverage types?",
107
+
role=MessageRole.USER,
108
+
content="What is the temperature rating of the cozynights sleeping bag?",
run = project_client.agents.create_run(thread_id=thread.id, agent_id=agent.id)
143
-
# Monitor and process the run status. The function call should be placed on the input queue by the Agent Service for the Azure Function to pick up when requires_action is returned
144
-
while run.status in ["queued", "in_progress", "requires_action"]:
145
-
time.sleep(1)
146
-
run = project_client.agents.get_run(thread_id=thread.id, run_id=run.id)
147
-
148
-
if run.status notin ["queued", "in_progress", "requires_action"]:
For any issues with the Python code, create an issue on the [sample code repository](https://github.com/Azure-Samples/azure-functions-ai-services-agent-python/issues)
0 commit comments