Add PromptKit requirements YAML report
This commit is contained in:
@@ -316,6 +316,39 @@ type promptInspectionReport struct {
|
||||
OutputContract promptOutputContractReport `yaml:"output_contract"`
|
||||
}
|
||||
|
||||
type requirementsInspectionReport struct {
|
||||
PromptID string `yaml:"prompt_id"`
|
||||
PromptVersion string `yaml:"prompt_version"`
|
||||
ProfileID string `yaml:"profile_id"`
|
||||
Complete bool `yaml:"complete"`
|
||||
Inputs []requirementInputReport `yaml:"inputs"`
|
||||
Variables []requirementVariableReport `yaml:"variables"`
|
||||
Issues []requirementIssueReport `yaml:"issues"`
|
||||
}
|
||||
|
||||
type requirementInputReport struct {
|
||||
Name string `yaml:"name"`
|
||||
Kind string `yaml:"kind"`
|
||||
Declared bool `yaml:"declared"`
|
||||
ContentType *string `yaml:"content_type"`
|
||||
Description *string `yaml:"description"`
|
||||
Explanation string `yaml:"explanation"`
|
||||
}
|
||||
|
||||
type requirementVariableReport struct {
|
||||
Name string `yaml:"name"`
|
||||
Kind string `yaml:"kind"`
|
||||
Supplied bool `yaml:"supplied"`
|
||||
Explanation string `yaml:"explanation"`
|
||||
}
|
||||
|
||||
type requirementIssueReport struct {
|
||||
Code string `yaml:"code"`
|
||||
InputName string `yaml:"input_name"`
|
||||
VariableName string `yaml:"variable_name"`
|
||||
Description string `yaml:"description"`
|
||||
}
|
||||
|
||||
type modelParamsReport struct {
|
||||
BackendID string `yaml:"backend_id"`
|
||||
Endpoint string `yaml:"endpoint"`
|
||||
@@ -356,6 +389,45 @@ func promptReportFromInspection(inspection *promptkit.PromptInspection) promptIn
|
||||
return report
|
||||
}
|
||||
|
||||
func requirementsReportFromInspection(inspection *promptkit.RequirementInspection) requirementsInspectionReport {
|
||||
report := requirementsInspectionReport{
|
||||
PromptID: inspection.PromptID,
|
||||
PromptVersion: inspection.PromptVersion,
|
||||
ProfileID: inspection.ProfileID,
|
||||
Complete: inspection.Complete,
|
||||
Inputs: make([]requirementInputReport, 0, len(inspection.Inputs)),
|
||||
Variables: make([]requirementVariableReport, 0, len(inspection.Variables)),
|
||||
Issues: make([]requirementIssueReport, 0, len(inspection.Issues)),
|
||||
}
|
||||
for _, input := range inspection.Inputs {
|
||||
report.Inputs = append(report.Inputs, requirementInputReport{
|
||||
Name: input.Name,
|
||||
Kind: string(input.Kind),
|
||||
Declared: input.Declared,
|
||||
ContentType: input.ContentType,
|
||||
Description: input.Description,
|
||||
Explanation: input.Explanation,
|
||||
})
|
||||
}
|
||||
for _, variable := range inspection.Variables {
|
||||
report.Variables = append(report.Variables, requirementVariableReport{
|
||||
Name: variable.Name,
|
||||
Kind: string(variable.Kind),
|
||||
Supplied: variable.Supplied,
|
||||
Explanation: variable.Explanation,
|
||||
})
|
||||
}
|
||||
for _, issue := range inspection.Issues {
|
||||
report.Issues = append(report.Issues, requirementIssueReport{
|
||||
Code: string(issue.Code),
|
||||
InputName: issue.InputName,
|
||||
VariableName: issue.VariableName,
|
||||
Description: issue.Description,
|
||||
})
|
||||
}
|
||||
return report
|
||||
}
|
||||
|
||||
func profileReportFromInspection(inspection *promptkit.ProfileInspection) profileInspectionReport {
|
||||
params := inspection.EffectiveModelParams
|
||||
extra := params.ExtraParams
|
||||
|
||||
Reference in New Issue
Block a user