Skip to content

Commit

Permalink
add return type of function
Browse files Browse the repository at this point in the history
  • Loading branch information
tcm390 committed Jan 4, 2025
1 parent 85452fe commit 2af9a09
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/core/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
ModelProviderName,
ModelClass,
ModelSettings,
ImageModelSettings,
} from "./types.ts";

export const models: Models = {
Expand Down Expand Up @@ -938,12 +939,16 @@ export const models: Models = {
export function getModelSettings(
provider: ModelProviderName,
type: ModelClass
): ModelSettins {
return models[provider].model[type] as ModelSettings;
): ModelSettings | undefined {
return models[provider]?.model[type] as ModelSettings | undefined;
}

export function getImageModelSettings(provider: ModelProviderName) {
return models[provider].model[ModelClass.IMAGE];
export function getImageModelSettings(
provider: ModelProviderName
): ImageModelSettings | undefined {
return models[provider]?.model[ModelClass.IMAGE] as
| ImageModelSettings
| undefined;
}

export function getEndpoint(provider: ModelProviderName) {
Expand Down

0 comments on commit 2af9a09

Please sign in to comment.