Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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 samples-v2/microsoft/python/quickstart/.env-template
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Update with appropriate values
# Rename the file to .env after updating

AZURE_AI_PROJECT_ENDPOINT="https://<YOUR-RESOURCE-NAME>.services.ai.azure.com/api/projects/<YOUR-PROJECT-NAME>"
AZURE_AI_FOUNDRY_PROJECT_ENDPOINT="https://<YOUR-RESOURCE-NAME>.services.ai.azure.com/api/projects/<YOUR-PROJECT-NAME>"
AZURE_AI_FOUNDRY_AGENT_NAME="MyAgent"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see Agent Name defined as env variable, but not used in samples. Should we hard-code the Agent name or read it from env variable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated to read from env var

AZURE_AI_FOUNDRY_MODEL_DEPLOYMENT_NAME="gpt-4.1-mini"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
load_dotenv()

project_client = AIProjectClient(
endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
endpoint=os.environ["AZURE_AI_FOUNDRY_PROJECT_ENDPOINT"],
credential=DefaultAzureCredential(),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
load_dotenv()

project_client = AIProjectClient(
endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
endpoint=os.environ["AZURE_AI_FOUNDRY_PROJECT_ENDPOINT"],
credential=DefaultAzureCredential(),
)

# <create_agent>
agent = project_client.agents.create_version(
agent_name="MyAgent",
definition=PromptAgentDefinition(
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["AZURE_AI_FOUNDRY_MODEL_DEPLOYMENT_NAME"],
instructions="You are a helpful assistant that answers general questions",
),
)
print(f"Agent created (id: {agent.id}, name: {agent.name}, version: {agent.version})")
# </create_agent>
11 changes: 8 additions & 3 deletions samples-v2/microsoft/python/quickstart/quickstart-responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@

load_dotenv()

print(f"Using AZURE_AI_FOUNDRY_PROJECT_ENDPOINT: {os.environ['AZURE_AI_FOUNDRY_PROJECT_ENDPOINT']}")
print(f"Using AZURE_AI_FOUNDRY_MODEL_DEPLOYMENT_NAME: {os.environ['AZURE_AI_FOUNDRY_MODEL_DEPLOYMENT_NAME']}")

project_client = AIProjectClient(
endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
endpoint=os.environ["AZURE_AI_FOUNDRY_PROJECT_ENDPOINT"],
credential=DefaultAzureCredential(),
)

# <generate_response>
openai_client = project_client.get_openai_client()

response = openai_client.responses.create(
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
model=os.environ["AZURE_AI_FOUNDRY_MODEL_DEPLOYMENT_NAME"],
input="What is the size of France in square miles?",
)
print(f"Response output: {response.output_text}")
print(f"Response output: {response.output_text}")
# </generate_response>
1 change: 1 addition & 0 deletions samples-v2/microsoft/python/quickstart/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
azure-ai-projects>=2.0.0a20250915020
azure-identity
python-dotenv
openai