aidlmrza commited on
Commit
c3ef1f4
·
verified ·
1 Parent(s): 730172a

Update app/services/llm_engine.py

Browse files
Files changed (1) hide show
  1. app/services/llm_engine.py +5 -0
app/services/llm_engine.py CHANGED
@@ -139,6 +139,7 @@ class LLMEngine:
139
  )
140
  return json.loads(response_content)
141
  except Exception as e:
 
142
  return {"question_text": f"Error generate soal.{e}", "grading_rubric": {}}
143
 
144
  async def evaluate_answer(self, user_answer: str, question_context: dict):
@@ -170,6 +171,7 @@ class LLMEngine:
170
  # Parsing string JSON menjadi Dictionary Python
171
  return json.loads(response_content)
172
  except:
 
173
  return {"score": 0, "feedback": "Error menilai.", "is_correct": False}
174
 
175
  async def casual_chat(self, user_text: str, history: list = [], keyword_context: str = "", dataset_status: str = "NOT_FOUND"):
@@ -234,6 +236,7 @@ class LLMEngine:
234
  temperature=0.3
235
  )
236
  except Exception as e:
 
237
  return f"Maaf, otak saya sedang error. (Error: {str(e)})"
238
 
239
 
@@ -268,6 +271,7 @@ class LLMEngine:
268
  temperature=0.7
269
  )
270
  except:
 
271
  return f"Kamu cocok jadi {role}!"
272
 
273
  async def analyze_progress(self, user_name: str, progress_data: dict):
@@ -306,6 +310,7 @@ class LLMEngine:
306
  temperature=0.7
307
  )
308
  except Exception as e:
 
309
  return f"Error generate progress: {str(e)}"
310
 
311
 
 
139
  )
140
  return json.loads(response_content)
141
  except Exception as e:
142
+ print(f"ERROR Generate: {e}")
143
  return {"question_text": f"Error generate soal.{e}", "grading_rubric": {}}
144
 
145
  async def evaluate_answer(self, user_answer: str, question_context: dict):
 
171
  # Parsing string JSON menjadi Dictionary Python
172
  return json.loads(response_content)
173
  except:
174
+ print(f"ERROR Evaluate answer: {e}")
175
  return {"score": 0, "feedback": "Error menilai.", "is_correct": False}
176
 
177
  async def casual_chat(self, user_text: str, history: list = [], keyword_context: str = "", dataset_status: str = "NOT_FOUND"):
 
236
  temperature=0.3
237
  )
238
  except Exception as e:
239
+ print(f"ERROR Casual chat: {e}")
240
  return f"Maaf, otak saya sedang error. (Error: {str(e)})"
241
 
242
 
 
271
  temperature=0.7
272
  )
273
  except:
274
+ print(f"ERROR Psych Analyze: {e}")
275
  return f"Kamu cocok jadi {role}!"
276
 
277
  async def analyze_progress(self, user_name: str, progress_data: dict):
 
310
  temperature=0.7
311
  )
312
  except Exception as e:
313
+ print(f"ERROR Analyze Progress: {e}")
314
  return f"Error generate progress: {str(e)}"
315
 
316