Update offline examples for shared configuration
This commit is contained in:
@@ -30,6 +30,10 @@ type collectionSummary struct {
|
||||
ReleaseVersion *string `json:"release_version"`
|
||||
}
|
||||
|
||||
type applicationSettings struct {
|
||||
PromptKit promptkit.Settings `yaml:"promptkit"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
if err := run(context.Background(), "examples/go-library/prepare", os.Stdout); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
@@ -59,12 +63,18 @@ func run(ctx context.Context, exampleDir string, out io.Writer) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{
|
||||
definition := promptkit.Configure(configkit.Definition[applicationSettings]{}, func(value *applicationSettings) *promptkit.Settings { return &value.PromptKit })
|
||||
result, err := configkit.LoadLayered(configkit.Input{Source: configkit.NoSource()}, configkit.LayeredOptions[applicationSettings]{
|
||||
Definition: definition,
|
||||
Underlays: []configkit.Underlay{
|
||||
{Inputs: []configkit.Input{support, review}},
|
||||
{Inputs: []configkit.Input{override}},
|
||||
},
|
||||
}}, promptkit.WithBundledOpenRouter(false)) // Keep this example's inventory caller-owned.
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
engine, err := promptkit.NewFromConfig(result, promptkit.RuntimeConfig{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -78,7 +88,7 @@ func run(ctx context.Context, exampleDir string, out io.Writer) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, found := view.Explain(configkit.Keys("collections", "support", "profiles").Index(1).Key("timeout_seconds")); !found {
|
||||
if _, found := view.Explain(configkit.Keys("promptkit", "collections", "support", "profiles").Index(1).Key("timeout_seconds")); !found {
|
||||
return fmt.Errorf("collection profile override was not found")
|
||||
}
|
||||
requirements, err := scoped.InspectRequirements(ctx, promptkit.RequirementInspectionRequest{
|
||||
|
||||
Reference in New Issue
Block a user