From 95822fd4ffead30034c11fffa94ea16f923c7ac1 Mon Sep 17 00:00:00 2001 From: conneroisu Date: Thu, 5 Sep 2024 22:09:18 -0400 Subject: [PATCH] remove unused unimpactful code --- models.go | 58 +++++++++++++++++++++--------------------- scripts/models/main.go | 18 ++++++++----- 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/models.go b/models.go index e618b19..6770d65 100644 --- a/models.go +++ b/models.go @@ -19,32 +19,32 @@ const ( translationsSuffix Endpoint = "/audio/translations" embeddingsSuffix Endpoint = "/embeddings" moderationsSuffix Endpoint = "/moderations" - // Llama3Groq70B8192ToolUsePreview is an AI text model provided by Groq. It has 8192 context window. - Llama3Groq70B8192ToolUsePreview Model = "llama3-groq-70b-8192-tool-use-preview" - // WhisperLargeV3 is an AI audio model provided by OpenAI. It has 448 context window. - WhisperLargeV3 Model = "whisper-large-v3" - // Mixtral8X7B32768 is an AI text model provided by Mistral AI. It has 32768 context window. - Mixtral8X7B32768 Model = "mixtral-8x7b-32768" - // Llama3Groq8B8192ToolUsePreview is an AI text model provided by Groq. It has 8192 context window. - Llama3Groq8B8192ToolUsePreview Model = "llama3-groq-8b-8192-tool-use-preview" // Llama318BInstant is an AI text model provided by Meta. It has 131072 context window. Llama318BInstant Model = "llama-3.1-8b-instant" - // LlavaV157B4096Preview is an AI text model provided by Other. It has 4096 context window. - LlavaV157B4096Preview Model = "llava-v1.5-7b-4096-preview" - // DistilWhisperLargeV3En is an AI audio model provided by Hugging Face. It has 448 context window. - DistilWhisperLargeV3En Model = "distil-whisper-large-v3-en" - // LlamaGuard38B is an AI audio model provided by Meta. It has 8192 context window. - LlamaGuard38B Model = "llama-guard-3-8b" - // Llama3170BVersatile is an AI text model provided by Meta. It has 131072 context window. - Llama3170BVersatile Model = "llama-3.1-70b-versatile" - // Llama38B8192 is an AI text model provided by Meta. It has 8192 context window. - Llama38B8192 Model = "llama3-8b-8192" // Gemma7BIt is an AI text model provided by Google. It has 8192 context window. Gemma7BIt Model = "gemma-7b-it" + // WhisperLargeV3 is an AI audio model provided by OpenAI. It has 448 context window. + WhisperLargeV3 Model = "whisper-large-v3" // Gemma29BIt is an AI text model provided by Google. It has 8192 context window. Gemma29BIt Model = "gemma2-9b-it" // Llama370B8192 is an AI text model provided by Meta. It has 8192 context window. Llama370B8192 Model = "llama3-70b-8192" + // Llama3Groq70B8192ToolUsePreview is an AI text model provided by Groq. It has 8192 context window. + Llama3Groq70B8192ToolUsePreview Model = "llama3-groq-70b-8192-tool-use-preview" + // Llama38B8192 is an AI text model provided by Meta. It has 8192 context window. + Llama38B8192 Model = "llama3-8b-8192" + // Llama3170BVersatile is an AI text model provided by Meta. It has 131072 context window. + Llama3170BVersatile Model = "llama-3.1-70b-versatile" + // LlavaV157B4096Preview is an AI text model provided by Other. It has 4096 context window. + LlavaV157B4096Preview Model = "llava-v1.5-7b-4096-preview" + // LlamaGuard38B is an AI audio model provided by Meta. It has 8192 context window. + LlamaGuard38B Model = "llama-guard-3-8b" + // Mixtral8X7B32768 is an AI text model provided by Mistral AI. It has 32768 context window. + Mixtral8X7B32768 Model = "mixtral-8x7b-32768" + // DistilWhisperLargeV3En is an AI audio model provided by Hugging Face. It has 448 context window. + DistilWhisperLargeV3En Model = "distil-whisper-large-v3-en" + // Llama3Groq8B8192ToolUsePreview is an AI text model provided by Groq. It has 8192 context window. + Llama3Groq8B8192ToolUsePreview Model = "llama3-groq-8b-8192-tool-use-preview" ) var disabledModelsForEndpoints = map[Endpoint]map[Model]bool{ @@ -57,28 +57,28 @@ var disabledModelsForEndpoints = map[Endpoint]map[Model]bool{ DistilWhisperLargeV3En: true, }, transcriptionsSuffix: { - Llama3Groq70B8192ToolUsePreview: true, - Mixtral8X7B32768: true, - Llama3Groq8B8192ToolUsePreview: true, Llama318BInstant: true, - LlavaV157B4096Preview: true, - Llama3170BVersatile: true, - Llama38B8192: true, Gemma7BIt: true, Gemma29BIt: true, Llama370B8192: true, - }, - translationsSuffix: { Llama3Groq70B8192ToolUsePreview: true, + Llama38B8192: true, + Llama3170BVersatile: true, + LlavaV157B4096Preview: true, Mixtral8X7B32768: true, Llama3Groq8B8192ToolUsePreview: true, + }, + translationsSuffix: { Llama318BInstant: true, - LlavaV157B4096Preview: true, - Llama3170BVersatile: true, - Llama38B8192: true, Gemma7BIt: true, Gemma29BIt: true, Llama370B8192: true, + Llama3Groq70B8192ToolUsePreview: true, + Llama38B8192: true, + Llama3170BVersatile: true, + LlavaV157B4096Preview: true, + Mixtral8X7B32768: true, + Llama3Groq8B8192ToolUsePreview: true, }, moderationsSuffix: { LlamaGuard38B: true, diff --git a/scripts/models/main.go b/scripts/models/main.go index 318a8a4..b844647 100644 --- a/scripts/models/main.go +++ b/scripts/models/main.go @@ -11,7 +11,6 @@ import ( "log" "net/http" "os" - "strings" "text/template" "github.com/samber/lo" @@ -132,20 +131,28 @@ func run(ctx context.Context) error { func fillTemplate(w io.Writer, models []ResponseModel) error { funcMap := template.FuncMap{ + // isTextModel returns true if the model has a context window + // greater than 1024 and is not specific models like + // llama-guard-3-8b. "isTextModel": func(model ResponseModel) bool { - // if context window is greater than 1024 then it is a text model if model.ID != "llama-guard-3-8b" { return model.ContextWindow > 1024 } return false }, + // isAudioModel returns true if the model has a context window + // less than 1024 and is not specific models like + // llama-guard-3-8b. "isAudioModel": func(model ResponseModel) bool { - // if context window is less than 1024 then it is a audio model if model.ID != "llama-guard-3-8b" { return model.ContextWindow < 1024 } return false }, + // isModerationModel returns true if the model is + // a model that can be used for moderation. + // + // llama-guard-3-8b is a moderation model. "isModerationModel": func(model ResponseModel) bool { // if the id of the model is llama-guard-3-8b return model.ID == "llama-guard-3-8b" @@ -164,13 +171,10 @@ func fillTemplate(w io.Writer, models []ResponseModel) error { return nil } -// nameModels func nameModels(models []ResponseModel) { for i, _ := range models { if (models)[i].Name == "" { - filtered := strings.Replace(models[i].ID, "-", "_", -1) - filtered = strings.Replace(filtered, ".", "_", -1) - models[i].Name = lo.PascalCase(filtered) + models[i].Name = lo.PascalCase(models[i].ID) } } }