Spaces:
Sleeping
Sleeping
Update app/services/llm_engine.py
Browse files
app/services/llm_engine.py
CHANGED
|
@@ -115,19 +115,20 @@ class LLMEngine:
|
|
| 115 |
messages.append({"role": "user", "content": user_text})
|
| 116 |
|
| 117 |
try:
|
| 118 |
-
|
| 119 |
-
|
|
|
|
| 120 |
model="llama-3.3-70b-versatile",
|
| 121 |
temperature=0.0,
|
| 122 |
response_format={"type": "json_object"}
|
| 123 |
)
|
| 124 |
|
| 125 |
-
response_content = chat_completion.choices[0].message.content
|
| 126 |
print(f"DEBUG AI MAPPING: {response_content}")
|
| 127 |
return json.loads(response_content)
|
| 128 |
|
| 129 |
except Exception as e:
|
| 130 |
print(f"Error Intent: {e}")
|
|
|
|
| 131 |
return {"action": "CASUAL_CHAT", "detected_skills": []}
|
| 132 |
|
| 133 |
async def generate_question(self, topics: list, level: str):
|
|
|
|
| 115 |
messages.append({"role": "user", "content": user_text})
|
| 116 |
|
| 117 |
try:
|
| 118 |
+
# Kita panggil _execute_with_retry dan kirim 'messages' yang sudah lengkap tadi
|
| 119 |
+
response_content = await self._execute_with_retry(
|
| 120 |
+
messages=messages,
|
| 121 |
model="llama-3.3-70b-versatile",
|
| 122 |
temperature=0.0,
|
| 123 |
response_format={"type": "json_object"}
|
| 124 |
)
|
| 125 |
|
|
|
|
| 126 |
print(f"DEBUG AI MAPPING: {response_content}")
|
| 127 |
return json.loads(response_content)
|
| 128 |
|
| 129 |
except Exception as e:
|
| 130 |
print(f"Error Intent: {e}")
|
| 131 |
+
# Fallback aman
|
| 132 |
return {"action": "CASUAL_CHAT", "detected_skills": []}
|
| 133 |
|
| 134 |
async def generate_question(self, topics: list, level: str):
|