Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -130,10 +130,19 @@ def transcribe_audio(audio_path):
|
|
| 130 |
# ==========================================
|
| 131 |
|
| 132 |
# Helper function to call Mistral API
|
|
|
|
| 133 |
def ask_mistral(prompt):
|
| 134 |
try:
|
| 135 |
-
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
except Exception as e:
|
| 138 |
return f"⚠️ API Error (Mistral): {str(e)}"
|
| 139 |
|
|
|
|
| 130 |
# ==========================================
|
| 131 |
|
| 132 |
# Helper function to call Mistral API
|
| 133 |
+
# Helper function to call Mistral API (Updated for Conversational Task)
|
| 134 |
def ask_mistral(prompt):
|
| 135 |
try:
|
| 136 |
+
# Format the prompt as a chat message
|
| 137 |
+
messages = [{"role": "user", "content": prompt}]
|
| 138 |
+
|
| 139 |
+
# Use chat_completion instead of text_generation
|
| 140 |
+
response = text_client.chat_completion(
|
| 141 |
+
messages=messages,
|
| 142 |
+
max_tokens=1000,
|
| 143 |
+
temperature=0.3
|
| 144 |
+
)
|
| 145 |
+
return response.choices[0].message.content
|
| 146 |
except Exception as e:
|
| 147 |
return f"⚠️ API Error (Mistral): {str(e)}"
|
| 148 |
|