Skip to content

Azure-Samples/get-started-with-ai-chat

Repository files navigation

Get Started with Chat Using Azure AI Foundry

Solution Overview

This solution contains a simple chat application that is deployed to Azure Container Apps. There are instructions for deployment through GitHub Codespaces, VS Code Dev Containers, and your local development environment.

WARNING: This template, the application code and configuration it contains, has been built to showcase Microsoft Azure specific services and tools. We strongly advise our customers not to make this code part of their production environments without implementing or enabling additional security features.

For a more comprehensive list of best practices and security recommendations for Intelligent Applications, visit our official documentation.

Key Features

This solution creates an Azure AI Foundry, project and connected resources including Azure AI Services, AI Search and more. Here is a screenshot: Screenshot of chatting web application showing requests and responses between assistants and the user.

More details about the resources can be found in the resources documentation. There are options to enable Retrieval-Augmented Generation (RAG) and use logging, tracing, and monitoring.

Architecture diagram

Architecture diagram showing that user input is provided to the Azure Container App, which contains the app code. With user identity and resource access through managed identity, the input is used to form a response. The input and the Azure monitor are able to use the Azure resources deployed in the solution: Application Insights, Azure AI Project, Azure AI Services, Azure AI Hub, Storage account, Azure Container App, Container Registry, Key Vault, Log Analytics Workspace, and Search Service. The app code runs in Azure Container apps to process the user input and generate a response to the user. It leverages Azure AI projects and Azure AI services, including the model and search service.

Getting Started

Quick Deploy

Open in GitHub Codespaces Open in Dev Containers

Github Codespaces and Dev Containers both allow you to download and deploy the code for development. You can also continue with local development. Once you have selected your environment, click here to launch the development and deployment guide

Other Features

Once you have the agents and the web app working, you are encouraged to try one of the following:

  • Tracing and Monitoring - View console logs in Azure portal and App Insights tracing in Azure AI Foundry for debugging and performance monitoring.

Resource Clean-up

To prevent incurring unnecessary charges, it's important to clean up your Azure resources after completing your work with the application.

  • When to Clean Up:

    • After you have finished testing or demonstrating the application.
    • If the application is no longer needed or you have transitioned to a different project or environment.
    • When you have completed development and are ready to decommission the application.
  • Deleting Resources: To delete all associated resources and shut down the application, execute the following command:

    azd down

    Please note that this process may take up to 20 minutes to complete.

⚠️ Alternatively, you can delete the resource group directly from the Azure Portal to clean up resources.

Guidance

Costs

Pricing varies per region and usage, so it isn't possible to predict exact costs for your usage. The majority of the Azure resources used in this infrastructure are on usage-based pricing tiers. However, Azure Container Registry has a fixed cost per registry per day.

You can try the Azure pricing calculator for the resources:

  • Azure AI Foundry: Free tier. Pricing
  • Azure AI Search: Standard tier, S1. Pricing is based on the number of documents and operations. Pricing
  • Azure Storage Account: Standard tier, LRS. Pricing is based on storage and operations. Pricing
  • Azure AI Services: S0 tier, defaults to gpt-4o-mini and text-embedding-ada-002 models. Pricing is based on token count. Pricing
  • Azure Container App: Consumption tier with 0.5 CPU, 1GiB memory/storage. Pricing is based on resource allocation, and each month allows for a certain amount of free usage. Pricing
  • Azure Container Registry: Basic tier. Pricing
  • Log analytics: Pay-as-you-go tier. Costs based on data ingested. Pricing

⚠️ To avoid unnecessary costs, remember to take down your app if it's no longer in use, either by deleting the resource group in the Portal or running azd down.

Security guidelines

This template also uses Managed Identity for local development and deployment.

To ensure continued best practices in your own repository, we recommend that anyone creating solutions based on our templates ensure that the Github secret scanning setting is enabled.

You may want to consider additional security measures, such as:

Important Security Notice
This template, the application code and configuration it contains, has been built to showcase Microsoft Azure specific services and tools. We strongly advise our customers not to make this code part of their production environments without implementing or enabling additional security features.

For a more comprehensive list of best practices and security recommendations for Intelligent Applications, visit our official documentation.

Resources

This template creates everything you need to get started with Azure AI Foundry:

Resource Description
Azure AI Project Provides a collaborative workspace for AI development with access to models, data, and compute resources
Azure OpenAI Service Powers the AI agents for conversational AI and intelligent search capabilities. Default models deployed are gpt-4o-mini, but any Azure AI models can be specified per the documentation
Azure Container Apps Hosts and scales the web application with serverless containers
Azure Container Registry Stores and manages container images for secure deployment
Storage Account Provides blob storage for application data and file uploads
AI Search Service Optional - Enables hybrid search capabilities combining semantic and vector search
Application Insights Optional - Provides application performance monitoring, logging, and telemetry for debugging and optimization
Log Analytics Workspace Optional - Collects and analyzes telemetry data for monitoring and troubleshooting