From cfcbee33a416a40f694108e7eed69318630c95d0 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 6 Apr 2025 15:01:04 -0700 Subject: [PATCH] isProperlyConfigured --- core/index.d.ts | 5 +++++ core/llm/index.ts | 6 ++++++ core/llm/llms/Relace.ts | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/core/index.d.ts b/core/index.d.ts index dd96d1699..f2c33e221 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -162,6 +162,11 @@ export interface ILLM extends LLMOptions { otherData: Record, canPutWordsInModelsMouth?: boolean, ): string | ChatMessage[]; + + /** + * This method should return false if the model is missing an API key or something else that would cause it to fail if called + */ + isProperlyConfigured(): boolean; } export interface ModelInstaller { diff --git a/core/llm/index.ts b/core/llm/index.ts index cc7d7123c..01116e92b 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -260,6 +260,12 @@ export abstract class BaseLLM implements ILLM { options.maxEmbeddingChunkSize ?? DEFAULT_MAX_CHUNK_SIZE; this.embeddingId = `${this.constructor.name}::${this.model}::${this.maxEmbeddingChunkSize}`; } + isProperlyConfigured(): boolean { + return true; + } + useLegacyCompletionsEndpoint?: boolean | undefined; + modelArn?: string | undefined; + env?: Record | undefined; protected createOpenAiAdapter() { return constructLlmApi({ diff --git a/core/llm/llms/Relace.ts b/core/llm/llms/Relace.ts index f7a27c9e3..b533853ea 100644 --- a/core/llm/llms/Relace.ts +++ b/core/llm/llms/Relace.ts @@ -9,4 +9,8 @@ export class Relace extends OpenAI { apiBase: "https://instantapply.endpoint.relace.run/v1/", }; protected useOpenAIAdapterFor: (LlmApiRequestType | "*")[] = ["*"]; + + isProperlyConfigured(): boolean { + return !!this.apiKey; + } }