Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add a vision model usage type and alias #777

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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
1 change: 1 addition & 0 deletions apiclient/types/defaultmodelalias.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const (
DefaultModelAliasTypeLLM DefaultModelAliasType = "llm"
DefaultModelAliasTypeLLMMini DefaultModelAliasType = "llm-mini"
DefaultModelAliasTypeImageGeneration DefaultModelAliasType = "image-generation"
DefaultModelAliasTypeVision DefaultModelAliasType = "vision"
)

type DefaultModelAlias struct {
Expand Down
1 change: 1 addition & 0 deletions apiclient/types/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ const (
ModelUsageLLM ModelUsage = "llm"
ModelUsageEmbedding ModelUsage = "text-embedding"
ModelUsageImage ModelUsage = "image-generation"
ModelUsageVision ModelUsage = "vision"
ModelUsageOther ModelUsage = "other"
)
11 changes: 10 additions & 1 deletion pkg/controller/data/default-model-aliases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,13 @@ items:
spec:
manifest:
alias: image-generation
model: dall-e-3
model: dall-e-3
- apiVersion: otto.otto8.ai/v1
kind: DefaultModelAlias
metadata:
name: vision
namespace: default
spec:
manifest:
alias: vision
model: gpt-4o
2 changes: 1 addition & 1 deletion pkg/controller/handlers/knowledgefile/knowledgefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (h *Handler) ingest(ctx context.Context, client kclient.Client, file *v1.Kn
"input": inputName,
"output": outputFile(file.Spec.FileName),
}, invoke.SystemTaskOptions{
Env: []string{"OPENAI_MODEL=" + string(types.DefaultModelAliasTypeLLM)},
Env: []string{"OPENAI_MODEL=" + string(types.DefaultModelAliasTypeVision)},
})
if err != nil {
return err
Expand Down
5 changes: 5 additions & 0 deletions ui/admin/app/lib/model/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const ModelUsage = {
LLM: "llm",
TextEmbedding: "text-embedding",
ImageGeneration: "image-generation",
Vision: "vision",
Other: "other",
} as const;
export type ModelUsage = (typeof ModelUsage)[keyof typeof ModelUsage];
Expand All @@ -14,6 +15,7 @@ const ModelUsageLabels = {
[ModelUsage.LLM]: "Language Model (Chat)",
[ModelUsage.TextEmbedding]: "Text Embedding (Knowledge)",
[ModelUsage.ImageGeneration]: "Image Generation",
[ModelUsage.Vision]: "Vision",
[ModelUsage.Other]: "Other",
} as const;

Expand All @@ -28,6 +30,7 @@ export const ModelAlias = {
LlmMini: "llm-mini",
TextEmbedding: "text-embedding",
ImageGeneration: "image-generation",
Vision: "vision",
} as const;
export type ModelAlias = (typeof ModelAlias)[keyof typeof ModelAlias];

Expand All @@ -36,6 +39,7 @@ const ModelAliasLabels = {
[ModelAlias.LlmMini]: "Language Model (Chat - Fast)",
[ModelAlias.TextEmbedding]: "Text Embedding (Knowledge)",
[ModelAlias.ImageGeneration]: "Image Generation",
[ModelAlias.Vision]: "Vision",
} as const;

export const getModelAliasLabel = (alias: string) => {
Expand All @@ -49,6 +53,7 @@ export const ModelAliasToUsageMap = {
[ModelAlias.LlmMini]: ModelUsage.LLM,
[ModelAlias.TextEmbedding]: ModelUsage.TextEmbedding,
[ModelAlias.ImageGeneration]: ModelUsage.ImageGeneration,
[ModelAlias.Vision]: ModelUsage.Vision,
} as const;

export type ModelManifest = {
Expand Down