Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/ai/azure-ai-projects/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/ai/azure-ai-projects",
"Tag": "python/ai/azure-ai-projects_314598932e"
"Tag": "python/ai/azure-ai-projects_93d1dc0fe7"
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,4 @@ def print_final_output(response):
final_output += getattr(part, "text", None) or getattr(part, "refusal", None) or "" + "\n"

print(f"Final status: {response.status}")
print(f"==> Result: {final_output.strip()}")
print(f"Final result: {final_output.strip()}")
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
)
elif event.type == "response.completed":
print(f"\nFollow-up completed!")
print(f"==> Result: {event.response.output_text}")
print(f"Agent response: {event.response.output_text}")

print("\nCleaning up...")
project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
file_path = os.path.join(tempfile.gettempdir(), filename)
with open(file_path, "wb") as f:
f.write(file_content.read())
# Print result (should contain "file")
print(f"==> Result: file, {file_path} downloaded successfully.")
print(f"File downloaded successfully: {file_path}")
else:
print("No file generated in response")
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ async def main() -> None:
file_path = os.path.join(tempfile.gettempdir(), filename)
with open(file_path, "wb") as f:
f.write(file_content.read())
# Print result (should contain "file")
print(f"==> Result: file, {file_path} downloaded successfully.")
print(f"File downloaded successfully: {file_path}")
else:
print("No file generated in response")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
input="Tell me about Contoso products",
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)
print(f"==> Result: {response.output_text}")
print(f"Agent response: {response.output_text}")
print("\nCleaning up...")
project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version)
print("Agent deleted")
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
print(f"File Citation - Filename: {annotation.filename}, File ID: {annotation.file_id}")
elif event.type == "response.completed":
print(f"\nFollow-up completed!")
print(f"==> Result: {event.response.output_text}")
print(f"Agent response: {event.response.output_text}")

# Clean up resources
print("\n" + "=" * 60)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def main() -> None:
print(f"File Citation - Filename: {annotation.filename}, File ID: {annotation.file_id}")
elif event.type == "response.completed":
print(f"\nFollow-up completed!")
print(f"==> Result: {event.response.output_text}")
print(f"Agent response: {event.response.output_text}")

# Clean up resources
print("\n" + "=" * 60)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ def get_horoscope(sign: str) -> str:
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)

# Print result (should contain "Tuesday")
print(f"==> Result: {response.output_text}")
print(f"Agent response: {response.output_text}")

print("\nCleaning up...")
project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ async def main():
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)

# Print result (should contain "Tuesday")
print(f"==> Result: {response.output_text}")
print(f"Agent response: {response.output_text}")


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,4 @@
f.write(base64.b64decode(image_data[0]))

# [END download_image]
# Print result (should contain "file")
print(f"==> Result: Image downloaded and saved to file: {file_path}")
print(f"Image saved to: {file_path}")
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ async def main():
with open(file_path, "wb") as f:
f.write(base64.b64decode(image_data[0]))

# Print result (should contain "file")
print(f"==> Result: Image downloaded and saved to file: {file_path}")
print(f"Image saved to: {file_path}")


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)

# Print result (should contain "Azure")
print(f"==> Result: {response.output_text}")
print(f"Agent response: {response.output_text}")

# Clean up resources by deleting the agent version
# This prevents accumulation of unused agent versions in your project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ async def main():
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)

# Print result (should contain "Azure")
print(f"==> Result: {response.output_text}")
print(f"Agent response: {response.output_text}")

# Clean up resources by deleting the agent version
# This prevents accumulation of unused agent versions in your project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@
input="Use the OpenAPI tool to print out, what is the weather in Seattle, WA today.",
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)
# Print result (should contain "\u00b0F")
print(f"==> Result: {response.output_text}")
print(f"Agent response: {response.output_text}")

print("\nCleaning up...")
project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
)
elif event.type == "response.completed":
print(f"\nFollow-up completed!")
print(f"==> Result: {event.response.output_text}")
print(f"Agent response: {event.response.output_text}")

print("Cleaning up...")
project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
input="Show me the latest London Underground service updates",
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)
print(f"==> Result: {response.output_text}")
print(f"Agent response: {response.output_text}")

print("\nCleaning up...")
project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from azure.ai.projects.models import PromptAgentDefinition, CodeInterpreterTool, CodeInterpreterToolAuto, FunctionTool
from openai.types.responses.response_input_param import FunctionCallOutput, ResponseInputParam


class TestAgentCodeInterpreterAndFunction(TestBase):
"""Tests for agents using Code Interpreter + Function Tool combination."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ def calculate_sum(numbers):
# Verify findings discuss the code (proves File Search was used)
findings_lower = arguments["findings"].lower()
assert any(
keyword in findings_lower for keyword in ["sum", "calculate", "function", "numbers", "list", "return"]
keyword in findings_lower
for keyword in ["sum", "calculate", "function", "numbers", "list", "return"]
), f"Expected findings to discuss the code content. Got: {arguments['findings'][:100]}"

input_list.append(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# The tests in this file rely on an existing Azure AI Search project connection that has been populated with the following document:
# https://arxiv.org/pdf/2508.03680


class TestAgentAISearch(TestBase):

# Test questions with expected answers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# The tests in this file rely on an existing Azure AI Search project connection that has been populated with the following document:
# https://arxiv.org/pdf/2508.03680


class TestAgentAISearchAsync(TestBase):

# Test questions with expected answers
Expand Down
10 changes: 9 additions & 1 deletion sdk/ai/azure-ai-projects/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
add_general_regex_sanitizer,
add_body_key_sanitizer,
add_remove_header_sanitizer,
add_general_string_sanitizer,
add_body_regex_sanitizer,
)

if not load_dotenv(find_dotenv(), override=True):
Expand Down Expand Up @@ -120,6 +120,14 @@ def sanitize_url_paths():
value="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/00000/providers/Microsoft.MachineLearningServices/workspaces/00000/connections/connector-name",
)

# Sanitize print output from sample validation to prevent replay failures when print statements change
# Only targets the validation Responses API call by matching the unique input prefix
add_body_key_sanitizer(
json_path="$.input",
value="sanitized-print-output",
regex=r"print contents array = .*",
)

# Remove Stainless headers from OpenAI client requests, since they include platform and OS specific info, which we can't have in recorded requests.
# Here is an example of all the `x-stainless` headers from a Responses call:
# x-stainless-arch: other:amd64
Expand Down
Loading