2026-11-21 23:30:45 +00:00
|
|
|
package pipeline
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
|
|
|
|
"go.maximumdirect.net/promptkit"
|
|
|
|
|
)
|
|
|
|
|
|
2026-11-23 02:38:21 +00:00
|
|
|
// producerRequest applies native request overrides and preparation hooks to a value copy.
|
|
|
|
|
func producerRequest(request promptkit.RunRequest, options contracts.ExecutionOptions) promptkit.RunRequest {
|
2026-11-21 23:30:45 +00:00
|
|
|
if options.Execution != nil {
|
|
|
|
|
request.Execution = options.Execution
|
|
|
|
|
}
|
|
|
|
|
if options.TransientRetries != nil {
|
|
|
|
|
request.TransientRetries = options.TransientRetries
|
|
|
|
|
}
|
|
|
|
|
if options.OnPrepared != nil {
|
|
|
|
|
existing := request.OnPrepared
|
|
|
|
|
request.OnPrepared = func(ctx context.Context, details promptkit.PreparedRun) {
|
|
|
|
|
if existing != nil {
|
|
|
|
|
existing(ctx, details)
|
|
|
|
|
}
|
|
|
|
|
options.OnPrepared(ctx, details)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return request
|
|
|
|
|
}
|