Jacksuyu commited on
Commit
2ffc6cc
·
1 Parent(s): fc9090a

fix: sanitize OPENAI_API_KEY format in workflow classifier

Browse files
src/web_user_summary/llm_requirement_filter.py CHANGED
@@ -94,6 +94,9 @@ def call_ollama_single(model: str, item: Dict) -> Dict:
94
 
95
  def call_openai(model: str, items: List[Dict]) -> Dict:
96
  api_key = (os.getenv("OPENAI_API_KEY") or "").strip().strip('"').strip("'")
 
 
 
97
  if not api_key:
98
  raise RuntimeError("OPENAI_API_KEY is not set")
99
 
 
94
 
95
  def call_openai(model: str, items: List[Dict]) -> Dict:
96
  api_key = (os.getenv("OPENAI_API_KEY") or "").strip().strip('"').strip("'")
97
+ if api_key.lower().startswith("bearer "):
98
+ api_key = api_key[7:]
99
+ api_key = re.sub(r"\s+", "", api_key)
100
  if not api_key:
101
  raise RuntimeError("OPENAI_API_KEY is not set")
102