Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: optimize prompt output #398

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}}
`
*/
)
Loading