Carry optional prompt labels through results
This commit is contained in:
@@ -252,7 +252,7 @@ func (r *Runner) executePreparedRun(
|
||||
RawOutput: genResp.Content,
|
||||
Validation: validationResult,
|
||||
PromptID: prepared.PromptID,
|
||||
PromptVersion: prepared.PromptVersion,
|
||||
PromptVersion: copyStringPointer(prepared.PromptVersion),
|
||||
PromptHash: prepared.PromptHash,
|
||||
SessionID: prepared.SessionID,
|
||||
RenderedPromptHash: prepared.RenderedPromptHash,
|
||||
@@ -321,7 +321,7 @@ func (r *Runner) resolvePreparation(
|
||||
}
|
||||
def := promptSelection.definition
|
||||
if recorder := observation.FromContext(ctx); recorder != nil {
|
||||
recorder.UpdateSelection(observation.Selection{PromptID: def.ID, PromptVersion: def.Version})
|
||||
recorder.UpdateSelection(observation.Selection{PromptID: def.ID, PromptVersion: copyStringPointer(def.Version)})
|
||||
}
|
||||
promptDefinitionHash := promptSelection.hash
|
||||
effectiveContract, err := resolveOutputContract(def, req.Validation)
|
||||
@@ -342,7 +342,7 @@ func (r *Runner) resolvePreparation(
|
||||
return nil, err
|
||||
}
|
||||
if recorder := observation.FromContext(ctx); recorder != nil {
|
||||
recorder.UpdateSelection(observation.Selection{PromptID: def.ID, PromptVersion: def.Version, ProfileID: selection.id})
|
||||
recorder.UpdateSelection(observation.Selection{PromptID: def.ID, PromptVersion: copyStringPointer(def.Version), ProfileID: selection.id})
|
||||
}
|
||||
|
||||
effectiveModel, targetPresence := resolveExecutionTarget(selection.profile, req.Execution)
|
||||
@@ -355,7 +355,7 @@ func (r *Runner) resolvePreparation(
|
||||
return nil, fmt.Errorf("%w: %w", ErrInvalidRequest, err)
|
||||
}
|
||||
if recorder := observation.FromContext(ctx); recorder != nil {
|
||||
recorder.UpdateSelection(observation.Selection{PromptID: def.ID, PromptVersion: def.Version,
|
||||
recorder.UpdateSelection(observation.Selection{PromptID: def.ID, PromptVersion: copyStringPointer(def.Version),
|
||||
ProfileID: selection.id, BackendID: effectiveModel.BackendID, Model: effectiveModel.Model})
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ func (r *Runner) completePreparationWithStructuredOutput(
|
||||
effectiveModel.APIKey = ""
|
||||
return &domain.PreparedRun{
|
||||
PromptID: state.definition.ID,
|
||||
PromptVersion: state.definition.Version,
|
||||
PromptVersion: copyStringPointer(state.definition.Version),
|
||||
PromptHash: state.promptDefinitionHash,
|
||||
SelectedProfileID: state.selectedProfileID,
|
||||
SelectedBackendID: state.effectiveModel.BackendID,
|
||||
@@ -713,3 +713,11 @@ func buildOutputArtifact(content string, format domain.OutputFormat) domain.Arti
|
||||
func hashPromptDefinition(def *domain.PromptDefinition) (string, error) {
|
||||
return promptdef.HashDefinition(def)
|
||||
}
|
||||
|
||||
func copyStringPointer(value *string) *string {
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
copy := *value
|
||||
return ©
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user