Refine System prompt
Browse filesupdated system prompt to return just the translated sentence
app.py
CHANGED
@@ -334,9 +334,22 @@ with tab3:
|
|
334 |
# Get 10 samples from the dataset for translation
|
335 |
samples_to_translate = st.session_state.data.sample(10)['sentence'].tolist()
|
336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
# System prompt for translation assistant
|
338 |
-
|
339 |
-
You are a
|
340 |
"""
|
341 |
|
342 |
auto_translations = []
|
@@ -344,8 +357,8 @@ with tab3:
|
|
344 |
for sentence in samples_to_translate:
|
345 |
# Create messages for the chat model
|
346 |
messages = [
|
347 |
-
{"role": "system", "content":
|
348 |
-
{"role": "user", "content": f"Translate the following sentence to English: '{sentence}'"}
|
349 |
]
|
350 |
|
351 |
# Perform automatic translation using OpenAI GPT-3.5-turbo model
|
|
|
334 |
# Get 10 samples from the dataset for translation
|
335 |
samples_to_translate = st.session_state.data.sample(10)['sentence'].tolist()
|
336 |
|
337 |
+
# # System prompt for translation assistant
|
338 |
+
# translation_prompt = """
|
339 |
+
# You are a helpful AI-powered translation assistant designed for users seeking reliable translation assistance. Your primary function is to provide context-aware translations from Moroccan Arabic (Darija) to English.
|
340 |
+
# """
|
341 |
+
|
342 |
+
# auto_translations = []
|
343 |
+
|
344 |
+
# for sentence in samples_to_translate:
|
345 |
+
# # Create messages for the chat model
|
346 |
+
# messages = [
|
347 |
+
# {"role": "system", "content": translation_prompt},
|
348 |
+
# {"role": "user", "content": f"Translate the following sentence to English: '{sentence}'"}
|
349 |
+
# ]
|
350 |
# System prompt for translation assistant
|
351 |
+
translation_system_prompt = """
|
352 |
+
You are a native speaker of both Moroccan Arabic (Darija) and English. You are an expert of translations from Moroccan Arabic (Darija) into English.
|
353 |
"""
|
354 |
|
355 |
auto_translations = []
|
|
|
357 |
for sentence in samples_to_translate:
|
358 |
# Create messages for the chat model
|
359 |
messages = [
|
360 |
+
{"role": "system", "content": translation_system_prompt},
|
361 |
+
{"role": "user", "content": f"Translate the following sentence from Moroccan Arabic (Darija) to English, only return the translated sentence: '{sentence}'"}
|
362 |
]
|
363 |
|
364 |
# Perform automatic translation using OpenAI GPT-3.5-turbo model
|