Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
An alternate Foundry project quickstart is available: Quickstart: Get started with Azure AI Foundry (Foundry projects).
This quickstart sets up your local environment for hub-based projects, deploys a model, and builds a simple traced/evaluable chat script.
Prerequisites
- Azure subscription.
- Existing hub project (or create one). If not, consider using a Foundry project quickstart.
Set up your development environment
- Install prerequisites (Python, Azure CLI, login).
- Install packages:
pip install azure-ai-inference azure-identity azure-ai-projects==1.0.0b10
Different project types need distinct azure-ai-projects versions. Keep each project in its own isolated environment to avoid conflicts.
Deploy a model
- Portal: Sign in, open hub project.
- Model catalog: select gpt-4o-mini.
- Use this model > accept default deployment name > Deploy.
- After success: Open in playground to verify.
Build your chat app
Create chat.py with sample code:
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
project_connection_string = "<your-connection-string-goes-here>"
project = AIProjectClient.from_connection_string(
conn_str=project_connection_string, credential=DefaultAzureCredential()
)
chat = project.inference.get_chat_completions_client()
response = chat.complete(
model="gpt-4o-mini",
messages=[
{
"role": "system",
"content": "You are an AI assistant that speaks like a techno punk rocker from 2350. Be cool but not too cool. Ya dig?",
},
{"role": "user", "content": "Hey, can you help me with my taxes? I'm a freelancer."},
],
)
print(response.choices[0].message.content)
Insert your project connection string from the project Overview page (copy, replace placeholder in code).
Run:
python chat.py
Add prompt templating
Add get_chat_response using mustache template (see chat-template.py sample) then invoke with user/context messages.
Run again to view templated response.
Clean up resources
Delete deployment or project when done to avoid charges.
Next step
Related content
Quickstart: Get started with Azure AI Foundry (Foundry projects).