Graham Paasch commited on
Commit
9e66f5e
·
1 Parent(s): e02b934

manual debugging

Browse files
Files changed (2) hide show
  1. app.py +11 -1
  2. debug_network.py +25 -0
app.py CHANGED
@@ -1,6 +1,12 @@
1
  import gradio as gr
2
  import os
3
 
 
 
 
 
 
 
4
  from agent.pipeline import (
5
  analyze_change,
6
  oob_troubleshoot,
@@ -243,6 +249,8 @@ def build_ui():
243
  # """)
244
 
245
  gr.Markdown("---")
 
 
246
 
247
  # Main Pipeline UI
248
  gr.Markdown("""### 🌿 Network Automation Pipeline
@@ -319,7 +327,9 @@ def build_ui():
319
 
320
  # Format status with API usage summary
321
  status = "## 🚀 Pipeline Execution Complete!\n\n"
322
-
 
 
323
  # Add API usage summary at the top
324
  stats = monitor.get_stats()
325
  status += f"### 💰 API Usage This Session\n"
 
1
  import gradio as gr
2
  import os
3
 
4
+ from debug_network import debug_connectivity
5
+ debug_connectivity()
6
+
7
+ print("DEBUG: OPENAI_API_KEY set?", bool(os.getenv("OPENAI_API_KEY")))
8
+ print("DEBUG: ANTHROPIC_API_KEY set?", bool(os.getenv("ANTHROPIC_API_KEY")))
9
+
10
  from agent.pipeline import (
11
  analyze_change,
12
  oob_troubleshoot,
 
249
  # """)
250
 
251
  gr.Markdown("---")
252
+ print("DEBUG: OPENAI_API_KEY set?", bool(os.getenv("OPENAI_API_KEY")))
253
+ print("DEBUG: ANTHROPIC_API_KEY set?", bool(os.getenv("ANTHROPIC_API_KEY")))
254
 
255
  # Main Pipeline UI
256
  gr.Markdown("""### 🌿 Network Automation Pipeline
 
327
 
328
  # Format status with API usage summary
329
  status = "## 🚀 Pipeline Execution Complete!\n\n"
330
+ print("DEBUG: OPENAI_API_KEY set?", bool(os.getenv("OPENAI_API_KEY")))
331
+ print("DEBUG: ANTHROPIC_API_KEY set?", bool(os.getenv("ANTHROPIC_API_KEY")))
332
+
333
  # Add API usage summary at the top
334
  stats = monitor.get_stats()
335
  status += f"### 💰 API Usage This Session\n"
debug_network.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # debug_network.py
2
+ import os, socket, requests
3
+
4
+ def debug_connectivity():
5
+ print("DEBUG: OPENAI_API_KEY present:", bool(os.getenv("OPENAI_API_KEY")))
6
+ print("DEBUG: ANTHROPIC_API_KEY present:", bool(os.getenv("ANTHROPIC_API_KEY")))
7
+
8
+ for host in ["api.openai.com", "api.anthropic.com"]:
9
+ try:
10
+ ip = socket.gethostbyname(host)
11
+ print(f"DEBUG: DNS for {host} -> {ip}")
12
+ except Exception as e:
13
+ print(f"DEBUG: DNS FAILED for {host}: {e}")
14
+
15
+ try:
16
+ r = requests.get("https://api.openai.com/v1/models", timeout=5)
17
+ print("DEBUG: OpenAI /v1/models status:", r.status_code)
18
+ except Exception as e:
19
+ print("DEBUG: OpenAI GET failed:", repr(e))
20
+
21
+ try:
22
+ r = requests.get("https://api.anthropic.com/health", timeout=5)
23
+ print("DEBUG: Anthropic /health status:", r.status_code)
24
+ except Exception as e:
25
+ print("DEBUG: Anthropic GET failed:", repr(e))