Remove prompt version selectors
This commit is contained in:
@@ -14,14 +14,10 @@ type resolvedPromptDefinition struct {
|
||||
}
|
||||
|
||||
type promptInspectionRepository interface {
|
||||
GetPromptInspection(context.Context, string, string) (*domain.PromptInspection, error)
|
||||
GetPromptInspection(context.Context, string) (*domain.PromptInspection, error)
|
||||
}
|
||||
|
||||
func (r *Runner) resolvePromptDefinition(
|
||||
ctx context.Context,
|
||||
promptID string,
|
||||
promptVersion string,
|
||||
) (*resolvedPromptDefinition, error) {
|
||||
func (r *Runner) resolvePromptDefinition(ctx context.Context, promptID string) (*resolvedPromptDefinition, error) {
|
||||
if strings.TrimSpace(promptID) == "" {
|
||||
return nil, fmt.Errorf("%w: prompt id is required", ErrInvalidRequest)
|
||||
}
|
||||
@@ -33,11 +29,11 @@ func (r *Runner) resolvePromptDefinition(
|
||||
var hash string
|
||||
var err error
|
||||
if indexed, ok := r.promptDefs.(interface {
|
||||
GetPromptSnapshot(context.Context, string, string) (*domain.PromptDefinition, string, error)
|
||||
GetPromptSnapshot(context.Context, string) (*domain.PromptDefinition, string, error)
|
||||
}); ok {
|
||||
definition, hash, err = indexed.GetPromptSnapshot(ctx, promptID, promptVersion)
|
||||
definition, hash, err = indexed.GetPromptSnapshot(ctx, promptID)
|
||||
} else {
|
||||
definition, err = r.promptDefs.GetPromptDefinition(ctx, promptID, promptVersion)
|
||||
definition, err = r.promptDefs.GetPromptDefinition(ctx, promptID)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrPromptLoad, err)
|
||||
@@ -55,11 +51,7 @@ func (r *Runner) resolvePromptDefinition(
|
||||
return &resolvedPromptDefinition{definition: definition, hash: hash}, nil
|
||||
}
|
||||
|
||||
func (r *Runner) resolvePromptInspection(
|
||||
ctx context.Context,
|
||||
promptID string,
|
||||
promptVersion string,
|
||||
) (*domain.PromptInspection, error) {
|
||||
func (r *Runner) resolvePromptInspection(ctx context.Context, promptID string) (*domain.PromptInspection, error) {
|
||||
if strings.TrimSpace(promptID) == "" {
|
||||
return nil, fmt.Errorf("%w: prompt id is required", ErrInvalidRequest)
|
||||
}
|
||||
@@ -67,7 +59,7 @@ func (r *Runner) resolvePromptInspection(
|
||||
return nil, fmt.Errorf("%w: prompt repository is not configured", ErrPromptLoad)
|
||||
}
|
||||
if indexed, ok := r.promptDefs.(promptInspectionRepository); ok {
|
||||
inspection, err := indexed.GetPromptInspection(ctx, promptID, promptVersion)
|
||||
inspection, err := indexed.GetPromptInspection(ctx, promptID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrPromptLoad, err)
|
||||
}
|
||||
@@ -77,7 +69,7 @@ func (r *Runner) resolvePromptInspection(
|
||||
return inspection, nil
|
||||
}
|
||||
|
||||
selection, err := r.resolvePromptDefinition(ctx, promptID, promptVersion)
|
||||
selection, err := r.resolvePromptDefinition(ctx, promptID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -93,11 +85,7 @@ func (r *Runner) resolvePromptInspection(
|
||||
}
|
||||
|
||||
// InspectPrompt resolves one explicit prompt without execution work.
|
||||
func (r *Runner) InspectPrompt(
|
||||
ctx context.Context,
|
||||
promptID string,
|
||||
promptVersion string,
|
||||
) (*domain.PromptInspection, error) {
|
||||
func (r *Runner) InspectPrompt(ctx context.Context, promptID string) (*domain.PromptInspection, error) {
|
||||
if strings.TrimSpace(promptID) == "" {
|
||||
return nil, fmt.Errorf("%w: prompt id is required", ErrInvalidRequest)
|
||||
}
|
||||
@@ -107,5 +95,5 @@ func (r *Runner) InspectPrompt(
|
||||
default:
|
||||
}
|
||||
|
||||
return r.resolvePromptInspection(ctx, promptID, promptVersion)
|
||||
return r.resolvePromptInspection(ctx, promptID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user