Azure / Azure/azure-sdk-for-python

Failed to add multiple AzureAISearchTools in ToolSet

Aperta
#41,498 6 commenti 0 reazioni 1 assegnatario Assegnata a @glharper Vedi su GitHub
AI Agents Client customer-reported feature-request needs-team-attention question
Lingua principale
Python
Stelle
5.6k
Fork
3.4k
Merge medio
2g 2h
PR unite (30g)
213

Descrizione

- **Package Name**: azure-ai-agents
- **Package Version**: 1.1.0b1
- **Operating System**: Ubuntu 22.04
- **Python Version**: 3.10.12

**Describe the bug**
I have several Azure AI Search indexes, each responsible for a different set of knowledge. I would like to convert these AI Search indexes into tools, so that my AI Agent can use the appropriate tool (i.e., index) depending on the specific task.

I tried adding these tools using ToolSet, but I encountered the following error:
```
Traceback (most recent call last):
File "/workspace/Azure_Agent/61_Agent_ToolSet.py", line 98, in
toolset.add(ai_search_tool2)
File "/usr/local/lib/python3.10/dist-packages/azure/ai/agents/models/_patch.py", line 1206, in add
raise ValueError("Tool of type {type(tool).__name__} already exists in the ToolSet.")
ValueError: Tool of type {type(tool).__name__} already exists in the ToolSet.
```

Here is my code:
```
ai_search_tool1 = AzureAISearchTool(
index_connection_id="xxx",
index_name="index1",
query_type=AzureAISearchQueryType.VECTOR_SEMANTIC_HYBRID,
top_k=3,
filter=""
)
ai_search_tool2 = AzureAISearchTool(
index_connection_id="xxx",
index_name="index2",
query_type=AzureAISearchQueryType.VECTOR_SEMANTIC_HYBRID,
top_k=3,
filter=""
)

toolset = ToolSet()
toolset.add(ai_search_tool1)
toolset.add(ai_search_tool2)

with agents_client:
agent = agents_client.create_agent(
model="gpt-4o",
name="agent-sdk-kk-with-toolset",
instructions="You are a helpful agent. To answer user question, you can use tools to retrieve information from diff AI Search Tools",
toolset=toolset,
)

```
Could you please help me understand how to properly configure this setup, or let me know if there are any limitations I should be aware of?

Thank you in advance for your assistance.

Kevin Kuei
**To Reproduce**
Steps to reproduce the behavior:
1. check the code snippets

**Expected behavior**
Agent can use multiple AzureAISearch tools

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.