Skip to content

Commit cedce84

Browse files
committed
add support for AI Service resource by adding the region header.
1 parent 21f888e commit cedce84

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

samples/agent-catalog/msft-agent-samples/foundry-agent-service-sdk/text-translation-agent/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ model_name:
77
# The connection name of the above resource when added in the Azure AI Foundry portal to your project
88
translator_resource_connection_name:
99

10+
# the region when the translator resource/AI service resource was created.
11+
translator_resource_region:
12+
1013
# Go to the page of above connection in the Azure AI Foundry portal, then construct the connection ID by append "/connections/<language_resource_connection_name>" to the wsid parameter value in the page URL.
1114
# For example, if the connection page URL contains "wsid=/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.CognitiveServices/accounts/<account_name>/projects/<project_name>",
1215
# Then the connection ID is /subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.CognitiveServices/accounts/<account_name>/projects/<project_name>/connections/<language_resource_connection_name>

samples/agent-catalog/msft-agent-samples/foundry-agent-service-sdk/text-translation-agent/template.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
# Create the agent
4040
agent = agents_client.create_agent(
4141
model=model_name,
42-
name="My_Translator_Agent",
43-
instructions="You are a translation agent. The user can use any language to interface with you and please answer in the same language as the customer. " +
42+
name="ms-translator",
43+
instructions="You are a translation agent. The user can use any language to interface with you and please answer in the same language as the user used. " +
4444
"Any translation asks must be performed via a call to the translator_api. In case of failure to call the translator_api indicate what was the failure",
4545
tools=translator_api_tool.definitions
4646
)
@@ -73,6 +73,6 @@
7373
last_text = msg.text_messages[-1]
7474
print(f"{msg.role}: {last_text.text.value}")
7575

76-
# Delete the Agent when done
76+
# Delete the Agent when done
7777
agents_client.delete_agent(agent.id)
7878
print("Deleted agent")

samples/agent-catalog/msft-agent-samples/foundry-agent-service-sdk/text-translation-agent/translator.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
"description": "Translates text into one or more languages.",
2525
"operationId": "Translator_Translate",
2626
"parameters": [
27+
{
28+
"name": "ocp-apim-subscription-region",
29+
"in": "header",
30+
"description": "the local region of the endpoint",
31+
"required": true,
32+
"schema": {
33+
"type": "string",
34+
"default": "${translator_resource_region}"
35+
}
36+
},
2737
{
2838
"name": "api-version",
2939
"in": "query",

0 commit comments

Comments
 (0)