Load native PromptKit settings through application configuration version six
This commit is contained in:
@@ -16,6 +16,15 @@ type LoadedConfig struct {
|
||||
result *configkit.Result[Document]
|
||||
}
|
||||
|
||||
// Result returns the original application-owned load for native library handoff.
|
||||
// Its typed values and resource contexts must not be reconstructed from rendered YAML.
|
||||
func (loaded *LoadedConfig) Result() *configkit.Result[Document] {
|
||||
if loaded == nil {
|
||||
return nil
|
||||
}
|
||||
return loaded.result
|
||||
}
|
||||
|
||||
// RuntimeConfig returns an independently owned runtime configuration.
|
||||
func (loaded *LoadedConfig) RuntimeConfig() Config {
|
||||
if loaded == nil {
|
||||
@@ -53,7 +62,7 @@ func loadConfig(path string, options LoadOptions) (*LoadedConfig, error) {
|
||||
return newLoadedConfig(result)
|
||||
}
|
||||
|
||||
// Load reads a version 5 configuration file into runtime configuration and a
|
||||
// Load reads a version 6 configuration file into runtime configuration and a
|
||||
// private inspection snapshot.
|
||||
func Load(path string, options LoadOptions) (*LoadedConfig, error) {
|
||||
return loadConfig(path, options)
|
||||
@@ -109,27 +118,6 @@ func documentToConfig(document Document) (Config, error) {
|
||||
config.Concurrency.TotalLLM = *document.Concurrency.TotalLLM
|
||||
}
|
||||
}
|
||||
if document.PromptKit != nil {
|
||||
if document.PromptKit.ProfileDir != nil {
|
||||
config.PromptKit.ProfileDir = *document.PromptKit.ProfileDir
|
||||
}
|
||||
if document.PromptKit.ProfileFile != nil {
|
||||
config.PromptKit.ProfileFile = *document.PromptKit.ProfileFile
|
||||
}
|
||||
if document.PromptKit.TransientRetries != nil {
|
||||
config.PromptKit.TransientRetries = *document.PromptKit.TransientRetries
|
||||
}
|
||||
if document.PromptKit.LocalBackend != nil {
|
||||
backend := PromptKitLocalBackendConfig{}
|
||||
if document.PromptKit.LocalBackend.Endpoint != nil {
|
||||
backend.Endpoint = *document.PromptKit.LocalBackend.Endpoint
|
||||
}
|
||||
if document.PromptKit.LocalBackend.ConcurrencyLimit != nil {
|
||||
backend.ConcurrencyLimit = *document.PromptKit.LocalBackend.ConcurrencyLimit
|
||||
}
|
||||
config.PromptKit.LocalBackend = &backend
|
||||
}
|
||||
}
|
||||
if document.Output != nil && document.Output.Directory != nil {
|
||||
config.Output.Directory = *document.Output.Directory
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user