Skip to content

Commit 3a0f7fe

Browse files
committed
Fixing a few pylint issues
1 parent 433030d commit 3a0f7fe

2 files changed

Lines changed: 23 additions & 8 deletions

File tree

examples/Python/ChatApp/app.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
# Copyright (c) Microsoft Corporation.
2-
# Licensed under the MIT license.
3-
#
1+
# -------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
"""
7+
Azure App Configuration Chat Application using Azure OpenAI.
8+
This module provides a simple chat application that uses configurations from Azure App Configuration
9+
and connects to Azure OpenAI services for chat completions.
10+
"""
411
import os
12+
from typing import TypeVar, List
513
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
614
from azure.appconfiguration.provider import load, SettingSelector
715
from openai import AzureOpenAI
816
from models import ModelConfiguration, Message
9-
from typing import TypeVar, List
1017

1118
# Get Azure App Configuration endpoint from environment variable
1219
ENDPOINT = os.environ.get("AZURE_APPCONFIG_ENDPOINT")
@@ -22,7 +29,6 @@
2229
chat_app_selector = SettingSelector(key_filter="ChatApp:*")
2330

2431
# Load configuration from Azure App Configuration
25-
global config
2632
config = load(
2733
endpoint=ENDPOINT,
2834
selects=[chat_app_selector],

examples/Python/ChatApp/models.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# Copyright (c) Microsoft Corporation.
2-
# Licensed under the MIT license.
3-
#
1+
# -------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
"""
7+
Model classes for Azure OpenAI Chat Application.
8+
This module provides data classes for representing chat messages and model configurations
9+
used in the Azure OpenAI-powered chat application.
10+
"""
411
from typing import List, Optional, Dict, Any
512

613

@@ -11,6 +18,7 @@ class Message:
1118
"""
1219

1320
def __init__(self, role: Optional[str] = None, content: Optional[str] = None):
21+
"""Initialize a Message instance with role and content."""
1422
self.role = role
1523
self.content = content
1624

@@ -34,6 +42,7 @@ def __init__(
3442
temperature: float = 0.7,
3543
top_p: float = 0.95,
3644
):
45+
"""Initialize model configuration with parameters for OpenAI API calls."""
3746
self.model = model
3847
self.messages = messages or []
3948
self.max_tokens = int(max_tokens) if max_tokens is not None else 1024

0 commit comments

Comments
 (0)