Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -27,9 +27,9 @@ exadata_specs = {
|
|
27 |
|
28 |
# --- Supported LLM Models ---
|
29 |
supported_llms = {
|
30 |
-
"gpt-3.5-turbo": "Fastest /
|
31 |
-
"gpt-4-turbo": "Balanced
|
32 |
-
"gpt-4o": "
|
33 |
}
|
34 |
|
35 |
# --- Utils ---
|
@@ -89,7 +89,7 @@ Compare observed vs theoretical. Recommend actions to close the performance gap.
|
|
89 |
return response.choices[0].message.content.strip()
|
90 |
|
91 |
class HealthAgent:
|
92 |
-
def check_health(self, content):
|
93 |
cleaned_content = clean_awr_content(content)
|
94 |
if len(cleaned_content) > 128000:
|
95 |
cleaned_content = cleaned_content[:128000] + "\n\n[TRUNCATED]..."
|
@@ -107,24 +107,12 @@ You MUST:
|
|
107 |
- Always confirm at the end if no CRITICAL or WARNING issues were found.
|
108 |
|
109 |
Special Attention Areas:
|
110 |
-
- Flash Cache or Flash Disk Failures
|
111 |
-
- I/O Subsystem stalls or
|
112 |
-
- ASM
|
113 |
-
- Smart Scan failures
|
114 |
-
- Redo Log issues
|
115 |
-
- RAC Interconnect
|
116 |
-
|
117 |
-
You are NOT allowed to generalize or omit any issue, no matter how small.
|
118 |
-
|
119 |
-
Specifically analyze Exadata Alerts Summary and Exadata Alerts Detail
|
120 |
-
|
121 |
-
Example Output:
|
122 |
-
🚨 CRITICAL
|
123 |
-
- [issue]
|
124 |
-
⚠️ WARNING
|
125 |
-
- [issue]
|
126 |
-
✅ INFO
|
127 |
-
- No other warnings or critical issues detected.
|
128 |
|
129 |
AWR CONTENT:
|
130 |
{cleaned_content}
|
@@ -143,15 +131,12 @@ AWR CONTENT:
|
|
143 |
class RaterAgent:
|
144 |
def rate(self, content):
|
145 |
prompt = f"Rate the following analysis from 1-5 stars and explain:\n\n{content}"
|
146 |
-
|
147 |
response = openrouter.chat.completions.create(
|
148 |
-
model="mistralai/Mixtral-8x7B-Instruct",
|
149 |
messages=[{"role": "user", "content": prompt}]
|
150 |
)
|
151 |
-
|
152 |
return response.choices[0].message.content.strip()
|
153 |
|
154 |
-
|
155 |
# === Main Process ===
|
156 |
def process_awr(awr_text, threshold, performance_test_mode, exadata_model, rack_size, llm_model):
|
157 |
analyzer = CriticalAnalyzerAgent()
|
@@ -174,7 +159,7 @@ def process_awr(awr_text, threshold, performance_test_mode, exadata_model, rack_
|
|
174 |
|
175 |
if stars < threshold:
|
176 |
analysis_retry = analyzer.analyze(awr_text, performance_test_mode, exadata_model, rack_size, llm_model)
|
177 |
-
rating_text_retry = rater.rate(analysis_retry
|
178 |
retry_status = "✅ Retry Occurred"
|
179 |
analysis = analysis_retry
|
180 |
rating_text = rating_text_retry
|
|
|
27 |
|
28 |
# --- Supported LLM Models ---
|
29 |
supported_llms = {
|
30 |
+
"gpt-3.5-turbo": "Fastest / Lowest Cost - General AWR Healthcheck",
|
31 |
+
"gpt-4-turbo": "Balanced - Production Performance Analysis",
|
32 |
+
"gpt-4o": "Deepest Analysis - Exadata, RAC, Smart Scan, Critical Issues",
|
33 |
}
|
34 |
|
35 |
# --- Utils ---
|
|
|
89 |
return response.choices[0].message.content.strip()
|
90 |
|
91 |
class HealthAgent:
|
92 |
+
def check_health(self, content, llm_model):
|
93 |
cleaned_content = clean_awr_content(content)
|
94 |
if len(cleaned_content) > 128000:
|
95 |
cleaned_content = cleaned_content[:128000] + "\n\n[TRUNCATED]..."
|
|
|
107 |
- Always confirm at the end if no CRITICAL or WARNING issues were found.
|
108 |
|
109 |
Special Attention Areas:
|
110 |
+
- Flash Cache or Flash Disk Failures
|
111 |
+
- I/O Subsystem stalls or errors
|
112 |
+
- ASM/Grid Disk issues
|
113 |
+
- Smart Scan failures
|
114 |
+
- Redo Log issues
|
115 |
+
- RAC Interconnect issues
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
AWR CONTENT:
|
118 |
{cleaned_content}
|
|
|
131 |
class RaterAgent:
|
132 |
def rate(self, content):
|
133 |
prompt = f"Rate the following analysis from 1-5 stars and explain:\n\n{content}"
|
|
|
134 |
response = openrouter.chat.completions.create(
|
135 |
+
model="mistralai/Mixtral-8x7B-Instruct",
|
136 |
messages=[{"role": "user", "content": prompt}]
|
137 |
)
|
|
|
138 |
return response.choices[0].message.content.strip()
|
139 |
|
|
|
140 |
# === Main Process ===
|
141 |
def process_awr(awr_text, threshold, performance_test_mode, exadata_model, rack_size, llm_model):
|
142 |
analyzer = CriticalAnalyzerAgent()
|
|
|
159 |
|
160 |
if stars < threshold:
|
161 |
analysis_retry = analyzer.analyze(awr_text, performance_test_mode, exadata_model, rack_size, llm_model)
|
162 |
+
rating_text_retry = rater.rate(analysis_retry)
|
163 |
retry_status = "✅ Retry Occurred"
|
164 |
analysis = analysis_retry
|
165 |
rating_text = rating_text_retry
|