Load native PromptKit settings through application configuration version six
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
PromptKit PromptKitConfig `json:"promptkit,omitempty"`
|
||||
Pipelines map[string]pipeline.PipelineProfile `json:"pipelines"`
|
||||
Concurrency ConcurrencyConfig `json:"concurrency"`
|
||||
Output OutputConfig `json:"output"`
|
||||
@@ -13,26 +12,13 @@ type Config struct {
|
||||
Debug DebugConfig `json:"debug"`
|
||||
}
|
||||
|
||||
type PromptKitConfig struct {
|
||||
ProfileDir string `json:"profile_dir,omitempty"`
|
||||
ProfileFile string `json:"profile_file,omitempty"`
|
||||
TransientRetries int `json:"transient_retries"`
|
||||
LocalBackend *PromptKitLocalBackendConfig `json:"local_backend,omitempty"`
|
||||
}
|
||||
|
||||
type PromptKitLocalBackendConfig struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
ConcurrencyLimit int `json:"concurrency_limit"`
|
||||
}
|
||||
|
||||
type ConcurrencyConfig struct {
|
||||
TotalLLM int `json:"total_llm"`
|
||||
StageWorkers map[string]int `json:"stage_workers"`
|
||||
}
|
||||
|
||||
const (
|
||||
defaultLLMConcurrency = 16
|
||||
defaultTransientRetries = 2
|
||||
defaultLLMConcurrency = 16
|
||||
)
|
||||
|
||||
type OutputConfig struct {
|
||||
@@ -59,7 +45,6 @@ type DebugConfig struct {
|
||||
|
||||
func Default() Config {
|
||||
return Config{
|
||||
PromptKit: PromptKitConfig{TransientRetries: defaultTransientRetries},
|
||||
Pipelines: map[string]pipeline.PipelineProfile{},
|
||||
Concurrency: ConcurrencyConfig{
|
||||
TotalLLM: defaultLLMConcurrency,
|
||||
@@ -73,10 +58,6 @@ func Default() Config {
|
||||
|
||||
func cloneConfig(in Config) Config {
|
||||
out := in
|
||||
if in.PromptKit.LocalBackend != nil {
|
||||
localBackend := *in.PromptKit.LocalBackend
|
||||
out.PromptKit.LocalBackend = &localBackend
|
||||
}
|
||||
out.Concurrency.StageWorkers = cloneIntMap(in.Concurrency.StageWorkers)
|
||||
out.Pipelines = make(map[string]pipeline.PipelineProfile, len(in.Pipelines))
|
||||
for key, profile := range in.Pipelines {
|
||||
|
||||
Reference in New Issue
Block a user