Skip to content

Create Python ChatApp example for AI configuration#1065

Merged
mrm9084 merged 36 commits intomainfrom
copilot/fix-1064
Aug 22, 2025
Merged

Create Python ChatApp example for AI configuration#1065
mrm9084 merged 36 commits intomainfrom
copilot/fix-1064

Conversation

Copy link
Contributor

Copilot AI commented May 22, 2025

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.

@mrm9084
Copy link
Member

mrm9084 commented May 22, 2025

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

Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>
Copilot AI changed the title [WIP] Create Python ChatApp example for AI configuration Create Python ChatApp example for AI configuration May 22, 2025
Copilot AI requested a review from mrm9084 May 22, 2025 15:57
Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented May 22, 2025

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.

Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>
Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>
@mrm9084 mrm9084 marked this pull request as ready for review May 22, 2025 17:21
Co-authored-by: zhenlan <10566826+zhenlan@users.noreply.github.com>
Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a Python ChatApp sample that mirrors the .NET Core ChatApp sample, enabling chat interactions via both web and console interfaces.

  • Implements a Flask-based application that integrates Azure App Configuration and Azure OpenAI.
  • Defines model classes for messages and model configurations with dynamic configuration refresh support.
  • Includes updated dependency declarations and comprehensive setup documentation.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
examples/Python/ChatApp/requirements.txt Added necessary dependencies for Azure and OpenAI integration
examples/Python/ChatApp/models.py Added data model classes for Message and ModelConfiguration
examples/Python/ChatApp/app.py Implemented Flask app with configuration refresh and chat logic
examples/Python/ChatApp/README.md Documented setup, usage instructions, and configuration details

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@zhenlan
Copy link
Member

zhenlan commented Jul 1, 2025

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

Copy link
Member

@zhenlan zhenlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please clean up the redundant code generated by Copilot and make sure the code can run.

@mrm9084 mrm9084 self-requested a review July 7, 2025 19:14
@mrm9084 mrm9084 requested a review from zhenlan August 22, 2025 16:20
@mrm9084 mrm9084 merged commit 3c08331 into main Aug 22, 2025
6 checks passed
@mrm9084 mrm9084 deleted the copilot/fix-1064 branch August 22, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Python ChatApp example for AI configuration

5 participants