fix autocomplete through platform
This commit is contained in:
parent
87f94b3233
commit
5caf3e6691
3 changed files with 19 additions and 18 deletions
|
|
@ -146,7 +146,9 @@ async function configYamlToContinueConfig(
|
|||
platformConfigMetadata,
|
||||
);
|
||||
continueConfig.models.push(...llms);
|
||||
} else if (model.roles?.includes("autocomplete")) {
|
||||
}
|
||||
|
||||
if (model.roles?.includes("autocomplete")) {
|
||||
// Autocomplete models array
|
||||
const llms = await llmsFromModelConfig(
|
||||
model,
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ class OpenAI extends BaseLLM {
|
|||
};
|
||||
}
|
||||
|
||||
protected extraBodyProperties(): Record<string, any> {
|
||||
return {};
|
||||
}
|
||||
|
||||
protected getMaxStopWords(): number {
|
||||
const url = new URL(this.apiBase!);
|
||||
|
||||
|
|
@ -271,6 +275,7 @@ class OpenAI extends BaseLLM {
|
|||
body: JSON.stringify({
|
||||
...args,
|
||||
stream: true,
|
||||
...this.extraBodyProperties(),
|
||||
}),
|
||||
signal,
|
||||
});
|
||||
|
|
@ -316,6 +321,7 @@ class OpenAI extends BaseLLM {
|
|||
// We call it toolCalls, they call it tool_calls
|
||||
tool_calls: m.toolCalls,
|
||||
tool_call_id: m.toolCallId,
|
||||
...this.extraBodyProperties(),
|
||||
})) as any;
|
||||
const response = await this.fetch(this._getEndpoint("chat/completions"), {
|
||||
method: "POST",
|
||||
|
|
@ -359,6 +365,7 @@ class OpenAI extends BaseLLM {
|
|||
presence_penalty: options.presencePenalty,
|
||||
stop: options.stop,
|
||||
stream: true,
|
||||
...this.extraBodyProperties(),
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
@ -405,6 +412,7 @@ class OpenAI extends BaseLLM {
|
|||
body: JSON.stringify({
|
||||
input: chunks,
|
||||
model: this.model,
|
||||
...this.extraBodyProperties(),
|
||||
}),
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.apiKey}`,
|
||||
|
|
|
|||
|
|
@ -2,13 +2,7 @@ import { ControlPlaneProxyInfo } from "../../../control-plane/analytics/IAnalyti
|
|||
import { Telemetry } from "../../../util/posthog.js";
|
||||
import OpenAI from "../OpenAI.js";
|
||||
|
||||
import { ChatCompletionCreateParams } from "@continuedev/openai-adapters";
|
||||
import type {
|
||||
ChatMessage,
|
||||
Chunk,
|
||||
CompletionOptions,
|
||||
LLMOptions,
|
||||
} from "../../../index.js";
|
||||
import type { Chunk, LLMOptions } from "../../../index.js";
|
||||
|
||||
class ContinueProxy extends OpenAI {
|
||||
set controlPlaneProxyInfo(value: ControlPlaneProxyInfo) {
|
||||
|
|
@ -33,17 +27,14 @@ class ContinueProxy extends OpenAI {
|
|||
useLegacyCompletionsEndpoint: false,
|
||||
};
|
||||
|
||||
protected _convertArgs(
|
||||
options: CompletionOptions,
|
||||
messages: ChatMessage[],
|
||||
): ChatCompletionCreateParams {
|
||||
const args: any = super._convertArgs(options, messages);
|
||||
args.continueProperties = {
|
||||
apiKey: this.actualApiKey,
|
||||
apiBase: this.actualApiBase,
|
||||
apiKeySecret: this.apiKeySecret,
|
||||
protected extraBodyProperties(): Record<string, any> {
|
||||
return {
|
||||
continueProperties: {
|
||||
apiKey: this.actualApiKey,
|
||||
apiBase: this.actualApiBase,
|
||||
apiKeySecret: this.apiKeySecret,
|
||||
},
|
||||
};
|
||||
return args;
|
||||
}
|
||||
|
||||
protected _getHeaders() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue