Skip to content

Commit 908d293

Browse files
authored
Add Agent Memory Tool tests. Run Agent Memory tool samples as tests. (#44445)
1 parent eaf3c5c commit 908d293

17 files changed

+582
-129
lines changed

sdk/ai/azure-ai-projects/.env.template

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ AZURE_AI_PROJECTS_AZURE_RESOURCE_GROUP=
2525
AZURE_AI_PROJECTS_AZURE_AOAI_ACCOUNT=
2626

2727
# Used in Memory Store samples
28-
AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME=
29-
AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME=
28+
MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME=
29+
MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME=
3030

3131
# Used in Agent tools samples
3232
IMAGE_GENERATION_MODEL_DEPLOYMENT_NAME=
@@ -64,6 +64,10 @@ AZURE_AI_PROJECTS_TESTS_CONTAINER_INGRESS_SUBDOMAIN_SUFFIX=
6464
# Used in Agent Image Generation tests
6565
AZURE_AI_PROJECTS_TESTS_IMAGE_GENERATION_MODEL_DEPLOYMENT_NAME=
6666

67+
# Used in Memory Store tests
68+
AZURE_AI_PROJECTS_TESTS_MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME=
69+
AZURE_AI_PROJECTS_TESTS_MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME=
70+
6771
# Connection IDs and settings used in agent tool tests
6872
AZURE_AI_PROJECTS_TESTS_BING_PROJECT_CONNECTION_ID=
6973
AZURE_AI_PROJECTS_TESTS_AI_SEARCH_PROJECT_CONNECTION_ID=

sdk/ai/azure-ai-projects/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ Generate images based on text prompts with customizable resolution, quality, and
260260

261261
```python
262262
tool = ImageGenTool( # type: ignore[call-overload]
263-
model=image_generation_model, quality="low", size="1024x1024" # Model such as "gpt-image-1-mini" # type: ignore
263+
model=image_generation_model, # Model such as "gpt-image-1-mini" # type: ignore
264+
quality="low",
265+
size="1024x1024",
264266
)
265267
```
266268

sdk/ai/azure-ai-projects/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/ai/azure-ai-projects",
5-
"Tag": "python/ai/azure-ai-projects_5b7a7fa09e"
5+
"Tag": "python/ai/azure-ai-projects_ae8b55e649"
66
}

sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_image_generation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@
6262

6363
# [START tool_declaration]
6464
tool = ImageGenTool( # type: ignore[call-overload]
65-
model=image_generation_model, quality="low", size="1024x1024" # Model such as "gpt-image-1-mini" # type: ignore
65+
model=image_generation_model, # Model such as "gpt-image-1-mini" # type: ignore
66+
quality="low",
67+
size="1024x1024",
6668
)
6769
# [END tool_declaration]
6870

sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
page of your Microsoft Foundry portal.
2929
2) AZURE_AI_MODEL_DEPLOYMENT_NAME - The deployment name of the Agent's AI model,
3030
as found under the "Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
31-
3) AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model for memory,
31+
3) MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model for memory,
3232
as found under the "Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
33-
4) AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model for memory,
33+
4) MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model for memory,
3434
as found under the "Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
3535
"""
3636

@@ -52,7 +52,7 @@
5252
endpoint = os.environ["AZURE_AI_PROJECT_ENDPOINT"]
5353

5454
with (
55-
DefaultAzureCredential(exclude_interactive_browser_credential=False) as credential,
55+
DefaultAzureCredential() as credential,
5656
AIProjectClient(endpoint=endpoint, credential=credential) as project_client,
5757
project_client.get_openai_client() as openai_client,
5858
):
@@ -67,8 +67,8 @@
6767

6868
# Create a memory store
6969
definition = MemoryStoreDefaultDefinition(
70-
chat_model=os.environ["AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME"],
71-
embedding_model=os.environ["AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
70+
chat_model=os.environ["MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME"],
71+
embedding_model=os.environ["MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
7272
options=MemoryStoreDefaultOptions(
7373
user_profile_enabled=True, chat_summary_enabled=True
7474
), # Note: This line will not be needed once the service is fixed to use correct defaults

sdk/ai/azure-ai-projects/samples/agents/tools/sample_agent_memory_search_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
page of your Microsoft Foundry portal.
2929
2) AZURE_AI_MODEL_DEPLOYMENT_NAME - The deployment name of the Agent's AI model,
3030
as found under the "Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
31-
3) AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model for memory,
31+
3) MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model for memory,
3232
as found under the "Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
33-
4) AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model for memory,
33+
4) MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model for memory,
3434
as found under the "Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
3535
"""
3636

@@ -70,8 +70,8 @@ async def main() -> None:
7070

