Artificial intelligence is transforming how we build software, automate tasks, and interact with digital tools. If you’ve ever wanted to add an intelligent chatbot or helper tool to your applications, you no longer need to architect everything from scratch. Azure AI Foundry provides an integrated suite for deploying and managing AI models, running evaluations and safety checks, enabling vector search with grounded data, and hosting LLMs securely.
This article outlines the process of creating an AI assistant on Azure and embedding it within a Python-based application.
Software Stack:
- Azure AI Foundry (For Assistant, LLM)
- Python and Flask (Web Application Backend)
- HTML, CSS, JavaScript (Web Application Frontend)
Set Up Azure AI Foundry:
- Login to Azure AI Portal : Microsoft Foundry
- From “Create New” select “Microsoft Foundry resource”
- Create a Project
- While creating a project you would need to create a subscription and a resource group, if you don’t have them already.
Once this setup is complete, we can now create an assistant for this project.
Create Assistant:
- Click on “Playgrounds” in the left pane and select “Assistants playground”.
- Click on “New Assistant”. An assistant will be created. Give the assistant a name.
- In the “deployment” we need to put a model to deploy.
-
- Click on “Create new deployment”.
- Click on from base models.
- Select a suitable model for deployment and confirm. Each model has a cost associated with it.
- In the pop-up customize, if required, and then click on “Deploy”.
Once this setup is complete, the assistant is ready for use. Additional configuration options are also available to further customize its behavior, which will be covered in the next section.
Customize Assistant:
There are several options available to customize and control the assistant’s behavior.
- Instructions: This is a very powerful option. A set of instructions can be provided for the assistant to customize how to translate and generate output based on specific user input. If we want to parse files and generate responses based on the file data, we can provide such instructions here, and the assistant would generate output accordingly. When providing instructions, it's crucial to ensure they are structured clearly and sequentially. Breaking complex, single-line directives into discrete, straightforward steps improves the assistant's ability to generate more accurate and effective output.
- File search: If the assistant needs to process input files and generate responses based on their content, the file storage option must be utilized. To enable this, a storage system needs to be created that uses a vector database to index and store the file data. Simply upload the local files via the provided pop-up interface, and Azure will parse the files, generate a vector database from the content, and configure the store for use.
- Code Interpreter: This feature allows the assistant to run and execute code directly within the conversation and create custom outputs based on the results of the code execution. The assistant can thus analyze datasets, perform calculations, and process data files (e.g., CSVs) without needing external tools. This functionality enhances the assistant's ability to solve complex tasks, including mathematical problems, data processing, and algorithm testing, without relying on external software or platforms.
- Functions: Functions are predefined or custom operations that extend the assistant’s capabilities. This feature enables the creation and integration of custom functions to perform specialized tasks such as querying databases, invoking APIs, or executing computations. By using functions, the assistant can tailor its responses based on user input, resulting in more dynamic and interactive behavior. Additionally, functions allow the assistant to connect with external systems—including cloud storage, CRM platforms, and analytics services—to deliver richer, more integrated workflows.
- Model Settings: Model Settings configure how the language model generates responses.
- Temperature: Temperature adjusts how conservative or creative the model should be when generating text. It controls the randomness of the model’s responses.
- Low temperature (e.g., 0.0–0.4) → Responses are more predictable, focused, and deterministic. The model selects the most likely next tokens. For example, “The ocean is a large body of water.”
- High temperature (e.g., 0.5–1.0) → Responses become more creative, varied, and unpredictable, allowing the model to explore less likely token options. For example, “An ocean is a vast, continuous body of saltwater that covers about 71% of Earth's surface and harbors diverse marine life.”
- Top P: It controls how many possible next-word choices the model considers when generating a response. Instead of picking from all possible words, it limits the selection to the smallest set of tokens whose combined probability exceeds P.
- Low value (0.1-0.4) → The model only considers the most likely words; responses are focused and predictable.
- High value (0.5-1.0) → The model considers a broader range of possible words; responses are more varied and creative.
After configuring the assistant’s behavior using these options, it is now tailored to our needs. We can begin interacting with it in the right-side chat window to accomplish our tasks.
Integration with Python:
We can integrate the assistant into our application using Python or any other programming language. By selecting the “View code” option in the playground, Azure provides a complete Python implementation of the assistant, including two authentication methods: Entra ID and API Key. We can choose the appropriate code sample based on our preferred authentication approach. This integration enables developers to build intelligent systems that utilize natural language understanding and generation. With Python’s rich ecosystem and Azure AI Assistant’s capabilities, developers can easily create advanced AI-driven tools, backend services, and end-to-end solutions. Additionally, we can design custom Agents to handle complex workflows tailored to our specific requirements.
Conclusion:
Implementing the Azure AI Assistant provides a powerful and flexible way to enhance applications with advanced conversational and automation capabilities. By configuring model settings, integrating custom functions, managing files, and leveraging Python or other programming languages, developers can tailor the assistant to meet a wide range of business and technical needs. The platform’s ability to connect with external systems, process complex workflows, and deliver intelligent, context-aware responses makes it a versatile solution for modern application development. Overall, Azure AI Assistant enables the creation of robust, AI-driven experiences that streamline tasks, improve user interaction, and support scalable, future-ready solutions.