LibreChat icon indicating copy to clipboard operation
LibreChat copied to clipboard

[Bug]: Perplexity, Mistral, Message Payload Role Order Strictness

Open yuvaraj-06 opened this issue 8 months ago • 8 comments

What happened?

Unable to use Perplexity inside a existing chat thread where a modelspec option is being selected but claude and gemini were working IMG_7891

Steps to Reproduce

Select a modelspec and then try to chose perplexity in between the chat thread

What browsers are you seeing the problem on?

No response

Relevant log output

<@986671659274600528> 

> `{
>   "code": 400,
>   "error": {
>     "code": 400,
>     "message": "After the (optional) system message(s), user and assistant roles should be alternating.",
>     "type": "invalid_message"
>   },
>   "headers": {
>     "cf-cache-status": "DYNAMIC",
>     "cf-ray": "88c835f9ee759681-SJC",
>     "connection": "keep-alive",
>     "content-length": "147",
>     "content-type": "application/json",
>     "date": "Fri, 31 May 2024 16:06:23 GMT",
>     "server": "cloudflare",
>     "set-cookie": "__cf_bm=Tqsoof0Od3ZnkX8kdljSGZhbGZA2sE5Exuu29468DG0-1717171583-1.0.1.1-NTIcyI677u74jICLpuzVRxxtpdYOWwh0G6W1LRzxh.k_Jqc3vX3EZNvF7_smyRiwyh__Rw7wfUTzaXagxh65KQ; path=/; expires=Fri, 31-May-24 16:36:23 GMT; domain=.perplexity.ai; HttpOnly; Secure; SameSite=None"
>   },
>   "level": "error",
>   "message": "[handleAbortError] AI response error; aborting request: 400 After the (optional) system message(s), user and assistant roles should be alternating.",
>   "stack": "Error: 400 After the (optional) system message(s), user and assistant roles should be alternating.\n    at APIError.generate (/app/api/node_modules/openai/error.js:45:20)\n    at OpenAI.makeStatusError (/app/api/node_modules/openai/core.js:263:33)\n    at OpenAI.makeRequest (/app/api/node_modules/openai/core.js:306:30)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async ChatCompletionStream._createChatCompletion (/app/api/node_modules/openai/lib/ChatCompletionStream.js:53:24)\n    at async ChatCompletionStream._runChatCompletion (/app/api/node_modules/openai/lib/AbstractChatCompletionRunner.js:314:16)",
>   "status": 400,
>   "type": "invalid_message"
> }`

Screenshots

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

yuvaraj-06 avatar Jun 12 '24 23:06 yuvaraj-06