arbs-io / vscode-openai

vscode-openai seamlessly incorporates OpenAI features into VSCode, providing integration with SCM, Code Editor and Chat.
https://marketplace.visualstudio.com/items?itemName=AndrewButson.vscode-openai
MIT License
75 stars 18 forks source link

Error with the Perplexity AI API #260

Closed kavehsfv closed 2 months ago

kavehsfv commented 3 months ago

Hi,

I sometimes use other LLMs through a custom API that supports the OpenAI API. I have no issues with Groq AI or Together AI. However, when I attempt to use the Perplexity AI API, I encounter the following error:

Error: 400 After the (optional) system message(s), user and assistant roles should be alternating.

I have also set the variable "vscode-openai.conversation-configuration.assistant-rules" to false, but I still receive the same error.

How can I resolve this issue?

Thanks.

arbs-io commented 3 months ago

That's a bad request error. Do you have any documentation I can check?

kavehsfv commented 3 months ago

You may check the following link of Perplexity AI docs: https://docs.perplexity.ai/docs/getting-started

I tried my API Key with python code and it works properly. You may use my API for debugging your code:

API Key: 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

arbs-io commented 2 months ago

Hi @kavehsfv Thanks for all the help (and the key) greatly appreciate! I've fixed the issues for perplexity and it now works with the custom model. release: v1.6.5