AppConfiguration icon indicating copy to clipboard operation
AppConfiguration copied to clipboard

Create Python ChatApp example for AI configuration

Open Copilot opened this issue 5 months ago • 4 comments
trafficstars

This PR adds a Python ChatApp example that mirrors the functionality of the .NET Core ChatApp sample for AI configuration.

Key Features

  • Implemented using Python and Flask as required
  • Uses azure-appconfiguration-provider for configuration management
  • Configured to load and refresh settings from Azure App Configuration
  • Integrates with Azure OpenAI for chat completions
  • Supports both web interface and console-like views
  • Leverages modern Python practices and the latest stable packages

Implementation Details

  • Created a Python application that mirrors the functionality of the .NET Core ChatApp example
  • Implemented model classes equivalent to the .NET Message and ModelConfiguration classes
  • Added support for dynamically refreshing configuration from Azure App Configuration
  • Built a web UI for chatting with the AI, as well as a console-like mode

Files Added

  • app.py - Main Flask application with Azure OpenAI integration
  • models.py - Contains data model classes for Message and ModelConfiguration
  • requirements.txt - Dependencies with latest stable versions
  • README.md - Setup and usage documentation
  • templates/ - HTML templates for the web interface

Fixes #1064.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar May 22 '25 15:05 Copilot

I've updated the description, this should be a console app, so Flask isn't needed.

mrm9084 avatar May 22 '25 15:05 mrm9084

I've updated the description, this should be a console app, so Flask isn't needed.

I've converted the app from a Flask web application to a console app similar to the .NET Core implementation. The changes include removing Flask dependencies, implementing a console-based interface with a continuous loop, and updating the documentation. All templates have been removed since they're not needed for a console app. See commit caf9cd0.

Copilot avatar May 22 '25 16:05 Copilot

I've fixed the auth and model issues. But the app doesn't actually take in user input to chat.

mrm9084 avatar May 23 '25 22:05 mrm9084

I've fixed the auth and model issues. But the app doesn't actually take in user input to chat.

I've implemented user input functionality for the chat application in 00136bd. Now the app allows users to have a continuous conversation with the AI model. The app displays the initial messages from the configuration, gets an AI response, and then prompts the user for input. The conversation history is maintained throughout the session while still refreshing configuration parameters at the beginning of each cycle.

Copilot avatar May 23 '25 22:05 Copilot

@mrm9084 the .NET ChatApp has been updated (#1075). Can you please update the python example accordingly?

zhenlan avatar Jul 01 '25 22:07 zhenlan