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; + } }