Merge branch 'main' into nate/fix-fetch-error-parsing
This commit is contained in:
commit
e7fbe7291f
16 changed files with 222 additions and 82 deletions
|
|
@ -19,7 +19,6 @@ export const sharedConfigSchema = z
|
|||
readResponseTTS: z.boolean(),
|
||||
promptPath: z.string(),
|
||||
useCurrentFileAsContext: z.boolean(),
|
||||
logEditingData: z.boolean(),
|
||||
optInNextEditFeature: z.boolean(),
|
||||
enableExperimentalTools: z.boolean(),
|
||||
codebaseToolCallingOnly: z.boolean(),
|
||||
|
|
@ -181,9 +180,6 @@ export function modifyAnyConfigWithSharedConfig<
|
|||
configCopy.experimental.useCurrentFileAsContext =
|
||||
sharedConfig.useCurrentFileAsContext;
|
||||
}
|
||||
if (sharedConfig.logEditingData !== undefined) {
|
||||
configCopy.experimental.logEditingData = sharedConfig.logEditingData;
|
||||
}
|
||||
if (sharedConfig.optInNextEditFeature !== undefined) {
|
||||
configCopy.experimental.optInNextEditFeature =
|
||||
sharedConfig.optInNextEditFeature;
|
||||
|
|
|
|||
6
core/index.d.ts
vendored
6
core/index.d.ts
vendored
|
|
@ -1288,7 +1288,6 @@ export interface ContinueUIConfig {
|
|||
codeWrap?: boolean;
|
||||
showSessionTabs?: boolean;
|
||||
autoAcceptEditToolDiffs?: boolean;
|
||||
logEditingData?: boolean;
|
||||
}
|
||||
|
||||
export interface ContextMenuConfig {
|
||||
|
|
@ -1441,11 +1440,6 @@ export interface ExperimentalConfig {
|
|||
*/
|
||||
useCurrentFileAsContext?: boolean;
|
||||
|
||||
/**
|
||||
* If enabled, will save data on the user's editing processes
|
||||
*/
|
||||
logEditingData?: boolean;
|
||||
|
||||
/**
|
||||
* If enabled, will enable next edit in place of autocomplete
|
||||
*/
|
||||
|
|
|
|||
14
core/package-lock.json
generated
14
core/package-lock.json
generated
|
|
@ -51,7 +51,7 @@
|
|||
"node-html-markdown": "^1.3.0",
|
||||
"ollama": "^0.4.6",
|
||||
"onnxruntime-node": "1.14.0",
|
||||
"openai": "^4.76.0",
|
||||
"openai": "^4.104.0",
|
||||
"p-limit": "^6.1.0",
|
||||
"partial-json": "^0.1.7",
|
||||
"pg": "^8.11.3",
|
||||
|
|
@ -180,7 +180,7 @@
|
|||
"dotenv": "^16.5.0",
|
||||
"json-schema": "^0.4.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"openai": "^4.76.0",
|
||||
"openai": "^4.104.0",
|
||||
"uuid": "^11.1.0",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
|
|
@ -14329,9 +14329,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/openai": {
|
||||
"version": "4.76.0",
|
||||
"resolved": "https://registry.npmjs.org/openai/-/openai-4.76.0.tgz",
|
||||
"integrity": "sha512-QBGIetjX1C9xDp5XGa/3mPnfKI9BgAe2xHQX6PmO98wuW9qQaurBaumcYptQWc9LHZZq7cH/Y1Rjnsr6uUDdVw==",
|
||||
"version": "4.104.0",
|
||||
"resolved": "https://registry.npmjs.org/openai/-/openai-4.104.0.tgz",
|
||||
"integrity": "sha512-p99EFNsA/yX6UhVO93f5kJsDRLAg+CTA2RBqdHK4RtK8u5IJw32Hyb2dTGKbnnFmnuoBv5r7Z2CURI9sGZpSuA==",
|
||||
"dependencies": {
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/node-fetch": "^2.6.4",
|
||||
|
|
@ -14345,9 +14345,13 @@
|
|||
"openai": "bin/cli"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ws": "^8.18.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"ws": {
|
||||
"optional": true
|
||||
},
|
||||
"zod": {
|
||||
"optional": true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
"node-html-markdown": "^1.3.0",
|
||||
"ollama": "^0.4.6",
|
||||
"onnxruntime-node": "1.14.0",
|
||||
"openai": "^4.76.0",
|
||||
"openai": "^4.104.0",
|
||||
"p-limit": "^6.1.0",
|
||||
"partial-json": "^0.1.7",
|
||||
"pg": "^8.11.3",
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "1.1.60",
|
||||
"version": "1.1.63",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "1.1.60",
|
||||
"version": "1.1.63",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export const handleTextDocumentChange = async (
|
|||
const editor = vscode.window.activeTextEditor;
|
||||
const { config } = await configHandler.loadConfig();
|
||||
|
||||
if (!config?.experimental?.logEditingData) return;
|
||||
// if (!config?.experimental?.logEditingData) return;
|
||||
if (!editor) return;
|
||||
if (event.contentChanges.length === 0) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
|
||||
import ToggleSwitch from "../../components/gui/Switch";
|
||||
import { ToolTip } from "../../components/gui/Tooltip";
|
||||
interface ContinueFeaturesMenuProps {
|
||||
logEditingData: boolean;
|
||||
handleLogEditingDataToggle: (value: boolean) => void;
|
||||
optInNextEditFeature: boolean;
|
||||
handleOptInNextEditToggle: (value: boolean) => void;
|
||||
}
|
||||
|
||||
export function ContinueFeaturesMenu({
|
||||
logEditingData,
|
||||
handleLogEditingDataToggle,
|
||||
optInNextEditFeature,
|
||||
handleOptInNextEditToggle,
|
||||
}: ContinueFeaturesMenuProps) {
|
||||
|
|
@ -20,23 +14,6 @@ export function ContinueFeaturesMenu({
|
|||
🚧 INTERNAL SETTINGS 🚧
|
||||
</div>
|
||||
<div className="flex w-full flex-col gap-y-4">
|
||||
<ToggleSwitch
|
||||
isToggled={logEditingData}
|
||||
onToggle={() => handleLogEditingDataToggle(!logEditingData)}
|
||||
text="Log Editing Data"
|
||||
showIfToggled={
|
||||
<>
|
||||
<ExclamationTriangleIcon
|
||||
data-tooltip-id={`auto-accept-diffs-warning-tooltip`}
|
||||
className="h-3 w-3 text-yellow-500"
|
||||
/>
|
||||
<ToolTip id={`auto-accept-diffs-warning-tooltip`}>
|
||||
{`Only turn this on if you want to log your editing processes in addition to the normal dev data. Note that this will store a lot of data.`}
|
||||
</ToolTip>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
<ToggleSwitch
|
||||
isToggled={optInNextEditFeature}
|
||||
onToggle={() => handleOptInNextEditToggle(!optInNextEditFeature)}
|
||||
|
|
|
|||
|
|
@ -67,10 +67,6 @@ export function UserSettingsForm() {
|
|||
});
|
||||
};
|
||||
|
||||
const handleLogEditingDataToggle = (value: boolean) => {
|
||||
handleUpdate({ logEditingData: value });
|
||||
};
|
||||
|
||||
const handleOptInNextEditToggle = (value: boolean) => {
|
||||
handleUpdate({ optInNextEditFeature: value });
|
||||
};
|
||||
|
|
@ -86,7 +82,6 @@ export function UserSettingsForm() {
|
|||
const showChatScrollbar = config.ui?.showChatScrollbar ?? false;
|
||||
const readResponseTTS = config.experimental?.readResponseTTS ?? false;
|
||||
const autoAcceptEditToolDiffs = config.ui?.autoAcceptEditToolDiffs ?? false;
|
||||
const logEditingData = config.experimental?.logEditingData ?? false;
|
||||
const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false;
|
||||
const disableSessionTitles = config.disableSessionTitles ?? false;
|
||||
const useCurrentFileAsContext =
|
||||
|
|
@ -436,8 +431,6 @@ export function UserSettingsForm() {
|
|||
|
||||
{hasContinueEmail && (
|
||||
<ContinueFeaturesMenu
|
||||
logEditingData={logEditingData}
|
||||
handleLogEditingDataToggle={handleLogEditingDataToggle}
|
||||
optInNextEditFeature={optInNextEditFeature}
|
||||
handleOptInNextEditToggle={handleOptInNextEditToggle}
|
||||
/>
|
||||
|
|
|
|||
12
packages/openai-adapters/package-lock.json
generated
12
packages/openai-adapters/package-lock.json
generated
|
|
@ -17,7 +17,7 @@
|
|||
"dotenv": "^16.5.0",
|
||||
"json-schema": "^0.4.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"openai": "^4.76.0",
|
||||
"openai": "^4.104.0",
|
||||
"uuid": "^11.1.0",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
|
|
@ -4993,9 +4993,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/openai": {
|
||||
"version": "4.76.0",
|
||||
"resolved": "https://registry.npmjs.org/openai/-/openai-4.76.0.tgz",
|
||||
"integrity": "sha512-QBGIetjX1C9xDp5XGa/3mPnfKI9BgAe2xHQX6PmO98wuW9qQaurBaumcYptQWc9LHZZq7cH/Y1Rjnsr6uUDdVw==",
|
||||
"version": "4.104.0",
|
||||
"resolved": "https://registry.npmjs.org/openai/-/openai-4.104.0.tgz",
|
||||
"integrity": "sha512-p99EFNsA/yX6UhVO93f5kJsDRLAg+CTA2RBqdHK4RtK8u5IJw32Hyb2dTGKbnnFmnuoBv5r7Z2CURI9sGZpSuA==",
|
||||
"dependencies": {
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/node-fetch": "^2.6.4",
|
||||
|
|
@ -5009,9 +5009,13 @@
|
|||
"openai": "bin/cli"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ws": "^8.18.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"ws": {
|
||||
"optional": true
|
||||
},
|
||||
"zod": {
|
||||
"optional": true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
"dotenv": "^16.5.0",
|
||||
"json-schema": "^0.4.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"openai": "^4.76.0",
|
||||
"openai": "^4.104.0",
|
||||
"uuid": "^11.1.0",
|
||||
"zod": "^3.24.2"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { v4 as uuidv4 } from "uuid";
|
|||
import {
|
||||
ChatCompletion,
|
||||
ChatCompletionChunk,
|
||||
ChatCompletionContentPartImage,
|
||||
ChatCompletionCreateParams,
|
||||
ChatCompletionCreateParamsNonStreaming,
|
||||
ChatCompletionCreateParamsStreaming,
|
||||
|
|
@ -120,7 +121,9 @@ export class BedrockApi implements BaseLlmApi {
|
|||
case "image_url":
|
||||
default:
|
||||
try {
|
||||
const [mimeType, base64Data] = part.image_url.url.split(",");
|
||||
const [mimeType, base64Data] = (
|
||||
part as ChatCompletionContentPartImage
|
||||
).image_url.url.split(",");
|
||||
const format = mimeType.split("/")[1]?.split(";")[0] || "jpeg";
|
||||
if (
|
||||
format === ImageFormat.JPEG ||
|
||||
|
|
|
|||
120
packages/openai-adapters/src/apis/ContinueProxy.ts
Normal file
120
packages/openai-adapters/src/apis/ContinueProxy.ts
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
import { OpenAI } from "openai/index";
|
||||
import {
|
||||
ChatCompletionCreateParams,
|
||||
CompletionCreateParamsNonStreaming,
|
||||
CompletionCreateParamsStreaming,
|
||||
} from "openai/resources/index";
|
||||
import { z } from "zod";
|
||||
import { ContinueProxyConfigSchema } from "../types.js";
|
||||
import { FimCreateParamsStreaming, RerankCreateParams } from "./base.js";
|
||||
import { OpenAIApi } from "./OpenAI.js";
|
||||
|
||||
export interface ContinueProperties {
|
||||
apiKeyLocation?: string;
|
||||
envSecretLocations?: Record<string, string>;
|
||||
apiBase?: string;
|
||||
orgScopeId?: string | null;
|
||||
env?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface ProxyModelName {
|
||||
ownerSlug: string;
|
||||
packageSlug: string;
|
||||
provider: string;
|
||||
model: string;
|
||||
}
|
||||
|
||||
export class ContinueProxyApi extends OpenAIApi {
|
||||
// The apiKey and apiBase are set to the values for the proxy,
|
||||
// but we need to keep track of the actual values that the proxy will use
|
||||
// to call whatever LLM API is chosen
|
||||
private actualApiBase?: string;
|
||||
|
||||
// Contains extra properties that we pass along to the proxy. Originally from `env` property on LLMOptions
|
||||
private configEnv?: Record<string, any>;
|
||||
|
||||
// Store the continue proxy config separately
|
||||
private continueProxyConfig: z.infer<typeof ContinueProxyConfigSchema>;
|
||||
|
||||
constructor(config: z.infer<typeof ContinueProxyConfigSchema>) {
|
||||
// Convert ContinueProxyConfigSchema to OpenAIConfigSchema format
|
||||
const openaiConfig = {
|
||||
provider: "openai" as const,
|
||||
apiKey: config.apiKey,
|
||||
apiBase: config.env?.proxyUrl
|
||||
? new URL("model-proxy/v1/", config.env?.proxyUrl).toString()
|
||||
: "https://api.continue.dev/model-proxy/v1/",
|
||||
requestOptions: config.requestOptions,
|
||||
};
|
||||
|
||||
super(openaiConfig);
|
||||
|
||||
this.continueProxyConfig = config;
|
||||
this.configEnv = config.env;
|
||||
this.actualApiBase = config.apiBase;
|
||||
}
|
||||
|
||||
protected extraBodyProperties(): Record<string, any> {
|
||||
const continueProperties: ContinueProperties = {
|
||||
apiKeyLocation: this.continueProxyConfig.env?.apiKeyLocation,
|
||||
envSecretLocations: this.continueProxyConfig.env?.envSecretLocations,
|
||||
apiBase: this.actualApiBase,
|
||||
orgScopeId: this.continueProxyConfig.env?.orgScopeId ?? null,
|
||||
env: this.configEnv,
|
||||
};
|
||||
return {
|
||||
continueProperties,
|
||||
};
|
||||
}
|
||||
|
||||
private modifyBodyWithContinueProperties<T extends Record<string, any>>(
|
||||
body: T,
|
||||
): T {
|
||||
return {
|
||||
...body,
|
||||
...this.extraBodyProperties(),
|
||||
};
|
||||
}
|
||||
|
||||
modifyChatBody<T extends ChatCompletionCreateParams>(body: T): T {
|
||||
// First apply OpenAI-specific modifications
|
||||
const modifiedBody = super.modifyChatBody(body);
|
||||
// Then add Continue properties
|
||||
return this.modifyBodyWithContinueProperties(modifiedBody);
|
||||
}
|
||||
|
||||
modifyCompletionBody<
|
||||
T extends
|
||||
| CompletionCreateParamsNonStreaming
|
||||
| CompletionCreateParamsStreaming,
|
||||
>(body: T): T {
|
||||
return this.modifyBodyWithContinueProperties(body);
|
||||
}
|
||||
|
||||
modifyFimBody<T extends FimCreateParamsStreaming>(body: T): T {
|
||||
const modifiedBody = super.modifyFimBody(body);
|
||||
return this.modifyBodyWithContinueProperties(modifiedBody);
|
||||
}
|
||||
|
||||
protected getHeaders(): Record<string, string> {
|
||||
return {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"x-api-key": this.continueProxyConfig.apiKey ?? "",
|
||||
Authorization: `Bearer ${this.continueProxyConfig.apiKey}`,
|
||||
};
|
||||
}
|
||||
|
||||
modifyEmbedBody<T extends OpenAI.Embeddings.EmbeddingCreateParams>(
|
||||
body: T,
|
||||
): T {
|
||||
return this.modifyBodyWithContinueProperties(body);
|
||||
}
|
||||
|
||||
modifyRerankBody<T extends RerankCreateParams>(body: T): T {
|
||||
return {
|
||||
...body,
|
||||
...this.extraBodyProperties(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ import { OpenAI } from "openai/index";
|
|||
import {
|
||||
ChatCompletion,
|
||||
ChatCompletionChunk,
|
||||
ChatCompletionContentPartImage,
|
||||
ChatCompletionCreateParams,
|
||||
ChatCompletionCreateParamsNonStreaming,
|
||||
ChatCompletionCreateParamsStreaming,
|
||||
|
|
@ -75,7 +76,9 @@ export class GeminiApi implements BaseLlmApi {
|
|||
return {
|
||||
inlineData: {
|
||||
mimeType: "image/jpeg",
|
||||
data: part.image_url?.url.split(",")[1],
|
||||
data: (part as ChatCompletionContentPartImage).image_url?.url.split(
|
||||
",",
|
||||
)[1],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,37 @@ export class OpenAIApi implements BaseLlmApi {
|
|||
return body;
|
||||
}
|
||||
|
||||
modifyCompletionBody<
|
||||
T extends
|
||||
| CompletionCreateParamsNonStreaming
|
||||
| CompletionCreateParamsStreaming,
|
||||
>(body: T): T {
|
||||
return body;
|
||||
}
|
||||
|
||||
modifyEmbedBody<T extends OpenAI.Embeddings.EmbeddingCreateParams>(
|
||||
body: T,
|
||||
): T {
|
||||
return body;
|
||||
}
|
||||
|
||||
modifyFimBody<T extends FimCreateParamsStreaming>(body: T): T {
|
||||
return body;
|
||||
}
|
||||
|
||||
modifyRerankBody<T extends RerankCreateParams>(body: T): T {
|
||||
return body;
|
||||
}
|
||||
|
||||
protected getHeaders(): Record<string, string> {
|
||||
return {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"x-api-key": this.config.apiKey ?? "",
|
||||
Authorization: `Bearer ${this.config.apiKey}`,
|
||||
};
|
||||
}
|
||||
|
||||
async chatCompletionNonStream(
|
||||
body: ChatCompletionCreateParamsNonStreaming,
|
||||
signal: AbortSignal,
|
||||
|
|
@ -88,14 +119,20 @@ export class OpenAIApi implements BaseLlmApi {
|
|||
body: CompletionCreateParamsNonStreaming,
|
||||
signal: AbortSignal,
|
||||
): Promise<Completion> {
|
||||
const response = await this.openai.completions.create(body, { signal });
|
||||
const response = await this.openai.completions.create(
|
||||
this.modifyCompletionBody(body),
|
||||
{ signal },
|
||||
);
|
||||
return response;
|
||||
}
|
||||
async *completionStream(
|
||||
body: CompletionCreateParamsStreaming,
|
||||
signal: AbortSignal,
|
||||
): AsyncGenerator<Completion, any, unknown> {
|
||||
const response = await this.openai.completions.create(body, { signal });
|
||||
const response = await this.openai.completions.create(
|
||||
this.modifyCompletionBody(body),
|
||||
{ signal },
|
||||
);
|
||||
for await (const result of response) {
|
||||
yield result;
|
||||
}
|
||||
|
|
@ -105,27 +142,23 @@ export class OpenAIApi implements BaseLlmApi {
|
|||
signal: AbortSignal,
|
||||
): AsyncGenerator<ChatCompletionChunk, any, unknown> {
|
||||
const endpoint = new URL("fim/completions", this.apiBase);
|
||||
const modifiedBody = this.modifyFimBody(body);
|
||||
const resp = await customFetch(this.config.requestOptions)(endpoint, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
model: body.model,
|
||||
prompt: body.prompt,
|
||||
suffix: body.suffix,
|
||||
max_tokens: body.max_tokens,
|
||||
max_completion_tokens: (body as any).max_completion_tokens,
|
||||
temperature: body.temperature,
|
||||
top_p: body.top_p,
|
||||
frequency_penalty: body.frequency_penalty,
|
||||
presence_penalty: body.presence_penalty,
|
||||
stop: body.stop,
|
||||
model: modifiedBody.model,
|
||||
prompt: modifiedBody.prompt,
|
||||
suffix: modifiedBody.suffix,
|
||||
max_tokens: modifiedBody.max_tokens,
|
||||
max_completion_tokens: (modifiedBody as any).max_completion_tokens,
|
||||
temperature: modifiedBody.temperature,
|
||||
top_p: modifiedBody.top_p,
|
||||
frequency_penalty: modifiedBody.frequency_penalty,
|
||||
presence_penalty: modifiedBody.presence_penalty,
|
||||
stop: modifiedBody.stop,
|
||||
stream: true,
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"x-api-key": this.config.apiKey ?? "",
|
||||
Authorization: `Bearer ${this.config.apiKey}`,
|
||||
},
|
||||
headers: this.getHeaders(),
|
||||
signal,
|
||||
});
|
||||
for await (const chunk of streamSse(resp as any)) {
|
||||
|
|
@ -138,21 +171,19 @@ export class OpenAIApi implements BaseLlmApi {
|
|||
async embed(
|
||||
body: OpenAI.Embeddings.EmbeddingCreateParams,
|
||||
): Promise<OpenAI.Embeddings.CreateEmbeddingResponse> {
|
||||
const response = await this.openai.embeddings.create(body);
|
||||
const response = await this.openai.embeddings.create(
|
||||
this.modifyEmbedBody(body),
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
async rerank(body: RerankCreateParams): Promise<CreateRerankResponse> {
|
||||
const endpoint = new URL("rerank", this.apiBase);
|
||||
const modifiedBody = this.modifyRerankBody(body);
|
||||
const response = await customFetch(this.config.requestOptions)(endpoint, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"x-api-key": this.config.apiKey ?? "",
|
||||
Authorization: `Bearer ${this.config.apiKey}`,
|
||||
},
|
||||
body: JSON.stringify(modifiedBody),
|
||||
headers: this.getHeaders(),
|
||||
});
|
||||
const data = await response.json();
|
||||
return data as any;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { AnthropicApi } from "./apis/Anthropic.js";
|
|||
import { AzureApi } from "./apis/Azure.js";
|
||||
import { BedrockApi } from "./apis/Bedrock.js";
|
||||
import { CohereApi } from "./apis/Cohere.js";
|
||||
import { ContinueProxyApi } from "./apis/ContinueProxy.js";
|
||||
import { DeepSeekApi } from "./apis/DeepSeek.js";
|
||||
import { GeminiApi } from "./apis/Gemini.js";
|
||||
import { InceptionApi } from "./apis/Inception.js";
|
||||
|
|
@ -57,6 +58,8 @@ export function constructLlmApi(config: LLMConfig): BaseLlmApi | undefined {
|
|||
return new WatsonXApi(config);
|
||||
case "llamastack":
|
||||
return new LlamastackApi(config);
|
||||
case "continue-proxy":
|
||||
return new ContinueProxyApi(config);
|
||||
case "x-ai":
|
||||
return openAICompatible("https://api.x.ai/v1/", config);
|
||||
case "voyage":
|
||||
|
|
|
|||
|
|
@ -91,6 +91,17 @@ export const LlamastackConfigSchema = OpenAIConfigSchema.extend({
|
|||
});
|
||||
export type LlamastackConfig = z.infer<typeof LlamastackConfigSchema>;
|
||||
|
||||
export const ContinueProxyConfigSchema = BasePlusConfig.extend({
|
||||
provider: z.literal("continue-proxy"),
|
||||
env: z.object({
|
||||
apiKeyLocation: z.string().optional(),
|
||||
envSecretLocations: z.record(z.string(), z.string()).optional(),
|
||||
orgScopeId: z.string().nullable(),
|
||||
proxyUrl: z.string().optional(),
|
||||
}),
|
||||
});
|
||||
export type ContinueProxyConfig = z.infer<typeof ContinueProxyConfigSchema>;
|
||||
|
||||
export const MockConfigSchema = BasePlusConfig.extend({
|
||||
provider: z.literal("mock"),
|
||||
});
|
||||
|
|
@ -169,5 +180,6 @@ export const LLMConfigSchema = z.discriminatedUnion("provider", [
|
|||
MockConfigSchema,
|
||||
InceptionConfigSchema,
|
||||
LlamastackConfigSchema,
|
||||
ContinueProxyConfigSchema,
|
||||
]);
|
||||
export type LLMConfig = z.infer<typeof LLMConfigSchema>;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue