Firsty1 commited on
Commit
7c00400
·
1 Parent(s): c9f668a

fix: use text_generation instead of chat_completion for Mistral

Browse files
Files changed (1) hide show
  1. pipeline/explainer.py +5 -5
pipeline/explainer.py CHANGED
@@ -39,12 +39,12 @@ class FallacyExplainer:
39
  print(f"FallacyExplainer ready (model: {model_id})")
40
 
41
  def _generate_with_prompt(self, prompt_text, max_new_tokens=128):
42
- result = self._client.chat_completion(
43
- messages=[{"role": "user", "content": prompt_text}],
44
- max_tokens=max_new_tokens,
45
  temperature=0.1,
46
- )
47
- return result.choices[0].message.content.strip()
48
 
49
  def _load_prompt(self, path):
50
  with open(BASE_DIR / path, "r") as f:
 
39
  print(f"FallacyExplainer ready (model: {model_id})")
40
 
41
  def _generate_with_prompt(self, prompt_text, max_new_tokens=128):
42
+ return self._client.text_generation(
43
+ prompt_text,
44
+ max_new_tokens=max_new_tokens,
45
  temperature=0.1,
46
+ do_sample=True,
47
+ ).strip()
48
 
49
  def _load_prompt(self, path):
50
  with open(BASE_DIR / path, "r") as f: