Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- utility/__init__.py +0 -0
- utility/llm_config.py +21 -0
- utility/prompt.py +27 -0
utility/__init__.py
ADDED
|
File without changes
|
utility/llm_config.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from dotenv import load_dotenv
|
| 3 |
+
|
| 4 |
+
load_dotenv()
|
| 5 |
+
|
| 6 |
+
# Determine the API Key using multiple possible environment variable names
|
| 7 |
+
# The Scaler judge might use AZURE_OPENAI_API_KEY or OPENAI_API_KEY
|
| 8 |
+
api_key = os.getenv("HF_TOKEN") or os.getenv("AZURE_OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY")
|
| 9 |
+
|
| 10 |
+
llm_config = {
|
| 11 |
+
"temperature": 0,
|
| 12 |
+
"config_list": [
|
| 13 |
+
{
|
| 14 |
+
"model": os.getenv("MODEL_NAME", "mtor-gpt"), # Defaulting helps prevent crashes
|
| 15 |
+
"api_key": api_key,
|
| 16 |
+
"base_url": os.getenv("API_BASE_URL", os.getenv("AZURE_OPENAI_ENDPOINT")),
|
| 17 |
+
"api_type": "azure",
|
| 18 |
+
"api_version": os.getenv("AZURE_API_VERSION", "2024-02-15-preview")
|
| 19 |
+
}
|
| 20 |
+
]
|
| 21 |
+
}
|
utility/prompt.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
classifier_prompt = """
|
| 2 |
+
You are an IT ticket classifier.
|
| 3 |
+
|
| 4 |
+
Your task is to classify a given user-submitted IT support ticket into one of the following categories:
|
| 5 |
+
|
| 6 |
+
- Network Issue
|
| 7 |
+
- Hardware Issue
|
| 8 |
+
- Software Bug
|
| 9 |
+
- Access Request
|
| 10 |
+
- Password Reset
|
| 11 |
+
- Other
|
| 12 |
+
|
| 13 |
+
Respond ONLY in the following JSON format:
|
| 14 |
+
{
|
| 15 |
+
"ticket": "<Original ticket>",
|
| 16 |
+
"category": "<One of the categories>"
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
Examples:
|
| 20 |
+
Input: "I can't connect to the VPN."
|
| 21 |
+
Output: {"ticket": "I can't connect to the VPN.", "category": "Network Issue"}
|
| 22 |
+
|
| 23 |
+
Input: "The Outlook application crashes on launch."
|
| 24 |
+
Output: {"ticket": "The Outlook application crashes on launch.", "category": "Software Bug"}
|
| 25 |
+
|
| 26 |
+
Classify this ticket: {ticket}
|
| 27 |
+
"""
|