From b80d736750463f82cf32c603c0d6faa55c8100d2 Mon Sep 17 00:00:00 2001 From: Thorsten Klein Date: Mon, 13 May 2024 07:41:58 +0200 Subject: [PATCH] chore: (breaking) cleanup env var and cli flag names --- pkg/config/config.go | 18 +++++++++++------- pkg/datastore/textsplitter.go | 8 ++++---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index e6ac736c..1bc3b099 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -1,16 +1,20 @@ package config type OpenAIConfig struct { - APIBase string `usage:"OpenAI API base" default:"https://api.openai.com/v1" env:"OPENAI_BASE_URL"` // clicky-chats - APIKey string `usage:"OpenAI API key (not required if used with clicky-chats)" default:"sk-foo" env:"OPENAI_API_KEY"` - EmbeddingModel string `usage:"OpenAI Embedding model" default:"text-embedding-ada-002" env:"OPENAI_EMBEDDING_MODEL"` - APIVersion string `usage:"OpenAI API version (for Azure)" default:"2024-02-01" env:"OPENAI_API_VERSION"` - APIType string `usage:"OpenAI API type (OPEN_AI, AZURE, AZURE_AD)" default:"OPEN_AI" env:"OPENAI_API_TYPE"` + APIBase string `usage:"OpenAI API base" default:"https://api.openai.com/v1" env:"OPENAI_BASE_URL" name:"openai-api-base"` // clicky-chats + APIKey string `usage:"OpenAI API key (not required if used with clicky-chats)" default:"sk-foo" env:"OPENAI_API_KEY" name:"openai-api-key"` + EmbeddingModel string `usage:"OpenAI Embedding model" default:"text-embedding-ada-002" env:"OPENAI_EMBEDDING_MODEL" name:"openai-embedding-model"` + APIVersion string `usage:"OpenAI API version (for Azure)" default:"2024-02-01" env:"OPENAI_API_VERSION" name:"openai-api-version"` + APIType string `usage:"OpenAI API type (OPEN_AI, AZURE, AZURE_AD)" default:"OPEN_AI" env:"OPENAI_API_TYPE" name:"openai-api-type"` +} + +type AzureOpenAIConfig struct { + Deployment string `usage:"Azure OpenAI deployment name" default:"" env:"OPENAI_AZURE_DEPLOYMENT" name:"openai-azure-deployment"` } type DatabaseConfig struct { - DSN string `usage:"Server database connection string (default \"sqlite://$XDG_DATA_HOME/gptscript/knowledge/knowledge.db\")" default:"" env:"KNOW_DSN"` - AutoMigrate string `usage:"Auto migrate database" default:"true" env:"KNOW_AUTO_MIGRATE"` + DSN string `usage:"Server database connection string (default \"sqlite://$XDG_DATA_HOME/gptscript/knowledge/knowledge.db\")" default:"" env:"KNOW_DB_DSN"` + AutoMigrate string `usage:"Auto migrate database" default:"true" env:"KNOW_DB_AUTO_MIGRATE"` } type VectorDBConfig struct { diff --git a/pkg/datastore/textsplitter.go b/pkg/datastore/textsplitter.go index e78ad105..c5c7c383 100644 --- a/pkg/datastore/textsplitter.go +++ b/pkg/datastore/textsplitter.go @@ -3,10 +3,10 @@ package datastore import lcgosplitter "github.com/tmc/langchaingo/textsplitter" type TextSplitterOpts struct { - ChunkSize int `usage:"Textsplitter Chunk Size" default:"1024" env:"KNOW_TEXTSPLITTER_CHUNK_SIZE"` - ChunkOverlap int `usage:"Textsplitter Chunk Overlap" default:"256" env:"KNOW_TEXTSPLITTER_CHUNK_OVERLAP"` - ModelName string `usage:"Textsplitter Model Name" default:"gpt-4" env:"KNOW_TEXTSPLITTER_MODEL_NAME"` - EncodingName string `usage:"Textsplitter Encoding Name" default:"cl100k_base" env:"KNOW_TEXTSPLITTER_ENCODING_NAME"` + ChunkSize int `usage:"Textsplitter Chunk Size" default:"1024" env:"KNOW_TEXTSPLITTER_CHUNK_SIZE" name:"textsplitter-chunk-size"` + ChunkOverlap int `usage:"Textsplitter Chunk Overlap" default:"256" env:"KNOW_TEXTSPLITTER_CHUNK_OVERLAP" name:"textsplitter-chunk-overlap"` + ModelName string `usage:"Textsplitter Model Name" default:"gpt-4" env:"KNOW_TEXTSPLITTER_MODEL_NAME" name:"textsplitter-model-name"` + EncodingName string `usage:"Textsplitter Encoding Name" default:"cl100k_base" env:"KNOW_TEXTSPLITTER_ENCODING_NAME" name:"textsplitter-encoding-name"` } // NewTextSplitterOpts returns the default options for a text splitter.