MistalAI: Add custom stop strings Closes #3627

1a52314812538a155cb4a8743f5b65cd5ff285d3

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +2 -0Showing whitespace changes
public/scripts/openai.js+1 -0
@@ -2072,6 +2072,7 @@ async function sendOpenAIRequest(type, messages, signal) {
20722072
20732073 if (isMistral) {
20742074 generate_data['safe_prompt'] = false; // already defaults to false, but just incase they change that in the future.
2075+ generate_data['stop'] = getCustomStoppingStrings(); // Mistral shouldn't have limits on stop strings.
20752076 }
20762077
20772078 if (isCustom) {
src/endpoints/backends/chat-completions.js+1 -0
@@ -586,6 +586,7 @@ async function sendMistralAIRequest(request, response) {
586586 'stream': request.body.stream,
587587 'safe_prompt': request.body.safe_prompt,
588588 'random_seed': request.body.seed === -1 ? undefined : request.body.seed,
589+ 'stop': Array.isArray(request.body.stop) && request.body.stop.length > 0 ? request.body.stop : undefined,
589590 };
590591
591592 if (Array.isArray(request.body.tools) && request.body.tools.length > 0) {