Skip to content

Commit

Permalink
Merge pull request #398 from 0xff-dev/optimize-prompt
Browse files Browse the repository at this point in the history
fix: optimize prompt output
  • Loading branch information
bjwswang authored Jan 11, 2024
2 parents 1e94538 + 01fe3cb commit 1ea3af8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/evaluator/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (evaluator *Evaluator) EvaluateWithData(ctx context.Context, data *Data, op
switch evaluator.llm.Spec.Type {
case llms.ZhiPuAI:
params := zhipuai.DefaultModelParams()
params.Model = llms.ZhiPuAILite
params.Model = llms.ZhiPuAIPro
params.Prompt = []zhipuai.Prompt{
{Role: zhipuai.User, Content: output.String()},
}
Expand Down
43 changes: 30 additions & 13 deletions pkg/evaluator/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,40 @@ const DefaultOutputFormat = `json
`

const (
DefaultPromptTemplate = `
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:
1. A component is a software which can be deployed into kubernetes with its helm charts.
2. Use customized tekton pipelines to run the tests.
DefaultPromptTemplate = `I have a component in my repository and I want to evaluate the impact of the component's {{.Dimension}} dimension.
here is the context of the component's {{.Dimension}} dimension
1. a component is a piece of software that can be deployed into kubernetes via its helm chart.
2. tests are run using a customized tokton.
Below are the tested Tasks:
{{ .Tasks }}
You need to rate the component (1-10, out of 10), give recommendations and point out problems.
The scores are integer types, and the suggestions and problems are string arrays.
At least one of the suggestions and problems must be given. Answers are output in json format:
**Component {{ .Dimension }} Assessment**:
- Could you please review the above tested tasks and inform me any potential {{ .Dimension }} risks if I adopt this component in production?
{"chinese": {"score":1, "suggestions":[""], "problems":[""]}, "english":{"score":1, "suggestions":[""], "problems":[""]}}
**Final Rating based on above tested tasks**:
- On a scale of 1 to 10, with 10 being the most reliable, how would you rate the {{ .Dimension }} of this component?
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.`

Your answer should follow the below format:
{{.OutputFormat}}
`
/*
DefaultPromptTemplate = `
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:
1. A component is a software which can be deployed into kubernetes with its helm charts.
2. Use customized tekton pipelines to run the tests.
Below are the tested Tasks:
{{ .Tasks }}
**Component {{ .Dimension }} Assessment**:
- Could you please review the above tested tasks and inform me any potential {{ .Dimension }} risks if I adopt this component in production?
**Final Rating based on above tested tasks**:
- On a scale of 1 to 10, with 10 being the most reliable, how would you rate the {{ .Dimension }} of this component?
Your answer should follow the below format:
{{.OutputFormat}}
`
*/
)

0 comments on commit 1ea3af8

Please sign in to comment.