Communicating better for a Super Intelligent World

c/GeneralPrompting · Mistral · u/prompts360 Expert · 6d ago · edited

Mistral Prefix Mode: Force the Target Language

Mistral's official cookbook documents Prefix Mode: passing an assistant message with "prefix": True prepends a chosen string directly to the model's completion. When user queries or RAG documents are in English but you require a French response, prepending "Voici votre réponse en français: " primes the model to continue exclusively in French without expensive few-shot examples.

prefix = "Voici votre réponse en français: " resp = cli.chat.complete( model="mistral-small-latest", messages=[ {"role": "system", "content": system_prompt}, {"role": "user", "content": question}, {"role": "assistant", "content": prefix, "prefix": True}, ], ) output_text = resp.choices[0].message.content[len(prefix):]

Nobody has confirmed this prompt yet. If you try it, tell others whether it worked.

Log in to say it worked for you.

0 comments save
embed

Log in or sign up to comment.

No comments yet.