riazmo commited on
Commit
28d32bc
·
verified ·
1 Parent(s): 8fc9c81

Upload llm_agents.py

Browse files
Files changed (1) hide show
  1. agents/llm_agents.py +9 -10
agents/llm_agents.py CHANGED
@@ -271,13 +271,12 @@ Return ONLY valid JSON."""
271
 
272
  except Exception as e:
273
  error_msg = str(e)
274
- # Parse common HF errors
275
- if "Rate limit" in error_msg or "429" in error_msg:
276
- log(f" ⚠️ Rate limited - HF free tier exhausted")
277
- elif "Request ID:" in error_msg:
278
- log(f" ⚠️ HF API error (check token/model)")
279
- else:
280
- log(f" ⚠️ Error: {error_msg[:60]}")
281
  return BrandIdentification()
282
 
283
  def _format_color_data(self, color_tokens: dict) -> str:
@@ -486,7 +485,7 @@ Return ONLY valid JSON."""
486
  return result
487
 
488
  except Exception as e:
489
- log(f" ├─ ⚠️ Error: {str(e)[:50]}")
490
  return BenchmarkAdvice()
491
 
492
  def _format_comparisons(self, comparisons: list) -> str:
@@ -684,7 +683,7 @@ Return ONLY valid JSON."""
684
  return result
685
 
686
  except Exception as e:
687
- log(f" ├─ ⚠️ Error: {str(e)[:50]}")
688
  return BestPracticesResult()
689
 
690
  def _parse_response(self, response: str) -> BestPracticesResult:
@@ -880,7 +879,7 @@ Return ONLY valid JSON."""
880
  return result
881
 
882
  except Exception as e:
883
- log(f" ├─ ⚠️ Error: {str(e)[:50]}")
884
  return HeadSynthesis()
885
 
886
  def _parse_response(self, response: str) -> HeadSynthesis:
 
271
 
272
  except Exception as e:
273
  error_msg = str(e)
274
+ # Always log full error for diagnosis
275
+ log(f" ⚠️ Brand Identifier failed: {error_msg[:120]}")
276
+ if "gated" in error_msg.lower() or "access" in error_msg.lower():
277
+ log(f" └─ Model may require license acceptance at huggingface.co")
278
+ elif "Rate limit" in error_msg or "429" in error_msg:
279
+ log(f" └─ HF free tier rate limit — wait or upgrade to Pro")
 
280
  return BrandIdentification()
281
 
282
  def _format_color_data(self, color_tokens: dict) -> str:
 
485
  return result
486
 
487
  except Exception as e:
488
+ log(f" ├─ ⚠️ Benchmark Advisor failed: {str(e)[:120]}")
489
  return BenchmarkAdvice()
490
 
491
  def _format_comparisons(self, comparisons: list) -> str:
 
683
  return result
684
 
685
  except Exception as e:
686
+ log(f" ├─ ⚠️ Best Practices Validator failed: {str(e)[:120]}")
687
  return BestPracticesResult()
688
 
689
  def _parse_response(self, response: str) -> BestPracticesResult:
 
879
  return result
880
 
881
  except Exception as e:
882
+ log(f" ├─ ⚠️ Head Synthesizer failed: {str(e)[:120]}")
883
  return HeadSynthesis()
884
 
885
  def _parse_response(self, response: str) -> HeadSynthesis: