Merge branch 'main' into nate/prettier-ci
This commit is contained in:
commit
0a3c4b6bd4
6 changed files with 88 additions and 16 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { ConfigHandler } from "../config/ConfigHandler.js";
|
||||
import { TRIAL_FIM_MODEL } from "../config/onboarding.js";
|
||||
// import { TRIAL_FIM_MODEL } from "../config/onboarding.js";
|
||||
import { IDE, ILLM } from "../index.js";
|
||||
import OpenAI from "../llm/llms/OpenAI.js";
|
||||
import { DEFAULT_AUTOCOMPLETE_OPTS } from "../util/parameters.js";
|
||||
|
|
@ -18,7 +18,10 @@ import { AutocompleteDebouncer } from "../autocomplete/util/AutocompleteDebounce
|
|||
import { AutocompleteLoggingService } from "../autocomplete/util/AutocompleteLoggingService.js";
|
||||
import AutocompleteLruCache from "../autocomplete/util/AutocompleteLruCache.js";
|
||||
import { HelperVars } from "../autocomplete/util/HelperVars.js";
|
||||
import { AutocompleteInput, AutocompleteOutcome } from "../autocomplete/util/types.js";
|
||||
import {
|
||||
AutocompleteInput,
|
||||
AutocompleteOutcome,
|
||||
} from "../autocomplete/util/types.js";
|
||||
|
||||
const autocompleteCache = AutocompleteLruCache.get();
|
||||
|
||||
|
|
@ -75,12 +78,14 @@ export class NextEditProvider {
|
|||
|
||||
if (llm instanceof OpenAI) {
|
||||
llm.useLegacyCompletionsEndpoint = true;
|
||||
} else if (
|
||||
llm.providerName === "free-trial" &&
|
||||
llm.model !== TRIAL_FIM_MODEL
|
||||
) {
|
||||
llm.model = TRIAL_FIM_MODEL;
|
||||
}
|
||||
// TODO: Resolve import error with TRIAL_FIM_MODEL
|
||||
// else if (
|
||||
// llm.providerName === "free-trial" &&
|
||||
// llm.model !== TRIAL_FIM_MODEL
|
||||
// ) {
|
||||
// llm.model = TRIAL_FIM_MODEL;
|
||||
// }
|
||||
|
||||
return llm;
|
||||
}
|
||||
|
|
@ -224,11 +229,11 @@ export class NextEditProvider {
|
|||
|
||||
const processedCompletion = helper.options.transform
|
||||
? postprocessCompletion({
|
||||
completion,
|
||||
prefix: helper.prunedPrefix,
|
||||
suffix: helper.prunedSuffix,
|
||||
llm,
|
||||
})
|
||||
completion,
|
||||
prefix: helper.prunedPrefix,
|
||||
suffix: helper.prunedSuffix,
|
||||
llm,
|
||||
})
|
||||
: completion;
|
||||
|
||||
completion = processedCompletion;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
"noEmitOnError": false,
|
||||
"types": ["node", "jest"],
|
||||
"outDir": "dist",
|
||||
"declaration": true
|
||||
// "sourceMap": true
|
||||
"declaration": true,
|
||||
"sourceMap": true
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,27 @@ export const Anthropic: ModelProvider = {
|
|||
id: "anthropic",
|
||||
displayName: "Anthropic",
|
||||
models: [
|
||||
{
|
||||
model: "claude-sonnet-4-20250514",
|
||||
displayName: "Claude 4 Sonnet",
|
||||
contextLength: 200000,
|
||||
maxCompletionTokens: 8192,
|
||||
description:
|
||||
"Most intelligent model with the highest level of intelligence and capability.",
|
||||
// Sometimes written as claude-4-sonnet, other times as claude-sonnet-4
|
||||
regex: /claude-(?:4-sonnet|sonnet-4).*/i,
|
||||
recommendedFor: ["chat"],
|
||||
},
|
||||
{
|
||||
model: "claude-opus-4-20250514",
|
||||
displayName: "Claude 4 Opus",
|
||||
contextLength: 200000,
|
||||
maxCompletionTokens: 8192,
|
||||
description:
|
||||
"Most intelligent model with the highest level of intelligence and capability.",
|
||||
regex: /claude-(?:4-opus|opus-4).*/i,
|
||||
recommendedFor: ["chat"],
|
||||
},
|
||||
{
|
||||
model: "claude-3-5-sonnet-latest",
|
||||
displayName: "Claude 3.5 Sonnet",
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@ import { chatChunk, customFetch } from "../util.js";
|
|||
import { OpenAIApi } from "./OpenAI.js";
|
||||
import { FimCreateParamsStreaming } from "./base.js";
|
||||
|
||||
export const DEEPSEEK_API_BASE = "https://api.deepseek.com/";
|
||||
export class DeepSeekApi extends OpenAIApi {
|
||||
apiBase: string = "https://api.deepseek.com/";
|
||||
constructor(config: DeepseekConfig) {
|
||||
super({
|
||||
...config,
|
||||
provider: "openai",
|
||||
apiBase: config.apiBase ?? DEEPSEEK_API_BASE,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,13 @@ import { chatChunk, customFetch } from "../util.js";
|
|||
import { OpenAIApi } from "./OpenAI.js";
|
||||
import { FimCreateParamsStreaming } from "./base.js";
|
||||
|
||||
export const INCEPTION_API_BASE = "https://api.inceptionlabs.ai/v1/";
|
||||
export class InceptionApi extends OpenAIApi {
|
||||
apiBase: string = "https://api.inceptionlabs.ai/v1/";
|
||||
constructor(config: InceptionConfig) {
|
||||
super({
|
||||
...config,
|
||||
provider: "openai",
|
||||
apiBase: config.apiBase ?? INCEPTION_API_BASE,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
import { ModelConfig } from "@continuedev/config-yaml";
|
||||
import * as dotenv from "dotenv";
|
||||
import { DEEPSEEK_API_BASE } from "../apis/DeepSeek.js";
|
||||
import { INCEPTION_API_BASE } from "../apis/Inception.js";
|
||||
import { OpenAIApi } from "../apis/OpenAI.js";
|
||||
import { constructLlmApi } from "../index.js";
|
||||
import { getLlmApi, testChat, testCompletion, testEmbed } from "./util.js";
|
||||
|
||||
dotenv.config();
|
||||
|
|
@ -109,3 +113,43 @@ TESTS.forEach((config) => {
|
|||
testConfig({ name: config.model, ...config });
|
||||
});
|
||||
});
|
||||
|
||||
describe("Configuration", () => {
|
||||
it("should configure DeepSeek OpenAI client with correct apiBase and apiKey", () => {
|
||||
const deepseek = constructLlmApi({
|
||||
provider: "deepseek",
|
||||
apiKey: "sk-xxx",
|
||||
});
|
||||
|
||||
expect((deepseek as OpenAIApi).openai.baseURL).toBe(DEEPSEEK_API_BASE);
|
||||
expect((deepseek as OpenAIApi).openai.apiKey).toBe("sk-xxx");
|
||||
|
||||
const deepseek2 = constructLlmApi({
|
||||
provider: "deepseek",
|
||||
apiKey: "sk-xxx",
|
||||
apiBase: "https://api.example.com",
|
||||
});
|
||||
expect((deepseek2 as OpenAIApi).openai.baseURL).toBe(
|
||||
"https://api.example.com",
|
||||
);
|
||||
});
|
||||
|
||||
it("should configure Inception OpenAI client with correct apiBase and apiKey", () => {
|
||||
const inception = constructLlmApi({
|
||||
provider: "inception",
|
||||
apiKey: "sk-xxx",
|
||||
});
|
||||
|
||||
expect((inception as OpenAIApi).openai.baseURL).toBe(INCEPTION_API_BASE);
|
||||
expect((inception as OpenAIApi).openai.apiKey).toBe("sk-xxx");
|
||||
|
||||
const inception2 = constructLlmApi({
|
||||
provider: "inception",
|
||||
apiKey: "sk-xxx",
|
||||
apiBase: "https://api.example.com",
|
||||
});
|
||||
expect((inception2 as OpenAIApi).openai.baseURL).toBe(
|
||||
"https://api.example.com",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue