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

Update inference_test_turkcell_with_intents.py

Browse files
inference_test_turkcell_with_intents.py CHANGED
@@ -166,7 +166,14 @@ async def generate_response(text):
166
  )
167
 
168
  try:
169
- return tokenizer.decode(output.sequences[0], skip_special_tokens=True).strip()
 
 
 
 
 
 
 
170
  except Exception as decode_error:
171
  log(f"❌ Decode hatası: {decode_error}")
172
  return random.choice(FALLBACK_ANSWERS)
 
166
  )
167
 
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}")
179
  return random.choice(FALLBACK_ANSWERS)