Skip to content

Create Python ChatApp example for AI configuration - #1065

Merged
Matthew Metcalf (mrm9084) merged 36 commits into
mainfrom
copilot/fix-1064
Aug 22, 2025
Merged

Create Python ChatApp example for AI configuration#1065
Matthew Metcalf (mrm9084) merged 36 commits into
mainfrom
copilot/fix-1064

Conversation

Copilot AI commented May 22, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

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
Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>

Copilot AI commented May 22, 2025

Copy link
Copy Markdown
Contributor Author

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.

Comment thread examples/Python/ChatApp/requirements.txt Outdated
Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>
@mrm9084
Matthew Metcalf (mrm9084) marked this pull request as ready for review May 22, 2025 17:21
Comment thread examples/Python/ChatApp/app.py Outdated
Co-authored-by: zhenlan <10566826+zhenlan@users.noreply.github.com>
Comment thread examples/Python/ChatApp/README.md Outdated
Comment thread examples/Python/ChatApp/README.md Outdated
Comment thread examples/Python/ChatApp/README.md Outdated
Co-authored-by: mrm9084 <1054559+mrm9084@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread examples/Python/ChatApp/app.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@zhenlan

Copy link
Copy Markdown
Member

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

@zhenlan Zhenlan Wang (zhenlan) left a comment

Copy link
Copy Markdown
Member

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.

Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/models.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/models.py Outdated
Comment thread examples/Python/ChatApp/models.py Outdated
Comment thread examples/Python/ChatApp/models.py
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/models.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py Outdated
Comment thread examples/Python/ChatApp/app.py
Comment thread examples/Python/ChatApp/README.md Outdated
Comment thread examples/Python/ChatApp/README.md Outdated
Comment thread examples/Python/ChatApp/README.md Outdated
Comment thread examples/Python/ChatApp/README.md Outdated
Comment thread examples/Python/ChatApp/README.md Outdated
@mrm9084
Matthew Metcalf (mrm9084) merged commit 3c08331 into main Aug 22, 2025
6 checks passed
@mrm9084
Matthew Metcalf (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