Mohit0708 commited on
Commit
68b6374
·
verified ·
1 Parent(s): 24af350

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
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
- response = text_client.text_generation(prompt, max_new_tokens=1000, temperature=0.3)
136
- return response
 
 
 
 
 
 
 
 
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