Add profile inheritance definition support
This commit is contained in:
@@ -2018,6 +2018,25 @@ func TestWithProfilesRejectsDuplicateIDs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithProfilesAcceptsDerivedDefinitionWithoutTargetFields(t *testing.T) {
|
||||
_, err := promptkit.NewEngine(promptkit.Config{PromptDir: frameworkPromptDir},
|
||||
promptkit.WithProfiles(promptkit.Profile{
|
||||
ID: " derived-profile ",
|
||||
BaseProfileID: " base-profile ",
|
||||
}),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("derived profile should be accepted during construction: %v", err)
|
||||
}
|
||||
|
||||
_, err = promptkit.NewEngine(promptkit.Config{PromptDir: frameworkPromptDir},
|
||||
promptkit.WithProfiles(promptkit.Profile{ID: "standalone-profile"}),
|
||||
)
|
||||
if !errors.Is(err, promptkit.ErrInvalidConfig) {
|
||||
t.Fatalf("standalone incomplete profile error = %v, want ErrInvalidConfig", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWithProfilesRejectsInvalidExecutionSettings(t *testing.T) {
|
||||
type testCase struct {
|
||||
name string
|
||||
@@ -2170,6 +2189,7 @@ func TestOpenAICompatibleProfileMapsEveryField(t *testing.T) {
|
||||
extraParams := map[string]any{"provider_option": "distinct-extra-params"}
|
||||
got := promptkit.OpenAICompatibleProfile(promptkit.OpenAICompatibleProfileConfig{
|
||||
ID: "distinct-id",
|
||||
BaseProfileID: "distinct-base",
|
||||
BackendID: "distinct-backend",
|
||||
Endpoint: "https://distinct.example/v1",
|
||||
Model: "distinct-model",
|
||||
@@ -2184,6 +2204,7 @@ func TestOpenAICompatibleProfileMapsEveryField(t *testing.T) {
|
||||
})
|
||||
want := promptkit.Profile{
|
||||
ID: "distinct-id",
|
||||
BaseProfileID: "distinct-base",
|
||||
BackendID: "distinct-backend",
|
||||
Endpoint: "https://distinct.example/v1",
|
||||
Model: "distinct-model",
|
||||
|
||||
Reference in New Issue
Block a user