Edit

Share via


Quickstart: Get started with Microsoft Foundry (Hub projects) (classic)

Applies only to: Foundry (classic) portal. This article isn't available for the new Foundry portal. Learn more about the new portal.

Note

Some links in this article might open content in the new Microsoft Foundry documentation instead of the Foundry (classic) documentation you're viewing now.

Tip

An alternate Foundry project quickstart is available: Quickstart: Get started with Microsoft 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

  1. Install prerequisites (Python, Azure CLI, login).
  2. 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

  1. Portal: Sign in, open hub project.
  2. Model catalog: select gpt-4o-mini.
  3. Use this model > accept default deployment name > Deploy.
  4. After success: Open in playground to verify.

Build your chat app

Create chat.py with sample code:

Tip

Code uses Azure AI Projects 1.x SDK and is incompatible with Azure AI Projects 2.x. Make sure you install the correct version azure-ai-projects==1.0.0b10 to use with the code in this article.

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

Quickstart: Get started with Foundry (Foundry projects).