From f85e6d5f98caccbac3cad43585a3d7f2d3bde968 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 11 Jan 2024 15:35:12 -0300 Subject: [PATCH] feat: add gpt-4-1106-preview and gpt-3.5-turbo-1106 (#190) also move the config template to a yaml file and embed it, so we have proper syntax highlight and editor support on it. Signed-off-by: Carlos Alexandro Becker --- config.go | 5 +++++ config_template.go => config_template.yml | 17 +++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) rename config_template.go => config_template.yml (88%) diff --git a/config.go b/config.go index 477be9ea..486ca733 100644 --- a/config.go +++ b/config.go @@ -8,6 +8,8 @@ import ( "text/template" "time" + _ "embed" + "github.com/adrg/xdg" "github.com/caarlos0/duration" "github.com/caarlos0/env/v9" @@ -18,6 +20,9 @@ import ( "gopkg.in/yaml.v3" ) +//go:embed config_template.yml +var configTemplate string + var help = map[string]string{ "api": "OpenAI compatible REST API (openai, localai).", "apis": "Aliases and endpoints for OpenAI compatible REST API.", diff --git a/config_template.go b/config_template.yml similarity index 88% rename from config_template.go rename to config_template.yml index 675929c6..dee599f0 100644 --- a/config_template.go +++ b/config_template.yml @@ -1,6 +1,4 @@ -package main - -const configTemplate = `# {{ index .Help "model" }} +# {{ index .Help "model" }} default-model: gpt-4 # {{ index .Help "format-text" }} format-text: Format the response as markdown without enclosing backticks. @@ -36,13 +34,17 @@ max-input-chars: 12250 apis: openai: base-url: https://api.openai.com/v1 - api-key: + api-key: api-key-env: OPENAI_API_KEY models: gpt-4: aliases: ["4"] max-input-chars: 24500 fallback: gpt-3.5-turbo + gpt-4-1106-preview: + aliases: ["128k"] + max-input-chars: 392000 + fallback: gpt-4 gpt-4-32k: aliases: ["32k"] max-input-chars: 98000 @@ -51,6 +53,10 @@ apis: aliases: ["35t"] max-input-chars: 12250 fallback: gpt-3.5 + gpt-3.5-turbo-1106: + aliases: ["35t-1106"] + max-input-chars: 12250 + fallback: gpt-3.5-turbo gpt-3.5-turbo-16k: aliases: ["35t16k"] max-input-chars: 44500 @@ -71,7 +77,7 @@ apis: # Set to 'azure-ad' to use Active Directory # Azure OpenAI setup: https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource base-url: https://YOUR_RESOURCE_NAME.openai.azure.com - api-key: + api-key: api-key-env: AZURE_OPENAI_KEY models: gpt-4: @@ -86,4 +92,3 @@ apis: aliases: ["az35"] max-input-chars: 12250 fallback: -`