ciyidogan commited on
Commit
e170906
·
verified ·
1 Parent(s): 009011d

Update inference_test_turkcell_with_intents.py

Browse files
inference_test_turkcell_with_intents.py CHANGED
@@ -168,11 +168,10 @@ async def generate_response(text):
168
  try:
169
  decoded = tokenizer.decode(output.sequences[0], skip_special_tokens=True).strip()
170
  # Kullanıcı mesajlarını ve rolleri çıkar
171
- assistant_start = decoded.find("assistant
172
- ")
173
- if assistant_start != -1:
174
- return decoded[assistant_start + len("assistant
175
- "):].strip()
176
  return decoded
177
  except Exception as decode_error:
178
  log(f"❌ Decode hatası: {decode_error}")
 
168
  try:
169
  decoded = tokenizer.decode(output.sequences[0], skip_special_tokens=True).strip()
170
  # Kullanıcı mesajlarını ve rolleri çıkar
171
+ for tag in ["assistant", "<|im_start|>assistant"]:
172
+ start = decoded.find(tag)
173
+ if start != -1:
174
+ return decoded[start + len(tag):].strip()
 
175
  return decoded
176
  except Exception as decode_error:
177
  log(f"❌ Decode hatası: {decode_error}")