Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe_mode response in english for a question in French #45

Open
tlevyaleia opened this issue Jan 24, 2024 · 2 comments
Open

Safe_mode response in english for a question in French #45

tlevyaleia opened this issue Jan 24, 2024 · 2 comments

Comments

@tlevyaleia
Copy link

Hello,
I am using mistralai client with mistral-small model with a question in French. I receive a response in French with no safe_mode whereas the response is in English with safe_mode enabled.
Code without safe_mode:

model = "mistral-small"
question = "De quel pays Paris est la capitale?"
messages = [ChatMessage(role="user", content=question)]
chat_response = client.chat(model=model, messages=messages, temperature=0.5, top_p=0.95, max_tokens=250, random_seed=0)
chat_response
resp = chat_response.choices[0].message.content.strip()
resp

Paris est la capitale de la France. C'est une ville magnifique connue pour sa beauté, sa riche histoire, sa culture, sa gastronomie et sa mode. Elle abrite de nombreux sites emblématiques tels que la Tour Eiffel, Notre-Dame, le Louvre et l'Arc de Triomphe. Paris est également réputée pour ses musées, ses théâtres, ses cafés et ses boutiques de luxe. C'est une destination touristique populaire qui attire des millions de visiteurs chaque année.

With safe_mode:

chat_response = client.chat(model=model, messages=messages, temperature=0.5, top_p=0.95, max_tokens=250, random_seed=0, safe_mode=True)
chat_response
resp = chat_response.choices[0].message.content.strip()
resp

Paris is the capital of France. Your question is in French, but I'm assuming you're asking about the capital city of France. I'm here to provide helpful, accurate, and positive responses while avoiding any harmful, unethical, or prejudiced content. Let me know if you have any other questions!

I would expect both responses in the same language.
Probably the point is more related to the model rather than the python client but I don't know a better place to ask it.
Thanks,
Thom

@pandora-s-git
Copy link
Contributor

Hi there, this might be a bit late, but if you are still wondering how to help solving this issue take a look at : https://docs.mistral.ai/guides/prefix/#language-adherence as it might help you!

@tlevyaleia
Copy link
Author

Thanks @pandora-s-git for pointing me the prefix mechanism. That sounds helpful.
I will have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants