diff --git a/core/llm/index.ts b/core/llm/index.ts index ed920eaa7..6831ad475 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -52,7 +52,8 @@ export abstract class BaseLLM implements ILLM { if (this.providerName === "openai") { if ( this.apiBase?.includes("api.groq.com") || - this.apiBase?.includes(":1337") + this.apiBase?.includes(":1337") || + this._llmOptions.useLegacyCompletionsEndpoint?.valueOf() === false ) { // Jan + Groq don't support completions : ( return false; diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index 6544c47ce..d8f4214ac 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -38,12 +38,11 @@ const CHAT_ONLY_MODELS = [ ]; class OpenAI extends BaseLLM { - public useLegacyCompletionsEndpoint = false; + public useLegacyCompletionsEndpoint: boolean | undefined = undefined; constructor(options: LLMOptions) { super(options); - this.useLegacyCompletionsEndpoint = - options.useLegacyCompletionsEndpoint ?? false; + this.useLegacyCompletionsEndpoint = options.useLegacyCompletionsEndpoint; } static providerName: ModelProvider = "openai"; diff --git a/docs/docs/reference/Model Providers/openai.md b/docs/docs/reference/Model Providers/openai.md index 853d97b43..c15f88b63 100644 --- a/docs/docs/reference/Model Providers/openai.md +++ b/docs/docs/reference/Model Providers/openai.md @@ -52,4 +52,10 @@ If you are [using an OpenAI compatible server / API](../../model-setup/select-pr } ``` +To force usage of `chat/completions` instead of `completions` endpoint you can set + +```json +"useLegacyCompletionsEndpoint": false +``` + [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/OpenAI.ts)