kgauvin603 commited on
Commit
105b3fd
·
verified ·
1 Parent(s): 802e708

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -27
app.py CHANGED
@@ -27,9 +27,9 @@ exadata_specs = {
27
 
28
  # --- Supported LLM Models ---
29
  supported_llms = {
30
- "gpt-3.5-turbo": "Fastest / lowest cost (basic analysis), Standard AWR Healthcheck",
31
- "gpt-4-turbo": "Balanced (recommended default), Production Performance Analysis",
32
- "gpt-4o": "Deep + technical (best), Deep Dive, Exadata, RAC Stability, Risk Audit",
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 (including confined, offline, failed or dropped disks)
111
- - I/O Subsystem stalls or device errors
112
- - ASM Disk or Grid Disk issues
113
- - Smart Scan failures or skipped Smart Scans
114
- - Redo Log issues (e.g. log file sync slow)
115
- - RAC Interconnect problems (e.g. gc buffer busy waits, ORA-12170)
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", # FORCE to use Mixtral via OpenRouter
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, llm_model)
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