From 82bc0bdcbb6ca87b5d5e80b7311ce7a861c54b96 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 20 May 2025 13:57:06 -0700 Subject: [PATCH] add underlyingProviderName getter --- core/index.d.ts | 3 ++- core/llm/index.ts | 8 ++++++++ core/llm/llms/stubs/ContinueProxy.ts | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/index.d.ts b/core/index.d.ts index 9bc413331..1d051f49e 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -93,6 +93,7 @@ export interface ILLM extends Omit, Required> { get providerName(): string; + get underlyingProviderName(): string; complete( prompt: string, @@ -842,7 +843,7 @@ export interface SlashCommand { description: string; prompt?: string; params?: { [key: string]: any }; - promptFile?: string + promptFile?: string; run: (sdk: ContinueSDK) => AsyncGenerator; } diff --git a/core/llm/index.ts b/core/llm/index.ts index 96fdb319c..28995bc40 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -88,6 +88,14 @@ export abstract class BaseLLM implements ILLM { return (this.constructor as typeof BaseLLM).providerName; } + /** + * This exists because for the continue-proxy, sometimes we want to get the value of the underlying provider that is used on the server + * For example, the underlying provider should always be sent with dev data + */ + get underlyingProviderName(): string { + return this.providerName; + } + supportsFim(): boolean { return false; } diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index e43e2bfe2..97b02c4f8 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -1,6 +1,7 @@ import { ContinueProperties, decodeSecretLocation, + parseProxyModelName, SecretType, } from "@continuedev/config-yaml"; @@ -43,6 +44,11 @@ class ContinueProxy extends OpenAI { useLegacyCompletionsEndpoint: false, }; + get underlyingProviderName(): string { + const { provider } = parseProxyModelName(this.model); + return provider; + } + protected extraBodyProperties(): Record { const continueProperties: ContinueProperties = { apiKeyLocation: this.apiKeyLocation,