isProperlyConfigured

This commit is contained in:
Nate 2025-04-06 15:01:04 -07:00
parent 400df1a51a
commit cfcbee33a4
3 changed files with 15 additions and 0 deletions

5
core/index.d.ts vendored
View file

@ -162,6 +162,11 @@ export interface ILLM extends LLMOptions {
otherData: Record<string, string>,
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 {

View file

@ -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<string, string | number | boolean> | undefined;
protected createOpenAiAdapter() {
return constructLlmApi({

View file

@ -9,4 +9,8 @@ export class Relace extends OpenAI {
apiBase: "https://instantapply.endpoint.relace.run/v1/",
};
protected useOpenAIAdapterFor: (LlmApiRequestType | "*")[] = ["*"];
isProperlyConfigured(): boolean {
return !!this.apiKey;
}
}