daniel-wojahn commited on
Commit
eef12aa
·
1 Parent(s): ce093f9

fix(llm): relax response validation to prevent crashes

Browse files
Files changed (1) hide show
  1. pipeline/llm_service.py +4 -5
pipeline/llm_service.py CHANGED
@@ -27,10 +27,10 @@ except ImportError:
27
  # Constants
28
  DEFAULT_MAX_TOKENS = 4000
29
  PREFERRED_MODELS = [
30
- "google/gemma-2-9b-it:free",
31
- "deepseek/deepseek-r1-0528:free",
32
  "qwen/qwen3-235b-a22b-07-25:free",
33
- "moonshotai/kimi-k2:free" # Keep as a final fallback
 
 
34
  ]
35
  DEFAULT_TEMPERATURE = 0.3
36
  DEFAULT_TOP_P = 0.9
@@ -568,8 +568,7 @@ Your analysis will be performed using the `{model_name}` model. Provide a concis
568
  # Check if at least some text names appear in the response
569
  text_name_matches = sum(1 for name in text_names if name in response)
570
  if text_names and text_name_matches == 0:
571
- logger.warning("LLM response does not mention any of the text names from the dataset")
572
- raise ValueError("Response does not reference any of the analyzed texts")
573
 
574
  # Ensure basic markdown structure
575
  if '##' not in response:
 
27
  # Constants
28
  DEFAULT_MAX_TOKENS = 4000
29
  PREFERRED_MODELS = [
 
 
30
  "qwen/qwen3-235b-a22b-07-25:free",
31
+ "deepseek/deepseek-r1-0528:free",
32
+ "google/gemma-2-9b-it:free",
33
+ "moonshotai/kimi-k2:free"
34
  ]
35
  DEFAULT_TEMPERATURE = 0.3
36
  DEFAULT_TOP_P = 0.9
 
568
  # Check if at least some text names appear in the response
569
  text_name_matches = sum(1 for name in text_names if name in response)
570
  if text_names and text_name_matches == 0:
571
+ logger.warning("LLM response does not mention any of the text names from the dataset. The analysis may be generic.")
 
572
 
573
  # Ensure basic markdown structure
574
  if '##' not in response: