config yaml version, env working

This commit is contained in:
Dallin Romney 2025-02-24 13:33:15 -08:00
parent bdf2c5f40a
commit 0d46170033
15 changed files with 78 additions and 59 deletions

View file

@ -1,18 +1,11 @@
import {
ModelRole,
modelRolesSchema,
} from "@continuedev/config-yaml/dist/schemas/models";
import z from "zod";
import {
BrowserSerializedContinueConfig,
ContinueConfig,
Config,
ContinueConfig,
SerializedContinueConfig,
} from "..";
import { GlobalContext } from "../util/GlobalContext";
const selectedModelsSchema = z.record(modelRolesSchema, z.string().nullable());
export const sharedConfigSchema = z
.object({

View file

@ -51,6 +51,52 @@ async function modelConfigToBaseLLM(
promptTemplates: model.promptTemplates,
};
if (model.embedOptions?.maxBatchSize) {
options.maxEmbeddingBatchSize = model.embedOptions.maxBatchSize;
}
if (model.embedOptions?.maxChunkSize) {
options.maxEmbeddingChunkSize = model.embedOptions.maxChunkSize;
}
// Things that are in config types for
const env = model.env ?? {};
if (
"useLegacyCompletionsEndpoint" in env &&
typeof env.useLegacyCompletionsEndpoint === "boolean"
) {
options.useLegacyCompletionsEndpoint = env.useLegacyCompletionsEndpoint;
}
if ("apiType" in env && typeof env.apiType === "string") {
options.apiType = env.apiType;
}
if ("apiVersion" in env && typeof env.apiVersion === "string") {
options.apiVersion = env.apiVersion;
}
if ("deployment" in env && typeof env.deployment === "string") {
options.deployment = env.deployment;
}
if ("deploymentId" in env && typeof env.deploymentId === "string") {
options.deploymentId = env.deploymentId;
}
if ("projectId" in env && typeof env.projectId === "string") {
options.projectId = env.projectId;
}
if ("region" in env && typeof env.region === "string") {
options.region = env.region;
}
if ("profile" in env && typeof env.profile === "string") {
options.profile = env.profile;
}
if ("modelArn" in env && typeof env.modelArn === "string") {
options.modelArn = env.modelArn;
}
if ("aiGatewaySlug" in env && typeof env.aiGatewaySlug === "string") {
options.aiGatewaySlug = env.aiGatewaySlug;
}
if ("accountId" in env && typeof env.accountId === "string") {
options.accountId = env.accountId;
}
const llm = new cls(options);
return llm;
}

View file

@ -10,7 +10,7 @@ import {
import { fetchwithRequestOptions } from "@continuedev/fetch";
import * as URI from "uri-js";
import { fileURLToPath } from "url";
import { ZodObject } from "zod";
import { AnyZodObject } from "zod";
import { Core } from "../core.js";
import { IdeInfo, IdeSettings } from "../index.js";
import { getDevDataFilePath } from "../util/paths.js";
@ -37,7 +37,7 @@ export class DataLogger {
body: Record<string, any>,
eventName: string,
schema: string,
zodSchema: ZodObject<any>,
zodSchema: AnyZodObject,
): Promise<Record<string, any>> {
const newBody = { ...body };
const ideSettings = await this.ideSettingsPromise;

5
core/index.d.ts vendored
View file

@ -518,6 +518,8 @@ export interface LLMOptions {
// IBM watsonx Options
deploymentId?: string;
env?: Record<string, string | number | boolean>;
}
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
@ -956,7 +958,8 @@ export interface EmbedOptions {
apiVersion?: string;
requestOptions?: RequestOptions;
maxEmbeddingChunkSize?: number;
maxEmbeddingChunkSize?: number;
maxEmbeddingBatchSize?: number;
// AWS options
profile?: string;

13
core/package-lock.json generated
View file

@ -13,7 +13,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.50",
"@continuedev/config-yaml": "file:///users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -106,6 +106,7 @@
"node": ">=20.11.0"
}
},
"../../../../../../../users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist": {},
"node_modules/@75lb/deep-merge": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.2.tgz",
@ -3038,14 +3039,8 @@
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.50",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.50.tgz",
"integrity": "sha512-WRoMOPhHUjJ/y5GjsL8dkVvzAKRbb4zjfOvmUutHxGUu9lQkuAOnRATnOnLiowTY/xgImPTifOuyc79WyJRFzw==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",
"zod": "^3.24.2"
}
"resolved": "../../../../../../../users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist",
"link": true
},
"node_modules/@continuedev/fetch": {
"version": "1.0.4",

View file

@ -46,7 +46,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "file:///users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist",
"@continuedev/config-yaml": "^1.0.51",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.270",
"version": "0.9.271",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.270",
"version": "0.9.271",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/fetch": "^1.0.3",
@ -106,7 +106,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.50",
"@continuedev/config-yaml": "file:///users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",

32
gui/package-lock.json generated
View file

@ -7,7 +7,7 @@
"name": "gui",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-yaml": "^1.0.50",
"@continuedev/config-yaml": "file:///users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",
@ -98,6 +98,7 @@
"node": ">=20.11.0"
}
},
"../../../../../../../users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist": {},
"../core": {
"name": "@continuedev/core",
"version": "1.0.13",
@ -107,7 +108,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.621.0",
"@aws-sdk/credential-providers": "^3.620.1",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.50",
"@continuedev/config-yaml": "file:///users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
@ -546,23 +547,9 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
"node_modules/@continuedev/config-types": {
"version": "1.0.14",
"resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.14.tgz",
"integrity": "sha512-PVHyHPyRXd2QsaNgnCpiKYU3uHFTlyuQSkqE8OwrBmQqO6/TXUVIr/2EGtyIZGrml4Y+rGMSH40WU4/0t4SGpQ==",
"dependencies": {
"zod": "^3.23.8"
}
},
"node_modules/@continuedev/config-yaml": {
"version": "1.0.50",
"resolved": "https://registry.npmjs.org/@continuedev/config-yaml/-/config-yaml-1.0.50.tgz",
"integrity": "sha512-WRoMOPhHUjJ/y5GjsL8dkVvzAKRbb4zjfOvmUutHxGUu9lQkuAOnRATnOnLiowTY/xgImPTifOuyc79WyJRFzw==",
"dependencies": {
"@continuedev/config-types": "^1.0.14",
"yaml": "^2.6.1",
"zod": "^3.24.2"
}
"resolved": "../../../../../../../users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist",
"link": true
},
"node_modules/@emotion/is-prop-valid": {
"version": "1.3.1",
@ -13713,6 +13700,7 @@
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz",
"integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==",
"dev": true,
"bin": {
"yaml": "bin.mjs"
},
@ -13732,14 +13720,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/zod": {
"version": "3.24.2",
"resolved": "https://registry.npmjs.org/zod/-/zod-3.24.2.tgz",
"integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
},
"node_modules/zwitch": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz",

View file

@ -15,7 +15,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@continuedev/config-yaml": "file:///users/dallin/documents/code/continuedev/continue/packages/config-yaml/dist",
"@continuedev/config-yaml": "^1.0.51",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",

View file

@ -15,6 +15,6 @@
"typescript": "^5.5.2"
},
"dependencies": {
"zod": "^3.23.8"
"zod": "^3.24.2"
}
}

