Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
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>
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@

load_dotenv()

print(f"Using AZURE_AI_PROJECT_ENDPOINT: {os.environ['AZURE_AI_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"],
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