Skip to content

Commit 1ea3af8

Browse files
authored
Merge pull request #398 from 0xff-dev/optimize-prompt
fix: optimize prompt output
2 parents 1e94538 + 01fe3cb commit 1ea3af8

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

pkg/evaluator/evaluator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func (evaluator *Evaluator) EvaluateWithData(ctx context.Context, data *Data, op
169169
switch evaluator.llm.Spec.Type {
170170
case llms.ZhiPuAI:
171171
params := zhipuai.DefaultModelParams()
172-
params.Model = llms.ZhiPuAILite
172+
params.Model = llms.ZhiPuAIPro
173173
params.Prompt = []zhipuai.Prompt{
174174
{Role: zhipuai.User, Content: output.String()},
175175
}

pkg/evaluator/prompt.go

+30-13
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,40 @@ const DefaultOutputFormat = `json
2121
`
2222

2323
const (
24-
DefaultPromptTemplate = `
25-
I have a component in my repository that I'm interested in assessing the {{ .Dimension }} implications of this component.Below are some context from component {{ .Dimension }} check:
26-
1. A component is a software which can be deployed into kubernetes with its helm charts.
27-
2. Use customized tekton pipelines to run the tests.
24+
DefaultPromptTemplate = `I have a component in my repository and I want to evaluate the impact of the component's {{.Dimension}} dimension.
25+
here is the context of the component's {{.Dimension}} dimension
26+
1. a component is a piece of software that can be deployed into kubernetes via its helm chart.
27+
2. tests are run using a customized tokton.
2828
29-
Below are the tested Tasks:
30-
3129
{{ .Tasks }}
3230
31+
You need to rate the component (1-10, out of 10), give recommendations and point out problems.
32+
The scores are integer types, and the suggestions and problems are string arrays.
33+
At least one of the suggestions and problems must be given. Answers are output in json format:
3334
34-
**Component {{ .Dimension }} Assessment**:
35-
- Could you please review the above tested tasks and inform me any potential {{ .Dimension }} risks if I adopt this component in production?
35+
{"chinese": {"score":1, "suggestions":[""], "problems":[""]}, "english":{"score":1, "suggestions":[""], "problems":[""]}}
3636
37-
**Final Rating based on above tested tasks**:
38-
- On a scale of 1 to 10, with 10 being the most reliable, how would you rate the {{ .Dimension }} of this component?
37+
Note that the data corresponding to the chinese field in the json should be output in Chinese, and the data corresponding to the english field should be output in English.`
3938

40-
Your answer should follow the below format:
41-
{{.OutputFormat}}
42-
`
39+
/*
40+
DefaultPromptTemplate = `
41+
I have a component in my repository that I'm interested in assessing the {{ .Dimension }} implications of this component.Below are some context from component {{ .Dimension }} check:
42+
1. A component is a software which can be deployed into kubernetes with its helm charts.
43+
2. Use customized tekton pipelines to run the tests.
44+
45+
Below are the tested Tasks:
46+
47+
{{ .Tasks }}
48+
49+
50+
**Component {{ .Dimension }} Assessment**:
51+
- Could you please review the above tested tasks and inform me any potential {{ .Dimension }} risks if I adopt this component in production?
52+
53+
**Final Rating based on above tested tasks**:
54+
- On a scale of 1 to 10, with 10 being the most reliable, how would you rate the {{ .Dimension }} of this component?
55+
56+
Your answer should follow the below format:
57+
{{.OutputFormat}}
58+
`
59+
*/
4360
)

0 commit comments

Comments
 (0)