7171
# Create a memory store
7272
definition = MemoryStoreDefaultDefinition(
73-
chat_model=os.environ["AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME"],
74-
embedding_model=os.environ["AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
73+
chat_model=os.environ["MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME"],
74+
embedding_model=os.environ["MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
7575
options=MemoryStoreDefaultOptions(
7676
user_profile_enabled=True, chat_summary_enabled=True
7777
), # Note: This line will not be needed once the service is fixed to use correct defaults

sdk/ai/azure-ai-projects/samples/memories/sample_memory_advanced.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
Set these environment variables with your own values:
2727
1) AZURE_AI_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview
2828
page of your Microsoft Foundry portal.
29-
2) AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model, as found under the "Name" column in
29+
2) MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model, as found under the "Name" column in
3030
the "Models + endpoints" tab in your Microsoft Foundry project.
31-
3) AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model, as found under the
31+
3) MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model, as found under the
3232
"Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
3333
"""
3434

@@ -69,8 +69,8 @@
6969
chat_summary_enabled=True,
7070
)
7171
definition = MemoryStoreDefaultDefinition(
72-
chat_model=os.environ["AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME"],
73-
embedding_model=os.environ["AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
72+
chat_model=os.environ["MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME"],
73+
embedding_model=os.environ["MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
7474
options=options,
7575
)
7676
memory_store = project_client.memory_stores.create(

sdk/ai/azure-ai-projects/samples/memories/sample_memory_advanced_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
Set these environment variables with your own values:
2727
1) AZURE_AI_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview
2828
page of your Microsoft Foundry portal.
29-
2) AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model, as found under the "Name" column in
29+
2) MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model, as found under the "Name" column in
3030
the "Models + endpoints" tab in your Microsoft Foundry project.
31-
3) AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model, as found under the
31+
3) MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model, as found under the
3232
"Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
3333
"""
3434

@@ -73,8 +73,8 @@ async def main() -> None:
7373
chat_summary_enabled=True,
7474
)
7575
definition = MemoryStoreDefaultDefinition(
76-
chat_model=os.environ["AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME"],
77-
embedding_model=os.environ["AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
76+
chat_model=os.environ["MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME"],
77+
embedding_model=os.environ["MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
7878
options=options,
7979
)
8080
memory_store = await project_client.memory_stores.create(

sdk/ai/azure-ai-projects/samples/memories/sample_memory_basic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
Set these environment variables with your own values:
2525
1) AZURE_AI_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview
2626
page of your Microsoft Foundry portal.
27-
2) AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model, as found under the "Name" column in
27+
2) MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model, as found under the "Name" column in
2828
the "Models + endpoints" tab in your Microsoft Foundry project.
29-
3) AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model, as found under the
29+
3) MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model, as found under the
3030
"Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
3131
"""
3232

@@ -61,8 +61,8 @@
6161

6262
# Create a memory store
6363
definition = MemoryStoreDefaultDefinition(
64-
chat_model=os.environ["AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME"],
65-
embedding_model=os.environ["AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
64+
chat_model=os.environ["MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME"],
65+
embedding_model=os.environ["MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
6666
options=MemoryStoreDefaultOptions(
6767
user_profile_enabled=True, chat_summary_enabled=True
6868
), # Note: This line will not be needed once the service is fixed to use correct defaults

sdk/ai/azure-ai-projects/samples/memories/sample_memory_basic_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
Set these environment variables with your own values:
2626
1) AZURE_AI_PROJECT_ENDPOINT - The Azure AI Project endpoint, as found in the Overview
2727
page of your Microsoft Foundry portal.
28-
2) AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model, as found under the "Name" column in
28+
2) MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME - The deployment name of the chat model, as found under the "Name" column in
2929
the "Models + endpoints" tab in your Microsoft Foundry project.
30-
3) AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model, as found under the
30+
3) MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME - The deployment name of the embedding model, as found under the
3131
"Name" column in the "Models + endpoints" tab in your Microsoft Foundry project.
3232
"""
3333

@@ -66,8 +66,8 @@ async def main() -> None:
6666

6767
# Create a memory store
6868
definition = MemoryStoreDefaultDefinition(
69-
chat_model=os.environ["AZURE_AI_CHAT_MODEL_DEPLOYMENT_NAME"],
70-
embedding_model=os.environ["AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
69+
chat_model=os.environ["MEMORY_STORE_CHAT_MODEL_DEPLOYMENT_NAME"],
70+
embedding_model=os.environ["MEMORY_STORE_EMBEDDING_MODEL_DEPLOYMENT_NAME"],
7171
options=MemoryStoreDefaultOptions(
7272
user_profile_enabled=True, chat_summary_enabled=True
7373
), # Note: This line will not be needed once the service is fixed to use correct defaults

0 commit comments

Comments
 (0)