Skip to content

Commit dd80a1b

Browse files
Update readme, enable AI search by default, update model, change tpm (#4)
* allow users to set the model for the agent by environment variable * update the readme * enable AI Search Service by default * remove example images, add architecture diagram (to be updated later) * change default tokens per minute of model deployment from 30,000 to 50,000 * still need to rename repo to azure-ai-agents-chat * still need to implement functionality for agent export from AI Foundry and agents.yaml configuration * still need to finalize troubleshooting guide at the end
1 parent c58e7af commit dd80a1b

File tree

7 files changed

+384
-55
lines changed

7 files changed

+384
-55
lines changed

README.md

+281-50
Large diffs are not rendered by default.

assets/DeploymentError.png

-189 KB
Binary file not shown.

assets/FileSearchAgent.png

-243 KB
Binary file not shown.

docs/architecture.png

109 KB
Loading

docs/deploy_customization.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
# Getting Started with Agents Using Azure AI Foundry: Deployment customization
3+
4+
This document describes how to customize the deployment of the Agents Chat with Azure AI Foundry. Once you follow the steps here, you can run `azd up` as described in the [Deploying](./README.md#deploying) steps.
5+
6+
* [Disabling resources](#disabling-resources)
7+
* [Customizing resource names](#customizing-resource-names)
8+
* [Customizing model deployments](#customizing-model-deployments)
9+
10+
## Disabling resources
11+
12+
Disabling a resource will stop that resource from being created and deployed to your Azure Project.
13+
14+
* To disable AI Search, run `azd env set USE_SEARCH_SERVICE false`
15+
* To disable Application Insights, run `azd env set USE_APPLICATION_INSIGHTS false`
16+
* To disable Container Registry, run `azd env set USE_CONTAINER_REGISTRY false`
17+
18+
Once you disable these resources, they will not be deployed when you run `azd up`.
19+
20+
## Customizing resource names
21+
22+
By default, this template will use a naming convention with unique strings to prevent naming collisions within Azure.
23+
To override default naming conventions, the following keys can be set:
24+
25+
* `AZURE_AIHUB_NAME` - The name of the AI Foundry Hub resource
26+
* `AZURE_AIPROJECT_NAME` - The name of the AI Foundry Project
27+
* `AZURE_AIENDPOINT_NAME` - The name of the AI Foundry online endpoint used for deployments
28+
* `AZURE_AISERVICES_NAME` - The name of the Azure AI service
29+
* `AZURE_SEARCH_SERVICE_NAME` - The name of the Azure Search service
30+
* `AZURE_STORAGE_ACCOUNT_NAME` - The name of the Storage Account
31+
* `AZURE_KEYVAULT_NAME` - The name of the Key Vault
32+
* `AZURE_CONTAINER_REGISTRY_NAME` - The name of the container registry
33+
* `AZURE_APPLICATION_INSIGHTS_NAME` - The name of the Application Insights instance
34+
* `AZURE_LOG_ANALYTICS_WORKSPACE_NAME` - The name of the Log Analytics workspace used by Application Insights
35+
36+
To override any of those resource names, run `azd env set <key> <value>` before running `azd up`.
37+
38+
## Customizing model deployments
39+
40+
For more information on the Azure OpenAI models and non-Microsoft models that can be used in your deployment, view the [list of models supported by Azure AI Agent Service](https://learn.microsoft.com/azure/ai-services/agents/concepts/model-region-support)
41+
42+
To customize the model deployments, you can set the following environment variables:
43+
44+
### Using a different chat model
45+
46+
Change the chat deployment name:
47+
48+
```shell
49+
azd env set AZURE_AI_CHAT_DEPLOYMENT_NAME Phi-3.5-MoE-instruct
50+
```
51+
52+
Change the chat model format (either OpenAI or Microsoft):
53+
54+
```shell
55+
azd env set AZURE_AI_CHAT_MODEL_FORMAT Microsoft
56+
```
57+
58+
Change the chat model name:
59+
60+
```shell
61+
azd env set AZURE_AI_CHAT_MODEL_NAME Phi-3.5-MoE-instruct
62+
```
63+
64+
Set the version of the chat model:
65+
66+
```shell
67+
azd env set AZURE_AI_CHAT_MODEL_VERSION 2
68+
```
69+
70+
### Setting capacity and deployment SKU
71+
72+
For quota regions, you may find yourself needing to modify the default capacity and deployment SKU. The default tokens per minute deployed in this template is 50,000.
73+
74+
Change the capacity (in thousands of tokens per minute) of the chat deployment:
75+
76+
```shell
77+
azd env set AZURE_AI_CHAT_DEPLOYMENT_CAPACITY 50
78+
```
79+
80+
Change the SKU of the chat deployment:
81+
82+
```shell
83+
azd env set AZURE_AI_CHAT_DEPLOYMENT_SKU Standard
84+
```
85+
86+
Change the capacity (in thousands of tokens per minute) of the embeddings deployment:
87+
88+
```shell
89+
azd env set AZURE_AI_EMBED_DEPLOYMENT_CAPACITY 50
90+
```
91+
92+
Change the SKU of the embeddings deployment:
93+
94+
```shell
95+
azd env set AZURE_AI_EMBED_DEPLOYMENT_SKU Standard
96+
```

infra/main.parameters.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"value": "${USE_APPLICATION_INSIGHTS=true}"
4949
},
5050
"useSearchService": {
51-
"value": "${USE_SEARCH_SERVICE=false}"
51+
"value": "${USE_SEARCH_SERVICE=true}"
5252
},
5353
"chatDeploymentName": {
5454
"value": "${AZURE_AI_CHAT_DEPLOYMENT_NAME=gpt-4o-mini}"
@@ -66,7 +66,7 @@
6666
"value": "${AZURE_AI_CHAT_DEPLOYMENT_SKU=GlobalStandard}"
6767
},
6868
"chatDeploymentCapacity": {
69-
"value": "${AZURE_AI_CHAT_DEPLOYMENT_CAPACITY=30}"
69+
"value": "${AZURE_AI_CHAT_DEPLOYMENT_CAPACITY=50}"
7070
},
7171
"embedDeploymentName": {
7272
"value": "${AZURE_AI_EMBED_DEPLOYMENT_NAME=text-embedding-ada-002}"
@@ -84,7 +84,7 @@
8484
"value": "${AZURE_AI_EMBED_DEPLOYMENT_SKU=Standard}"
8585
},
8686
"embedDeploymentCapacity": {
87-
"value": "${AZURE_AI_EMBED_DEPLOYMENT_CAPACITY=30}"
87+
"value": "${AZURE_AI_EMBED_DEPLOYMENT_CAPACITY=50}"
8888
},
8989
"apiAppExists": {
9090
"value": "${SERVICE_API_RESOURCE_EXISTS=false}"

src/api/main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async def lifespan(app: fastapi.FastAPI):
5454
)
5555
logger.info("Created AIProjectClient")
5656

57-
file_names = ["product_info_1.md", "product_info_2.md"]
57+
file_names = ["product_info_1.md", "product_info_2.md"] #TODO: can we get the file names from the folder so customers can upload?
5858
for file_name in file_names:
5959
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'files', file_name))
6060
file = await ai_client.agents.upload_file_and_poll(file_path=file_path, purpose=FilePurpose.AGENTS)
@@ -73,12 +73,14 @@ async def lifespan(app: fastapi.FastAPI):
7373
toolset.add(file_search_tool)
7474

7575
agent = await ai_client.agents.create_agent(
76-
model="gpt-4o-mini",
76+
model=os.environ["AZURE_AI_CHAT_DEPLOYMENT_NAME"],
7777
name="my-assistant",
7878
instructions="You are helpful assistant",
7979
toolset=toolset
8080
)
8181
logger.info(f"Created agent, agent ID: {agent.id}")
82+
logger.info(f"Created agent, model name: {agent.model}")
83+
8284
except Exception as e:
8385
logger.error(f"Error creating agent: {e}", exc_info=True)
8486
raise RuntimeError(f"Failed to create the agent: {e}")

0 commit comments

Comments
 (0)