From 20a0cd2f66b327e814350901c46eb53f37fe0db2 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Thu, 1 Jun 2023 03:31:55 -0400 Subject: [PATCH] Not anywhere close to done, but getting back to this and staging some progress. Preliminary pass on loading a config and overriding params with request json. --- api/config.go | 2 +- apiv2/config.go | 218 +++++++++++------ apiv2/localai.go | 174 ++++++++------ apiv2/localai.go.old | 196 +++++++++++++++ apiv2/localai_nethttp.go | 14 ++ build_tools.go | 3 +- config/gpt-3.5-turbo-chat.yaml | 11 + go.mod | 76 +++--- go.sum | 173 ++++++------- main.go | 28 ++- openai-openapi/config.yaml | 6 +- openai-openapi/endpoint-body-mapping.tmpl | 19 ++ pkg/model/loader.go | 280 +++++++++++----------- 13 files changed, 812 insertions(+), 388 deletions(-) create mode 100644 apiv2/localai.go.old create mode 100644 apiv2/localai_nethttp.go create mode 100644 config/gpt-3.5-turbo-chat.yaml create mode 100644 openai-openapi/endpoint-body-mapping.tmpl diff --git a/api/config.go b/api/config.go index 7e0d8264..bfb42e84 100644 --- a/api/config.go +++ b/api/config.go @@ -80,7 +80,7 @@ func ReadConfig(file string) (*Config, error) { return c, nil } -func (cm ConfigMerger) LoadConfigFile(file string) error { +func (cm *ConfigMerger) LoadConfigFile(file string) error { cm.Lock() defer cm.Unlock() c, err := ReadConfigFile(file) diff --git a/apiv2/config.go b/apiv2/config.go index f513fe51..fe437015 100644 --- a/apiv2/config.go +++ b/apiv2/config.go @@ -2,123 +2,203 @@ package apiv2 import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" "sync" + "github.com/mitchellh/mapstructure" "gopkg.in/yaml.v2" ) -type Config struct { - Name string `yaml:"name"` - Endpoint string `yaml:"endpoint"` - Template string `yaml:"template"` - RequestDefaults interface{} `yaml:"request_defaults"` +type ConfigRegistration struct { + Endpoint string `yaml:"endpoint" json:"endpoint" mapstructure:"endpoint"` + Model string `yaml:"model" json:"model" mapstructure:"model"` } -type ConfigMerger struct { - configs map[string]Config +type ConfigLocalPaths struct { + Model string `yaml:"model" mapstructure:"model"` + Template string `yaml:"template" mapstructure:"template"` +} + +type ConfigStub struct { + Registration ConfigRegistration `yaml:"registration" mapstructure:"registration"` + LocalPaths ConfigLocalPaths `yaml:"local_paths" mapstructure:"local_paths"` +} + +type SpecificConfig[RequestModel any] struct { + ConfigStub `mapstructure:",squash"` + RequestDefaults RequestModel `yaml:"request_defaults" mapstructure:"request_defaults"` +} + +// type Config struct { +// Registration ConfigRegistration `yaml:"registration"` +// LocalPaths ConfigLocalPaths `yaml:"local_paths"` +// RequestDefaults interface{} `yaml:"request_defaults"` +// } + +type Config interface { + GetRequestDefaults() interface{} + GetLocalPaths() ConfigLocalPaths + GetRegistration() ConfigRegistration +} + +func (sc SpecificConfig[RequestModel]) GetRequestDefaults() interface{} { + return sc.RequestDefaults +} + +func (sc SpecificConfig[RequestModel]) GetLocalPaths() ConfigLocalPaths { + return sc.LocalPaths +} + +func (sc SpecificConfig[RequestModel]) GetRegistration() ConfigRegistration { + return sc.Registration +} + +type ConfigManager struct { + configs map[ConfigRegistration]Config sync.Mutex } -func NewConfigMerger() *ConfigMerger { - return &ConfigMerger{ - configs: make(map[string]Config), +func NewConfigManager() *ConfigManager { + return &ConfigManager{ + configs: make(map[ConfigRegistration]Config), } } -func ReadConfigFile(file string) ([]*Config, error) { - c := &[]*Config{} - f, err := os.ReadFile(file) + +// Private helper method doesn't enforce the mutex. This is because loading at the directory level keeps the lock up the whole time, and I like that. +func (cm *ConfigManager) loadConfigFile(path string) (*Config, error) { + fmt.Printf("INTERNAL loadConfigFile for %s\n", path) + stub := ConfigStub{} + f, err := os.ReadFile(path) if err != nil { return nil, fmt.Errorf("cannot read config file: %w", err) } - if err := yaml.Unmarshal(f, c); err != nil { + if err := yaml.Unmarshal(f, &stub); err != nil { return nil, fmt.Errorf("cannot unmarshal config file: %w", err) } + fmt.Printf("RAW STUB: %+v\n", stub) + // fmt.Printf("DUMB SHIT: %+v\n%T\n", EndpointToRequestBodyMap[rawConfig.Registration.Endpoint], EndpointToRequestBodyMap[rawConfig.Registration.Endpoint]) - return *c, nil -} + endpoint := stub.Registration.Endpoint -func ReadConfig(file string) (*Config, error) { - c := &Config{} - f, err := os.ReadFile(file) - if err != nil { - return nil, fmt.Errorf("cannot read config file: %w", err) - } - if err := yaml.Unmarshal(f, c); err != nil { - return nil, fmt.Errorf("cannot unmarshal config file: %w", err) + // EndpointConfigMap is generated over in localai.gen.go + // It's a map that translates a string endpoint function name to an empty SpecificConfig[T], with the type parameter for that request. + if structType, ok := EndpointConfigMap[endpoint]; ok { + fmt.Printf("~~ EndpointConfigMap[%s]: %+v\n", endpoint, structType) + tmpUnmarshal := map[string]interface{}{} + if err := yaml.Unmarshal(f, &tmpUnmarshal); err != nil { + if e, ok := err.(*yaml.TypeError); ok { + fmt.Println("\n!!!!!Type error:", e) + } + return nil, fmt.Errorf("cannot unmarshal config file for %s: %w", endpoint, err) + } + fmt.Printf("$$$ tmpUnmarshal: %+v\n", tmpUnmarshal) + mapstructure.Decode(tmpUnmarshal, &structType) + + fmt.Printf("AFTER UNMARSHAL %T\n%+v\n=======\n", structType, structType) + + // rawConfig.RequestDefaults = structType.GetRequestDefaults() + + cm.configs[structType.GetRegistration()] = structType + // fmt.Printf("\n\n\n!!!!!HIT BOTTOM!!!!!!") + return &structType, nil + // fmt.Printf("\n\n\n!!!!!\n\n\nBIG MISS!\n\n%+v\n\n%T\n%T=====", specificStruct, specificStruct, structType) } - return c, nil + // for i, ts := range EndpointToRequestBodyMap { + // fmt.Printf("%s: %+v\n", i, ts) + // } + + return nil, fmt.Errorf("failed to parse config for endpoint %s", endpoint) } -func (cm ConfigMerger) LoadConfigFile(file string) error { +func (cm *ConfigManager) LoadConfigFile(path string) (*Config, error) { + fmt.Printf("LoadConfigFile TOP for %s", path) + + cm.Lock() + fmt.Println("cm.Lock done") + + defer cm.Unlock() + fmt.Println("cm.Unlock done") + + return cm.loadConfigFile(path) +} + +func (cm *ConfigManager) LoadConfigDirectory(path string) ([]ConfigRegistration, error) { + fmt.Printf("LoadConfigDirectory TOP for %s\n", path) cm.Lock() defer cm.Unlock() - c, err := ReadConfigFile(file) + files, err := os.ReadDir(path) if err != nil { - return fmt.Errorf("cannot load config file: %w", err) + return []ConfigRegistration{}, err + } + fmt.Printf("os.ReadDir done, found %d files\n", len(files)) + + for _, file := range files { + // Skip anything that isn't yaml + if !strings.Contains(file.Name(), ".yaml") { + continue + } + _, err := cm.loadConfigFile(filepath.Join(path, file.Name())) + if err != nil { + return []ConfigRegistration{}, err + } } - for _, cc := range c { - cm.configs[cc.Name] = *cc - } - return nil + fmt.Printf("LoadConfigDirectory DONE %d", len(cm.configs)) + + return cm.listConfigs(), nil } -func (cm ConfigMerger) LoadConfig(file string) error { +func (cm *ConfigManager) GetConfig(r ConfigRegistration) (Config, bool) { cm.Lock() defer cm.Unlock() - c, err := ReadConfig(file) - if err != nil { - return fmt.Errorf("cannot read config file: %w", err) - } - - cm.configs[c.Name] = *c - return nil -} - -func (cm ConfigMerger) GetConfig(m string) (Config, bool) { - cm.Lock() - defer cm.Unlock() - v, exists := cm.configs[m] + v, exists := cm.configs[r] return v, exists } -func (cm ConfigMerger) ListConfigs() []string { - cm.Lock() - defer cm.Unlock() - var res []string +func (cm *ConfigManager) listConfigs() []ConfigRegistration { + var res []ConfigRegistration for k := range cm.configs { res = append(res, k) } return res } -func (cm ConfigMerger) LoadConfigs(path string) error { +func (cm *ConfigManager) ListConfigs() []ConfigRegistration { cm.Lock() defer cm.Unlock() - files, err := ioutil.ReadDir(path) - if err != nil { - return err - } - - for _, file := range files { - // Skip templates, YAML and .keep files - if !strings.Contains(file.Name(), ".yaml") { - continue - } - c, err := ReadConfig(filepath.Join(path, file.Name())) - if err == nil { - cm.configs[c.Name] = *c - } - } - - return nil + return cm.listConfigs() } +// // Not sure about this one, but it seems like a decent place to stick it for an experiment at least. +// func (cm *ConfigManager) GetTextConfigForRequest() + +// func (cm *ConfigMerger) LoadConfigs(path string) error { +// cm.Lock() +// defer cm.Unlock() +// files, err := ioutil.ReadDir(path) +// if err != nil { +// return err +// } + +// for _, file := range files { +// // Skip templates, YAML and .keep files +// if !strings.Contains(file.Name(), ".yaml") { +// continue +// } +// c, err := ReadConfig(filepath.Join(path, file.Name())) +// if err == nil { +// cm.configs[ConfigLookup{Name: c.Name, Endpoint: c.Endpoint}] = *c +// } +// } + +// return nil +// } + +// func (cm *ConfigMerger) Get + // func updateConfig(config *Config, input *OpenAIRequest) { // if input.Echo { // config.Echo = input.Echo diff --git a/apiv2/localai.go b/apiv2/localai.go index 7a76288f..8d237a67 100644 --- a/apiv2/localai.go +++ b/apiv2/localai.go @@ -3,20 +3,36 @@ package apiv2 import ( "encoding/json" "fmt" + "io" "net/http" + "runtime" + "strings" + + "github.com/mitchellh/mapstructure" ) type LocalAIServer struct { - configMerger *ConfigMerger + configManager *ConfigManager } -var _ ServerInterface = (*LocalAIServer)(nil) - type Error struct { Code int `json:"code"` Message string `json:"message"` } +type ModelOnlyRequest struct { + Model string `json:"model" yaml:"model"` +} + +// This function grabs the name of the function that calls it, skipping up the callstack `skip` levels. +// This is probably a go war crime, but NJ method and all. It's an awesome way to index EndpointConfigMap +func printCurrentFunctionName(skip int) string { + pc, _, _, _ := runtime.Caller(skip) + funcName := runtime.FuncForPC(pc).Name() + fmt.Println("Current function:", funcName) + return funcName +} + func sendError(w http.ResponseWriter, code int, message string) { localAiError := Error{ Code: code, @@ -26,39 +42,91 @@ func sendError(w http.ResponseWriter, code int, message string) { json.NewEncoder(w).Encode(localAiError) } -// It won't work, but it's worth a try. -const nyiErrorMessageFormatString = "%s is not yet implemented by LocalAI\nThere is no need to contact support about this error and retrying will not help.\nExpect an update at https://github.com/go-skynet/LocalAI if this changes!" +// TODO: Is it a good idea to return "" in cases where the model isn't provided? +// Or is that actually an error condition? +// NO is a decent guess as any to start with? +// r *http.Request +func (server *LocalAIServer) getRequestModelName(body []byte) string { + var modelOnlyRequest = ModelOnlyRequest{} + if err := json.Unmarshal(body, &modelOnlyRequest); err != nil { + fmt.Printf("ERR in getRequestModelName, %+v", err) + return "" + } + return modelOnlyRequest.Model +} -// Do we want or need an additional "wontfix" template that is even stronger than this? -const nyiDepreciatedErrorMessageFormatString = "%s is a depreciated portion of the OpenAI API, and is not yet implemented by LocalAI\nThere is no need to contact support about this error and retrying will not help." +func (server *LocalAIServer) combineRequestAndConfig(endpointName string, body []byte) (interface{}, error) { + model := server.getRequestModelName(body) + + lookup := ConfigRegistration{Model: model, Endpoint: endpointName} + + config, exists := server.configManager.GetConfig(lookup) + + if !exists { + return nil, fmt.Errorf("Config not found for %+v", lookup) + } + + // fmt.Printf("Model: %s\nConfig: %+v\n", model, config) + + request := config.GetRequestDefaults() + // fmt.Printf("BEFORE rD: %T\n%+v\n\n", request, request) + tmpUnmarshal := map[string]interface{}{} + if err := json.Unmarshal(body, &tmpUnmarshal); err != nil { + return nil, fmt.Errorf("error unmarshalling json to temp map\n%w", err) + } + // fmt.Printf("$$$ tmpUnmarshal: %+v\n", tmpUnmarshal) + mapstructure.Decode(tmpUnmarshal, &request) + fmt.Printf("AFTER rD: %T\n%+v\n\n", request, request) + return request, nil +} + +func (server *LocalAIServer) getRequest(w http.ResponseWriter, r *http.Request) (interface{}, error) { + body, err := io.ReadAll(r.Body) + if err != nil { + sendError(w, http.StatusBadRequest, "Failed to read body") + } + + splitFnName := strings.Split(printCurrentFunctionName(2), ".") + + endpointName := splitFnName[len(splitFnName)-1] + + return server.combineRequestAndConfig(endpointName, body) +} // CancelFineTune implements ServerInterface func (*LocalAIServer) CancelFineTune(w http.ResponseWriter, r *http.Request, fineTuneId string) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "Fine Tune")) - return -} - -// CreateAnswer implements ServerInterface -func (*LocalAIServer) CreateAnswer(w http.ResponseWriter, r *http.Request) { - sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "CreateAnswer")) - return + panic("unimplemented") } // CreateChatCompletion implements ServerInterface -func (*LocalAIServer) CreateChatCompletion(w http.ResponseWriter, r *http.Request) { - var chatRequest CreateChatCompletionRequest - if err := json.NewDecoder(r.Body).Decode(&chatRequest); err != nil { - sendError(w, http.StatusBadRequest, "Invalid CreateChatCompletionRequest") +func (server *LocalAIServer) CreateChatCompletion(w http.ResponseWriter, r *http.Request) { + fmt.Println("HIT APIv2 CreateChatCompletion!") + + request, err := server.getRequest(w, r) + + if err != nil { + sendError(w, http.StatusBadRequest, err.Error()) + } + + // fmt.Printf("\n!!! Survived to attempt cast. BEFORE:\n\tType: %T\n\t%+v", request, request) + + chatRequest, castSuccess := request.(CreateChatCompletionRequest) + + if !castSuccess { + sendError(w, http.StatusInternalServerError, "Cast Fail???") return } - configMerger.GetConfig(chatRequest.Model) + + fmt.Printf("\n\n!! AFTER !!\ntemperature %f\n top_p %f \n %d\n", *chatRequest.Temperature, *chatRequest.TopP, *chatRequest.XLocalaiExtensions.TopK) + + fmt.Printf("chatRequest: %+v\nlen(messages): %d", chatRequest, len(chatRequest.Messages)) + for i, m := range chatRequest.Messages { + fmt.Printf("message #%d: %+v", i, m) + } } -// CreateClassification implements ServerInterface -func (*LocalAIServer) CreateClassification(w http.ResponseWriter, r *http.Request) { - sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "CreateClassification")) - return -} +// switch chatRequest := requestDefault.(type) { +// case CreateChatCompletionRequest: // CreateCompletion implements ServerInterface func (*LocalAIServer) CreateCompletion(w http.ResponseWriter, r *http.Request) { @@ -67,8 +135,7 @@ func (*LocalAIServer) CreateCompletion(w http.ResponseWriter, r *http.Request) { // CreateEdit implements ServerInterface func (*LocalAIServer) CreateEdit(w http.ResponseWriter, r *http.Request) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "CreateEdit")) - return + panic("unimplemented") } // CreateEmbedding implements ServerInterface @@ -78,14 +145,12 @@ func (*LocalAIServer) CreateEmbedding(w http.ResponseWriter, r *http.Request) { // CreateFile implements ServerInterface func (*LocalAIServer) CreateFile(w http.ResponseWriter, r *http.Request) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "Create File")) - return + panic("unimplemented") } // CreateFineTune implements ServerInterface func (*LocalAIServer) CreateFineTune(w http.ResponseWriter, r *http.Request) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "Create Fine Tune")) - return + panic("unimplemented") } // CreateImage implements ServerInterface @@ -105,14 +170,7 @@ func (*LocalAIServer) CreateImageVariation(w http.ResponseWriter, r *http.Reques // CreateModeration implements ServerInterface func (*LocalAIServer) CreateModeration(w http.ResponseWriter, r *http.Request) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "CreateModeration")) - return -} - -// CreateSearch implements ServerInterface -func (*LocalAIServer) CreateSearch(w http.ResponseWriter, r *http.Request, engineId string) { - sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "CreateSearch")) - return + panic("unimplemented") } // CreateTranscription implements ServerInterface @@ -127,44 +185,32 @@ func (*LocalAIServer) CreateTranslation(w http.ResponseWriter, r *http.Request) // DeleteFile implements ServerInterface func (*LocalAIServer) DeleteFile(w http.ResponseWriter, r *http.Request, fileId string) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "DeleteFile")) - return + panic("unimplemented") } // DeleteModel implements ServerInterface func (*LocalAIServer) DeleteModel(w http.ResponseWriter, r *http.Request, model string) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "DeleteModel")) - return + panic("unimplemented") } // DownloadFile implements ServerInterface func (*LocalAIServer) DownloadFile(w http.ResponseWriter, r *http.Request, fileId string) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "DownloadFile")) - return -} - -// ListEngines implements ServerInterface -func (*LocalAIServer) ListEngines(w http.ResponseWriter, r *http.Request) { - sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "List Engines")) - return + panic("unimplemented") } // ListFiles implements ServerInterface func (*LocalAIServer) ListFiles(w http.ResponseWriter, r *http.Request) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "ListFiles")) - return + panic("unimplemented") } // ListFineTuneEvents implements ServerInterface func (*LocalAIServer) ListFineTuneEvents(w http.ResponseWriter, r *http.Request, fineTuneId string, params ListFineTuneEventsParams) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "List Fine Tune Events")) - return + panic("unimplemented") } // ListFineTunes implements ServerInterface func (*LocalAIServer) ListFineTunes(w http.ResponseWriter, r *http.Request) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "List Fine Tunes")) - return + panic("unimplemented") } // ListModels implements ServerInterface @@ -172,25 +218,19 @@ func (*LocalAIServer) ListModels(w http.ResponseWriter, r *http.Request) { panic("unimplemented") } -// RetrieveEngine implements ServerInterface -func (*LocalAIServer) RetrieveEngine(w http.ResponseWriter, r *http.Request, engineId string) { - sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "RetrieveEngine")) - return -} - // RetrieveFile implements ServerInterface func (*LocalAIServer) RetrieveFile(w http.ResponseWriter, r *http.Request, fileId string) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "RetrieveFile")) - return + panic("unimplemented") } // RetrieveFineTune implements ServerInterface func (*LocalAIServer) RetrieveFineTune(w http.ResponseWriter, r *http.Request, fineTuneId string) { - sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "Retrieve Fine Tune")) - return + panic("unimplemented") } // RetrieveModel implements ServerInterface func (*LocalAIServer) RetrieveModel(w http.ResponseWriter, r *http.Request, model string) { panic("unimplemented") } + +var _ ServerInterface = (*LocalAIServer)(nil) diff --git a/apiv2/localai.go.old b/apiv2/localai.go.old new file mode 100644 index 00000000..7a76288f --- /dev/null +++ b/apiv2/localai.go.old @@ -0,0 +1,196 @@ +package apiv2 + +import ( + "encoding/json" + "fmt" + "net/http" +) + +type LocalAIServer struct { + configMerger *ConfigMerger +} + +var _ ServerInterface = (*LocalAIServer)(nil) + +type Error struct { + Code int `json:"code"` + Message string `json:"message"` +} + +func sendError(w http.ResponseWriter, code int, message string) { + localAiError := Error{ + Code: code, + Message: message, + } + w.WriteHeader(code) + json.NewEncoder(w).Encode(localAiError) +} + +// It won't work, but it's worth a try. +const nyiErrorMessageFormatString = "%s is not yet implemented by LocalAI\nThere is no need to contact support about this error and retrying will not help.\nExpect an update at https://github.com/go-skynet/LocalAI if this changes!" + +// Do we want or need an additional "wontfix" template that is even stronger than this? +const nyiDepreciatedErrorMessageFormatString = "%s is a depreciated portion of the OpenAI API, and is not yet implemented by LocalAI\nThere is no need to contact support about this error and retrying will not help." + +// CancelFineTune implements ServerInterface +func (*LocalAIServer) CancelFineTune(w http.ResponseWriter, r *http.Request, fineTuneId string) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "Fine Tune")) + return +} + +// CreateAnswer implements ServerInterface +func (*LocalAIServer) CreateAnswer(w http.ResponseWriter, r *http.Request) { + sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "CreateAnswer")) + return +} + +// CreateChatCompletion implements ServerInterface +func (*LocalAIServer) CreateChatCompletion(w http.ResponseWriter, r *http.Request) { + var chatRequest CreateChatCompletionRequest + if err := json.NewDecoder(r.Body).Decode(&chatRequest); err != nil { + sendError(w, http.StatusBadRequest, "Invalid CreateChatCompletionRequest") + return + } + configMerger.GetConfig(chatRequest.Model) +} + +// CreateClassification implements ServerInterface +func (*LocalAIServer) CreateClassification(w http.ResponseWriter, r *http.Request) { + sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "CreateClassification")) + return +} + +// CreateCompletion implements ServerInterface +func (*LocalAIServer) CreateCompletion(w http.ResponseWriter, r *http.Request) { + panic("unimplemented") +} + +// CreateEdit implements ServerInterface +func (*LocalAIServer) CreateEdit(w http.ResponseWriter, r *http.Request) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "CreateEdit")) + return +} + +// CreateEmbedding implements ServerInterface +func (*LocalAIServer) CreateEmbedding(w http.ResponseWriter, r *http.Request) { + panic("unimplemented") +} + +// CreateFile implements ServerInterface +func (*LocalAIServer) CreateFile(w http.ResponseWriter, r *http.Request) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "Create File")) + return +} + +// CreateFineTune implements ServerInterface +func (*LocalAIServer) CreateFineTune(w http.ResponseWriter, r *http.Request) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "Create Fine Tune")) + return +} + +// CreateImage implements ServerInterface +func (*LocalAIServer) CreateImage(w http.ResponseWriter, r *http.Request) { + panic("unimplemented") +} + +// CreateImageEdit implements ServerInterface +func (*LocalAIServer) CreateImageEdit(w http.ResponseWriter, r *http.Request) { + panic("unimplemented") +} + +// CreateImageVariation implements ServerInterface +func (*LocalAIServer) CreateImageVariation(w http.ResponseWriter, r *http.Request) { + panic("unimplemented") +} + +// CreateModeration implements ServerInterface +func (*LocalAIServer) CreateModeration(w http.ResponseWriter, r *http.Request) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "CreateModeration")) + return +} + +// CreateSearch implements ServerInterface +func (*LocalAIServer) CreateSearch(w http.ResponseWriter, r *http.Request, engineId string) { + sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "CreateSearch")) + return +} + +// CreateTranscription implements ServerInterface +func (*LocalAIServer) CreateTranscription(w http.ResponseWriter, r *http.Request) { + panic("unimplemented") +} + +// CreateTranslation implements ServerInterface +func (*LocalAIServer) CreateTranslation(w http.ResponseWriter, r *http.Request) { + panic("unimplemented") +} + +// DeleteFile implements ServerInterface +func (*LocalAIServer) DeleteFile(w http.ResponseWriter, r *http.Request, fileId string) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "DeleteFile")) + return +} + +// DeleteModel implements ServerInterface +func (*LocalAIServer) DeleteModel(w http.ResponseWriter, r *http.Request, model string) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "DeleteModel")) + return +} + +// DownloadFile implements ServerInterface +func (*LocalAIServer) DownloadFile(w http.ResponseWriter, r *http.Request, fileId string) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "DownloadFile")) + return +} + +// ListEngines implements ServerInterface +func (*LocalAIServer) ListEngines(w http.ResponseWriter, r *http.Request) { + sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "List Engines")) + return +} + +// ListFiles implements ServerInterface +func (*LocalAIServer) ListFiles(w http.ResponseWriter, r *http.Request) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "ListFiles")) + return +} + +// ListFineTuneEvents implements ServerInterface +func (*LocalAIServer) ListFineTuneEvents(w http.ResponseWriter, r *http.Request, fineTuneId string, params ListFineTuneEventsParams) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "List Fine Tune Events")) + return +} + +// ListFineTunes implements ServerInterface +func (*LocalAIServer) ListFineTunes(w http.ResponseWriter, r *http.Request) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "List Fine Tunes")) + return +} + +// ListModels implements ServerInterface +func (*LocalAIServer) ListModels(w http.ResponseWriter, r *http.Request) { + panic("unimplemented") +} + +// RetrieveEngine implements ServerInterface +func (*LocalAIServer) RetrieveEngine(w http.ResponseWriter, r *http.Request, engineId string) { + sendError(w, 501, fmt.Sprintf(nyiDepreciatedErrorMessageFormatString, "RetrieveEngine")) + return +} + +// RetrieveFile implements ServerInterface +func (*LocalAIServer) RetrieveFile(w http.ResponseWriter, r *http.Request, fileId string) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "RetrieveFile")) + return +} + +// RetrieveFineTune implements ServerInterface +func (*LocalAIServer) RetrieveFineTune(w http.ResponseWriter, r *http.Request, fineTuneId string) { + sendError(w, 501, fmt.Sprintf(nyiErrorMessageFormatString, "Retrieve Fine Tune")) + return +} + +// RetrieveModel implements ServerInterface +func (*LocalAIServer) RetrieveModel(w http.ResponseWriter, r *http.Request, model string) { + panic("unimplemented") +} diff --git a/apiv2/localai_nethttp.go b/apiv2/localai_nethttp.go new file mode 100644 index 00000000..ab1527b9 --- /dev/null +++ b/apiv2/localai_nethttp.go @@ -0,0 +1,14 @@ +package apiv2 + +import "net/http" + +func NewLocalAINetHTTPServer(configManager *ConfigManager) *LocalAIServer { + localAI := LocalAIServer{ + configManager: configManager, + } + + http.Handle("/", Handler(&localAI)) + + http.ListenAndServe(":8085", nil) + return &localAI +} diff --git a/build_tools.go b/build_tools.go index ad5534aa..f46f812c 100644 --- a/build_tools.go +++ b/build_tools.go @@ -1,3 +1,4 @@ +//go:build tools // +build tools // List of tool dependencies. It should not actually be compiled. @@ -5,5 +6,5 @@ package ignore_me_build_tools import ( _ "github.com/deepmap/oapi-codegen/cmd/oapi-codegen" - __ "github.com/vmware-tanzu/carvel-ytt/cmd/ytt" + _ "github.com/vmware-tanzu/carvel-ytt/cmd/ytt" ) diff --git a/config/gpt-3.5-turbo-chat.yaml b/config/gpt-3.5-turbo-chat.yaml new file mode 100644 index 00000000..ee71495d --- /dev/null +++ b/config/gpt-3.5-turbo-chat.yaml @@ -0,0 +1,11 @@ +registration: + model: gpt-3.5-turbo + endpoint: CreateChatCompletion +local_paths: + model: ggml-gpt4all-j + template: chat-gpt4all +request_defaults: + top_p: 0.7 + temperature: 0.2 + x-localai-extensions: + top_k: 80 \ No newline at end of file diff --git a/go.mod b/go.mod index 749a2f3f..1eaed2e4 100644 --- a/go.mod +++ b/go.mod @@ -3,26 +3,28 @@ module github.com/go-skynet/LocalAI go 1.19 require ( - github.com/deepmap/oapi-codegen v0.0.0-00010101000000-000000000000 - github.com/donomii/go-rwkv.cpp v0.0.0-20230515123100-6fdd0c338e56 - github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230520182345-041be06d5881 + github.com/deepmap/oapi-codegen v1.12.4 + github.com/donomii/go-rwkv.cpp v0.0.0-20230529074347-ccb05c3e1c6e + github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230528233858-d7c936b44a80 github.com/go-audio/wav v1.1.0 - github.com/go-skynet/bloomz.cpp v0.0.0-20230510223001-e9366e82abdf - github.com/go-skynet/go-bert.cpp v0.0.0-20230516063724-cea1ed76a7f4 - github.com/go-skynet/go-gpt2.cpp v0.0.0-20230512145559-7bff56f02245 - github.com/go-skynet/go-llama.cpp v0.0.0-20230520155239-ccf23adfb278 + github.com/go-chi/chi/v5 v5.0.8 + github.com/go-skynet/bloomz.cpp v0.0.0-20230529155654-1834e77b83fa + github.com/go-skynet/go-bert.cpp v0.0.0-20230529074307-771b4a085972 + github.com/go-skynet/go-gpt2.cpp v0.0.0-20230529215936-13ccc22621bb + github.com/go-skynet/go-llama.cpp v0.0.0-20230529221033-4afcaf28f36f github.com/gofiber/fiber/v2 v2.46.0 github.com/google/uuid v1.3.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/imdario/mergo v0.3.15 + github.com/imdario/mergo v0.3.16 + github.com/mitchellh/mapstructure v1.5.0 github.com/mudler/go-stable-diffusion v0.0.0-20230516152536-c0748eca3642 - github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20230519014017-914519e772fd + github.com/nomic-ai/gpt4all/gpt4all-bindings/golang v0.0.0-20230530152634-6ed9c1a8d8e4 github.com/onsi/ginkgo/v2 v2.9.5 github.com/onsi/gomega v1.27.7 github.com/otiai10/openaigo v1.1.0 github.com/rs/zerolog v1.29.1 github.com/sashabaranov/go-openai v1.9.4 - github.com/urfave/cli/v2 v2.25.3 + github.com/urfave/cli/v2 v2.25.5 github.com/valyala/fasthttp v1.47.0 github.com/vmware-tanzu/carvel-ytt v0.45.1 gopkg.in/yaml.v2 v2.4.0 @@ -30,54 +32,74 @@ require ( ) require ( - github.com/BurntSushi/toml v1.2.1 // indirect + github.com/BurntSushi/toml v1.3.0 // indirect github.com/andybalholm/brotli v1.0.5 // indirect - github.com/cppforlife/cobrautil v0.0.0-20200514214827-bb86e6965d72 // indirect - github.com/cppforlife/go-cli-ui v0.0.0-20200505234325-512793797f05 // indirect + github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect + github.com/bytedance/sonic v1.9.1 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect + github.com/cppforlife/cobrautil v0.0.0-20221130162803-acdfead391ef // indirect + github.com/cppforlife/go-cli-ui v0.0.0-20220622150351-995494831c6c // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect - github.com/getkin/kin-openapi v0.116.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.2 // indirect + github.com/getkin/kin-openapi v0.117.0 // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/gin-gonic/gin v1.9.0 // indirect github.com/go-audio/audio v1.0.0 // indirect github.com/go-audio/riff v1.0.0 // indirect github.com/go-logr/logr v1.2.4 // indirect - github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/swag v0.21.1 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.14.0 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect + github.com/goccy/go-json v0.10.2 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect - github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect - github.com/invopop/yaml v0.1.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/invopop/yaml v0.2.0 // indirect github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/k14s/starlark-go v0.0.0-20200720175618-3a5c849cc368 // indirect - github.com/klauspost/compress v1.16.3 // indirect + github.com/klauspost/compress v1.16.5 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/labstack/echo/v4 v4.10.2 // indirect github.com/labstack/gommon v0.4.0 // indirect + github.com/leodido/go-urn v1.2.4 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.18 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/otiai10/mint v1.5.1 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/perimeterx/marshmallow v1.1.4 // indirect github.com/philhofer/fwd v1.1.2 // indirect - github.com/rivo/uniseg v0.2.0 // indirect + github.com/rivo/uniseg v0.4.4 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94 // indirect github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee // indirect - github.com/spf13/cobra v1.6.1 // indirect + github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/tinylib/msgp v1.1.8 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.11 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect github.com/valyala/tcplisten v1.0.0 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - golang.org/x/crypto v0.7.0 // indirect + golang.org/x/arch v0.3.0 // indirect + golang.org/x/crypto v0.9.0 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect golang.org/x/tools v0.9.1 // indirect + google.golang.org/protobuf v1.30.0 // indirect ) replace github.com/go-skynet/go-llama.cpp => /workspace/go-llama @@ -96,8 +118,4 @@ replace github.com/go-skynet/bloomz.cpp => /workspace/bloomz replace github.com/mudler/go-stable-diffusion => /workspace/go-stable-diffusion -// replace github.com/deepmap/oapi-codegen v1.12.4 => github.com/dave-gray101/oapi-codegen v0.0.0 - -replace github.com/deepmap/oapi-codegen => github.com/dave-gray101/oapi-codegen v0.0.0-20230523054811-7942876e1d78 - -// replace github.com/deepmap/oapi-codegen/cmd/oapi-codegen => github.com/dave-gray101/oapi-codegen/cmd/oapi-codegen yaml_and_dep_filter +replace github.com/deepmap/oapi-codegen v1.12.4 => github.com/dave-gray101/oapi-codegen v0.0.0-20230601032358-055c3446c85e diff --git a/go.sum b/go.sum index 47f67193..e9ce1795 100644 --- a/go.sum +++ b/go.sum @@ -1,104 +1,120 @@ -github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= -github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.3.0 h1:Ws8e5YmnrGEHzZEzg0YvK/7COGYtTC5PbaH9oSSbgfA= +github.com/BurntSushi/toml v1.3.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= -github.com/bytedance/sonic v1.8.0 h1:ea0Xadu+sHlu7x5O3gKhRpQ1IKiMrSiHttPF0ybECuA= +github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= +github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= +github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= +github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= +github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= +github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= +github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cppforlife/cobrautil v0.0.0-20200514214827-bb86e6965d72 h1:rPWcUBgMb1ox2eCohCuZ8gsZVe0aB5qBbYaBpdoxfCE= -github.com/cppforlife/cobrautil v0.0.0-20200514214827-bb86e6965d72/go.mod h1:2w+qxVu2KSGW78Ex/XaIqfh/OvBgjEsmN53S4T8vEyA= -github.com/cppforlife/go-cli-ui v0.0.0-20200505234325-512793797f05 h1:1RmVo83wBQdTTbuO1BEE4erTyE0CvfYAn56qb0TyAPc= -github.com/cppforlife/go-cli-ui v0.0.0-20200505234325-512793797f05/go.mod h1:I0qrzCmuPWYI6kAOvkllYjaW2aovclWbJ96+v+YyHb0= +github.com/cppforlife/cobrautil v0.0.0-20221130162803-acdfead391ef h1:de10GNLe45JTMghl2qf9WH17H/BjGShK41X3vKAsPJA= +github.com/cppforlife/cobrautil v0.0.0-20221130162803-acdfead391ef/go.mod h1:2w+qxVu2KSGW78Ex/XaIqfh/OvBgjEsmN53S4T8vEyA= +github.com/cppforlife/go-cli-ui v0.0.0-20220622150351-995494831c6c h1:Au0iPWQ6E8TMil9HiGW/DI4CBttUpBOZWkzgqwq+PLg= +github.com/cppforlife/go-cli-ui v0.0.0-20220622150351-995494831c6c/go.mod h1:ci7nWkU0g40w486NlpUpXXpTD3pkOBjH090Uc0wpER4= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/dave-gray101/oapi-codegen v0.0.0-20230523054811-7942876e1d78 h1:FP1s4BtFR9RHWxZHif2Kva/ydXV5jtyovyo0rrqdvgU= -github.com/dave-gray101/oapi-codegen v0.0.0-20230523054811-7942876e1d78/go.mod h1:rey/E8Zmlg0o3jo02vrDZMSv6YeWY/I8j3FTeR+78EU= +github.com/dave-gray101/oapi-codegen v0.0.0-20230601032358-055c3446c85e h1:yTYuNvvxVelDSrUDt9b96CRL0Iyo7IjgjnkbjzBymi4= +github.com/dave-gray101/oapi-codegen v0.0.0-20230601032358-055c3446c85e/go.mod h1:rey/E8Zmlg0o3jo02vrDZMSv6YeWY/I8j3FTeR+78EU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/getkin/kin-openapi v0.116.0 h1:o986hwgMzR972JzOG5j6+WTwWqllZLs1EJKMKCivs2E= -github.com/getkin/kin-openapi v0.116.0/go.mod h1:l5e9PaFUo9fyLJCPGQeXI2ML8c3P8BHOEV2VaAVf/pc= -github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230520182345-041be06d5881 h1:dafqVivljYk51VLFnnpTXJnfWDe637EobWZ1l8PyEf8= -github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230520182345-041be06d5881/go.mod h1:QIjZ9OktHFG7p+/m3sMvrAJKKdWrr1fZIK0rM6HZlyo= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= +github.com/getkin/kin-openapi v0.117.0 h1:QT2DyGujAL09F4NrKDHJGsUoIprlIcFVHWDVDcUFE8A= +github.com/getkin/kin-openapi v0.117.0/go.mod h1:l5e9PaFUo9fyLJCPGQeXI2ML8c3P8BHOEV2VaAVf/pc= +github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230528233858-d7c936b44a80 h1:IeeVcNaQHdcG+GPg+meOPFvtonvO8p/HBzTrZGjpWZk= +github.com/ggerganov/whisper.cpp/bindings/go v0.0.0-20230528233858-d7c936b44a80/go.mod h1:QIjZ9OktHFG7p+/m3sMvrAJKKdWrr1fZIK0rM6HZlyo= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= +github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k= github.com/go-audio/audio v1.0.0 h1:zS9vebldgbQqktK4H0lUqWrG8P0NxCJVqcj7ZpNnwd4= github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs= github.com/go-audio/riff v1.0.0 h1:d8iCGbDvox9BfLagY94fBynxSPHO80LmZCaOsmKxokA= github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498= github.com/go-audio/wav v1.1.0 h1:jQgLtbqBzY7G+BM8fXF7AHUk1uHUviWS4X39d5rsL2g= github.com/go-audio/wav v1.1.0/go.mod h1:mpe9qfwbScEbkd8uybLuIpTgHyrISw/OTuvjUW2iGtE= +github.com/go-chi/chi/v5 v5.0.8 h1:lD+NLqFcAi1ovnVZpsnObHGW4xb4J8lNmoYVfECH1Y0= +github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU= -github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= -github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= +github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= -github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofiber/fiber/v2 v2.46.0 h1:wkkWotblsGVlLjXj2dpgKQAYHtXumsK/HyFugQM68Ns= github.com/gofiber/fiber/v2 v2.46.0/go.mod h1:DNl0/c37WLe0g92U6lx1VMQuxGUQY5V7EIaVoEsUffc= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219 h1:utua3L2IbQJmauC5IXdEA547bcoU5dozgQAfc8Onsg4= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hpcloud/tail v1.0.1-0.20180514194441-a1dbeea552b7/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= -github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/invopop/yaml v0.1.0 h1:YW3WGUoJEXYfzWBjn00zIlrw7brGVD0fUKRYDPAPhrc= +github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/invopop/yaml v0.1.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= +github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= +github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= github.com/k14s/difflib v0.0.0-20201117154628-0c031775bf57 h1:CwBRArr+BWBopnUJhDjJw86rPL/jGbEjfHWKzTasSqE= github.com/k14s/starlark-go v0.0.0-20200720175618-3a5c849cc368 h1:4bcRTTSx+LKSxMWibIwzHnDNmaN1x52oEpvnjCy+8vk= github.com/k14s/starlark-go v0.0.0-20200720175618-3a5c849cc368/go.mod h1:lKGj1op99m4GtQISxoD2t+K+WO/q2NzEPKvfXFQfbCA= -github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= -github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= +github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= +github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= @@ -106,41 +122,41 @@ github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k= github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= -github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k= -github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= github.com/onsi/gomega v1.27.7/go.mod h1:1p8OOlwo2iUUDsHnOrjE5UKYJ+e3W8eQ3qSlRahPmr4= github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM= github.com/otiai10/openaigo v1.1.0 h1:zRvGBqZUW5PCMgdkJNsPVTBd8tOLCMTipXE5wD2pdTg= github.com/otiai10/openaigo v1.1.0/go.mod h1:792bx6AWTS61weDi2EzKpHHnTF4eDMAlJ5GvAk/mgPg= -github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= +github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/perimeterx/marshmallow v1.1.4 h1:pZLDH9RjlLGGorbXhcaQLhfuV0pFMNfPO55FuFkxqLw= github.com/perimeterx/marshmallow v1.1.4/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= @@ -149,8 +165,9 @@ github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2 github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis= +github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= @@ -163,10 +180,11 @@ github.com/savsgio/dictpool v0.0.0-20221023140959-7bf2e61cea94/go.mod h1:90zrgN3 github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4= github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee h1:8Iv5m6xEo1NR1AvpV+7XmhI4r39LGNzwUL4YpMuL5vk= github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee/go.mod h1:qwtSXrKuJh/zsFQ12yEE89xfCrGKK63Rr7ctU/uCo4g= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -176,17 +194,20 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw= github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0= github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= -github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU= -github.com/urfave/cli/v2 v2.25.3 h1:VJkt6wvEBOoSjPFQvOkv6iWIrsJyCrKGtCtxXWwmGeY= -github.com/urfave/cli/v2 v2.25.3/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/urfave/cli/v2 v2.25.5 h1:d0NIAyhh5shGscroL7ek/Ya9QYQE0KNabJgiUinIQkc= +github.com/urfave/cli/v2 v2.25.5/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.47.0 h1:y7moDoxYzMooFpT5aHgNgVOQDrS3qlkfiP9mDtGGK9c= @@ -196,27 +217,26 @@ github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQ github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= -github.com/vito/go-interact v0.0.0-20171111012221-fa338ed9e9ec/go.mod h1:wPlfmglZmRWMYv/qJy3P+fK/UnoQB5ISk4txfNd9tDo= github.com/vmware-tanzu/carvel-ytt v0.45.1 h1:zjiOnV7WiKJbkLHkJCRxlmABOMIL4WhKKyahfCzFoIk= github.com/vmware-tanzu/carvel-ytt v0.45.1/go.mod h1:+r+ZVZLsETAYlRsgINztFdUdUufj2OwrTXCfOzYB4fY= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= -golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= +golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180730214132-a0f8a16cb08c/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -232,7 +252,6 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -241,6 +260,7 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -267,26 +287,19 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify/fsnotify.v1 v1.4.7/go.mod h1:Fyux9zXlo4rWoMSIzpn9fDAYjalPqJ/K1qJ27s+7ltE= -gopkg.in/tomb.v1 v1.0.0-20140529071818-c131134a1947/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/main.go b/main.go index f3ffc033..3483d175 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "path/filepath" api "github.com/go-skynet/LocalAI/api" + apiv2 "github.com/go-skynet/LocalAI/apiv2" model "github.com/go-skynet/LocalAI/pkg/model" "github.com/rs/zerolog" "github.com/rs/zerolog/log" @@ -22,6 +23,31 @@ func main() { os.Exit(1) } + log.Log().Msgf("STARTING!") + + // TODO REALLY SHIT TEST MUST BE FIXED BEFORE MERGE + v2ConfigManager := apiv2.NewConfigManager() + log.Log().Msgf("v2ConfigManager init %+v", v2ConfigManager) + registered, cfgErr := v2ConfigManager.LoadConfigDirectory("/workspace/config") + + fmt.Printf("!=!") + + log.Log().Msgf("NEW v2 test cfgErr: %w \nREGISTRATIONS:", cfgErr) + + for i, reg := range registered { + log.Log().Msgf("%d: %+v", i, reg) + + testField, exists := v2ConfigManager.GetConfig(reg) + if exists { + log.Log().Msgf("!! %s: %s", testField.GetRegistration().Endpoint, testField.GetLocalPaths().Model) + } + + } + + v2Server := apiv2.NewLocalAINetHTTPServer(v2ConfigManager) + + log.Log().Msgf("NEW v2 test: %+v", v2Server) + app := &cli.App{ Name: "LocalAI", Usage: "OpenAI compatible API for running LLaMA/GPT models locally on CPU with consumer grade hardware.", @@ -94,7 +120,7 @@ It uses llama.cpp, ggml and gpt4all as backend with golang c bindings. Copyright: "go-skynet authors", Action: func(ctx *cli.Context) error { fmt.Printf("Starting LocalAI using %d threads, with models path: %s\n", ctx.Int("threads"), ctx.String("models-path")) - return api.App(context.Background(), ctx.String("config-file"), model.NewModelLoader(ctx.String("models-path")), ctx.Int("upload-limit"), ctx.Int("threads"), ctx.Int("context-size"), ctx.Bool("f16"), ctx.Bool("debug"), false, ctx.String("image-path")).Listen(ctx.String("address")) + return api.App(context.Background(), ctx.String("config-file"), model.NewModelLoader(ctx.String("models-path"), ctx.String("templates-path")), ctx.Int("upload-limit"), ctx.Int("threads"), ctx.Int("context-size"), ctx.Bool("f16"), ctx.Bool("debug"), false, ctx.String("image-path")).Listen(ctx.String("address")) }, } diff --git a/openai-openapi/config.yaml b/openai-openapi/config.yaml index 94196762..7f61899e 100644 --- a/openai-openapi/config.yaml +++ b/openai-openapi/config.yaml @@ -5,7 +5,11 @@ generate: output: apiv2/localai.gen.go output-options: exclude-depreciated: true -# user-templates: + additional-property-tags: + - yaml + - mapstructure + user-templates: + endpoint-body-mapping.tmpl: ./openai-openapi/endpoint-body-mapping.tmpl # union.tmpl: "// SKIP" # union-and-additional-properties.tmpl: "// SKIP" # additional-properties.tmpl: "// SKIP" \ No newline at end of file diff --git a/openai-openapi/endpoint-body-mapping.tmpl b/openai-openapi/endpoint-body-mapping.tmpl new file mode 100644 index 00000000..0b656add --- /dev/null +++ b/openai-openapi/endpoint-body-mapping.tmpl @@ -0,0 +1,19 @@ +// TEMP: Consider revising this in oapi-codegen to make cleaner or at least renaming.... +//type EndpointSpecificConfig interface { +// GetRequestDefaults() interface{} +//} +var EndpointConfigMap = map[string]Config{ +{{range .}}{{$opid := .OperationId -}} + {{if eq (len .Bodies) 1 -}} + {{with index .Bodies 0}}{{ $typeDef := .TypeDef $opid -}} + "{{$opid}}":SpecificConfig[{{$typeDef.TypeName}}]{}, + {{end -}} + {{else -}} + {{range .Bodies -}} + {{if and .IsSupported .Default -}} + "{{$opid}}":SpecificConfig[{{.TypeName}}]{},{{break -}} + {{end -}} + {{end -}} + {{end -}} +{{end -}} +} \ No newline at end of file diff --git a/pkg/model/loader.go b/pkg/model/loader.go index ddc7b6eb..1c7cb46b 100644 --- a/pkg/model/loader.go +++ b/pkg/model/loader.go @@ -1,139 +1,141 @@ -package model - -import ( - "bytes" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "sync" - "text/template" - - "github.com/rs/zerolog/log" -) - -type ModelLoader struct { - ModelPath string - mu sync.Mutex - // TODO: this needs generics - models map[string]interface{} - promptsTemplates map[string]*template.Template -} - -func NewModelLoader(modelPath string) *ModelLoader { - return &ModelLoader{ - ModelPath: modelPath, - models: make(map[string]interface{}), - promptsTemplates: make(map[string]*template.Template), - } -} - -func (ml *ModelLoader) ExistsInModelPath(s string) bool { - _, err := os.Stat(filepath.Join(ml.ModelPath, s)) - return err == nil -} - -func (ml *ModelLoader) ListModels() ([]string, error) { - files, err := ioutil.ReadDir(ml.ModelPath) - if err != nil { - return []string{}, err - } - - models := []string{} - for _, file := range files { - // Skip templates, YAML and .keep files - if strings.HasSuffix(file.Name(), ".tmpl") || strings.HasSuffix(file.Name(), ".keep") || strings.HasSuffix(file.Name(), ".yaml") || strings.HasSuffix(file.Name(), ".yml") { - continue - } - - models = append(models, file.Name()) - } - - return models, nil -} - -func (ml *ModelLoader) TemplatePrefix(modelName string, in interface{}) (string, error) { - ml.mu.Lock() - defer ml.mu.Unlock() - - m, ok := ml.promptsTemplates[modelName] - if !ok { - modelFile := filepath.Join(ml.ModelPath, modelName) - if err := ml.loadTemplateIfExists(modelName, modelFile); err != nil { - return "", err - } - - t, exists := ml.promptsTemplates[modelName] - if exists { - m = t - } - } - if m == nil { - return "", fmt.Errorf("failed loading any template") - } - - var buf bytes.Buffer - - if err := m.Execute(&buf, in); err != nil { - return "", err - } - return buf.String(), nil -} - -func (ml *ModelLoader) loadTemplateIfExists(modelName, modelFile string) error { - // Check if the template was already loaded - if _, ok := ml.promptsTemplates[modelName]; ok { - return nil - } - - // Check if the model path exists - // skip any error here - we run anyway if a template does not exist - modelTemplateFile := fmt.Sprintf("%s.tmpl", modelName) - - if !ml.ExistsInModelPath(modelTemplateFile) { - return nil - } - - dat, err := os.ReadFile(filepath.Join(ml.ModelPath, modelTemplateFile)) - if err != nil { - return err - } - - // Parse the template - tmpl, err := template.New("prompt").Parse(string(dat)) - if err != nil { - return err - } - ml.promptsTemplates[modelName] = tmpl - - return nil -} - -func (ml *ModelLoader) LoadModel(modelName string, loader func(string) (interface{}, error)) (interface{}, error) { - ml.mu.Lock() - defer ml.mu.Unlock() - - // Check if we already have a loaded model - if m, ok := ml.models[modelName]; ok { - log.Debug().Msgf("Model already loaded in memory: %s", modelName) - return m, nil - } - - // Load the model and keep it in memory for later use - modelFile := filepath.Join(ml.ModelPath, modelName) - log.Debug().Msgf("Loading model in memory from file: %s", modelFile) - - model, err := loader(modelFile) - if err != nil { - return nil, err - } - - // If there is a prompt template, load it - if err := ml.loadTemplateIfExists(modelName, modelFile); err != nil { - return nil, err - } - - ml.models[modelName] = model - return model, nil -} +package model + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + "sync" + "text/template" + + "github.com/rs/zerolog/log" +) + +type ModelLoader struct { + ModelPath string + TemplatesPath string + mu sync.Mutex + // TODO: this needs generics + models map[string]interface{} + promptsTemplates map[string]*template.Template +} + +func NewModelLoader(modelPath string, templatesPath string) *ModelLoader { + return &ModelLoader{ + ModelPath: modelPath, + TemplatesPath: templatesPath, + models: make(map[string]interface{}), + promptsTemplates: make(map[string]*template.Template), + } +} + +func (ml *ModelLoader) ExistsInModelPath(s string) bool { + _, err := os.Stat(filepath.Join(ml.ModelPath, s)) + return err == nil +} + +func (ml *ModelLoader) ListModels() ([]string, error) { + files, err := ioutil.ReadDir(ml.ModelPath) + if err != nil { + return []string{}, err + } + + models := []string{} + for _, file := range files { + // Skip templates, YAML and .keep files + if strings.HasSuffix(file.Name(), ".tmpl") || strings.HasSuffix(file.Name(), ".keep") || strings.HasSuffix(file.Name(), ".yaml") || strings.HasSuffix(file.Name(), ".yml") { + continue + } + + models = append(models, file.Name()) + } + + return models, nil +} + +func (ml *ModelLoader) TemplatePrefix(modelName string, in interface{}) (string, error) { + ml.mu.Lock() + defer ml.mu.Unlock() + + m, ok := ml.promptsTemplates[modelName] + if !ok { + modelFile := filepath.Join(ml.ModelPath, modelName) + if err := ml.loadTemplateIfExists(modelName, modelFile); err != nil { + return "", err + } + + t, exists := ml.promptsTemplates[modelName] + if exists { + m = t + } + } + if m == nil { + return "", fmt.Errorf("failed loading any template") + } + + var buf bytes.Buffer + + if err := m.Execute(&buf, in); err != nil { + return "", err + } + return buf.String(), nil +} + +func (ml *ModelLoader) loadTemplateIfExists(modelName, modelFile string) error { + // Check if the template was already loaded + if _, ok := ml.promptsTemplates[modelName]; ok { + return nil + } + + // Check if the model path exists + // skip any error here - we run anyway if a template does not exist + modelTemplateFile := fmt.Sprintf("%s.tmpl", modelName) + + if !ml.ExistsInModelPath(modelTemplateFile) { + return nil + } + + dat, err := os.ReadFile(filepath.Join(ml.ModelPath, modelTemplateFile)) + if err != nil { + return err + } + + // Parse the template + tmpl, err := template.New("prompt").Parse(string(dat)) + if err != nil { + return err + } + ml.promptsTemplates[modelName] = tmpl + + return nil +} + +func (ml *ModelLoader) LoadModel(modelName string, loader func(string) (interface{}, error)) (interface{}, error) { + ml.mu.Lock() + defer ml.mu.Unlock() + + // Check if we already have a loaded model + if m, ok := ml.models[modelName]; ok { + log.Debug().Msgf("Model already loaded in memory: %s", modelName) + return m, nil + } + + // Load the model and keep it in memory for later use + modelFile := filepath.Join(ml.ModelPath, modelName) + log.Debug().Msgf("Loading model in memory from file: %s", modelFile) + + model, err := loader(modelFile) + if err != nil { + return nil, err + } + + // If there is a prompt template, load it + if err := ml.loadTemplateIfExists(modelName, modelFile); err != nil { + return nil, err + } + + ml.models[modelName] = model + return model, nil +}