Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@types:registry=https://registry.npmjs.org/
registry=https://registry.npmjs.org/
9 changes: 8 additions & 1 deletion binary/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/autocomplete/CompletionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class CompletionProvider {

// Ignore empty API keys for Mistral since we currently write
// a template provider without one during onboarding
if (llm.providerName === "mistral" && llm.apiKey === "") {
if ((llm.providerName === "mistral" || llm.providerName === "oca") && llm.apiKey === "") {
return undefined;
}

Expand Down
1 change: 1 addition & 0 deletions core/config/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ function llmToSerializedModelDescription(llm: ILLM): ModelDescription {
apiKeyLocation: llm.apiKeyLocation,
envSecretLocations: llm.envSecretLocations,
sourceFile: llm.sourceFile,
modelInfo: llm.getModelInfo(llm.model)
};
}

Expand Down
22 changes: 22 additions & 0 deletions core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ type RequiredLLMOptions =
export interface ILLM
extends Omit<LLMOptions, RequiredLLMOptions>,
Required<Pick<LLMOptions, RequiredLLMOptions>> {
getModelInfo(model: string): ModelInfo | undefined;
get providerName(): string;
get underlyingProviderName(): string;

Expand Down Expand Up @@ -1131,6 +1132,26 @@ export interface ModelCapability {
tools?: boolean;
}

export interface ModelInfo {
maxTokens?: number | undefined;
contextWindow?: number | undefined;
supportsImages?: boolean | undefined;
supportsPromptCache: boolean;
inputPrice?: number | undefined;
outputPrice?: number | undefined;
cacheWritesPrice?: number | undefined;
cacheReadsPrice?: number | undefined;
description?: string | undefined;
temperature?: number | undefined;
surveyContent?: string | undefined;
surveyId?: string | undefined;
bannerContent?: string | undefined;
modelName: string;
}

export interface ModelInfoMap {
models: { [key: string]: ModelInfo };
}
export interface ModelDescription {
title: string;
provider: string;
Expand All @@ -1156,6 +1177,7 @@ export interface ModelDescription {
promptTemplates?: { [key: string]: string };
cacheBehavior?: CacheBehavior;
capabilities?: ModelCapability;
modelInfo?: ModelInfo
roles?: ModelRole[];
configurationStatus?: LLMConfigurationStatuses;

Expand Down
7 changes: 7 additions & 0 deletions core/llm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
TabAutocompleteOptions,
TemplateType,
Usage,
type ModelInfo,
} from "../index.js";
import mergeJson from "../util/merge.js";
import { renderChatMessage } from "../util/messageContent.js";
Expand Down Expand Up @@ -295,6 +296,12 @@ export abstract class BaseLLM implements ILLM {
this.autocompleteOptions = options.autocompleteOptions;
this.sourceFile = options.sourceFile;
}
getModelInfo(model: string): ModelInfo | undefined {
return undefined;
}
useLegacyCompletionsEndpoint?: boolean | undefined;
modelArn?: string | undefined;
env?: Record<string, string | number | boolean> | undefined;

getConfigurationStatus() {
return LLMConfigurationStatuses.VALID;
Expand Down
2 changes: 1 addition & 1 deletion core/llm/llms/BedrockImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BedrockImport extends BaseLLM {
region: "us-east-1",
};
// the BedRock imported custom model ARN
modelArn?: string | undefined;
declare modelArn?: string | undefined;

constructor(options: LLMOptions) {
super(options);
Expand Down
2 changes: 2 additions & 0 deletions core/llm/llms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import Vllm from "./Vllm";
import Voyage from "./Voyage";
import WatsonX from "./WatsonX";
import xAI from "./xAI";
import Oca from "./oca/Oca";
export const LLMClasses = [
Anthropic,
Cohere,
Expand Down Expand Up @@ -116,6 +117,7 @@ export const LLMClasses = [
Inception,
Voyage,
LlamaStack,
Oca
];

export async function llmFromDescription(
Expand Down
Loading