aymnsk commited on
Commit
3c816b5
·
verified ·
1 Parent(s): 64b7867

Update inference.py

Browse files
Files changed (1) hide show
  1. inference.py +7 -1
inference.py CHANGED
@@ -1,7 +1,8 @@
 
 
1
  import requests
2
  import os
3
 
4
- # Fix: remove any accidental newline in the secret
5
  API_KEY = os.getenv("DEEPSEEK_KEY", "").strip()
6
 
7
  def deepseek_query(prompt):
@@ -21,6 +22,11 @@ def deepseek_query(prompt):
21
  try:
22
  response = requests.post(url, json=data, headers=headers)
23
  result = response.json()
 
 
 
 
 
24
  return result["choices"][0]["message"]["content"]
25
  except Exception as e:
26
  return f"[ERROR] {str(e)}"
 
1
+ # inference.py
2
+
3
  import requests
4
  import os
5
 
 
6
  API_KEY = os.getenv("DEEPSEEK_KEY", "").strip()
7
 
8
  def deepseek_query(prompt):
 
22
  try:
23
  response = requests.post(url, json=data, headers=headers)
24
  result = response.json()
25
+
26
+ # ✅ Debug: Print whole response if there's an issue
27
+ if "choices" not in result:
28
+ return f"[ERROR] choices not found in response: {result}"
29
+
30
  return result["choices"][0]["message"]["content"]
31
  except Exception as e:
32
  return f"[ERROR] {str(e)}"