View file

@ -1,12 +1,12 @@
{
"name": "@continuedev/config-yaml",
"version": "1.0.48",
"version": "1.0.50",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@continuedev/config-yaml",
"version": "1.0.48",
"version": "1.0.50",
"license": "Apache-2.0",
"dependencies": {
"@continuedev/config-types": "^1.0.14",

View file

@ -1,6 +1,6 @@
{
"name": "@continuedev/config-yaml",
"version": "1.0.50",
"version": "1.0.51",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View file

@ -9,5 +9,5 @@ export * from "./load/proxySecretResolution.js";
export * from "./load/unroll.js";
export * from "./schemas/data/index.js";
export * from "./schemas/index.js";
export type { EmbedOptions, ModelConfig, ModelRole } from "./schemas/models.js";
export * from "./schemas/models.js";
export * from "./validation.js";

View file

@ -65,7 +65,9 @@ const baseModelFields = {
requestOptions: requestOptionsSchema.optional(),
embedOptions: embedOptionsSchema.optional(),
promptTemplates: promptTemplatesSchema.optional(),
env: z.record(z.string(), z.string()).optional(),
env: z
.record(z.string(), z.union([z.string(), z.boolean(), z.number()]))
.optional(),
};
export const modelSchema = z.union([

View file

@ -14,12 +14,12 @@
"dependencies": {
"@azure/openai": "^1.0.0-beta.12",
"@continuedev/config-types": "^1.0.5",
"@continuedev/config-yaml": "^1.0.50",
"@continuedev/config-yaml": "^1.0.51",
"@continuedev/fetch": "^1.0.3",
"json-schema": "^0.4.0",
"node-fetch": "^3.3.2",
"openai": "^4.76.0",
"zod": "^3.23.8"
"zod": "^3.24.2"
},
"devDependencies": {
"@types/follow-redirects": "^1.14.4",