Merge branch 'bufferoverflow-fix/supportscompletions' into preview

This commit is contained in:
Nate Sesti 2024-04-18 15:35:28 -07:00
commit 84fe459fe9
3 changed files with 10 additions and 4 deletions

View file

@ -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;

View file

@ -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";

View file

@ -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)