Skip to content

Commit c96f542

Browse files
author
Working On It
committed
fix: the model's Chain-of-Thought (CoT) uses a different language(casibase#1305)
1 parent ad83413 commit c96f542

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

carrier/suggestion.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ func NewSuggestionCarrier(suggestionCount int) (*SuggestionCarrier, error) {
3131

3232
func (p *SuggestionCarrier) GetQuestion(question string) (string, error) {
3333
if p.suggestionCount <= 0 {
34+
promptTemplate := `Your reasoning and response must be in the same language as user's question.
35+
36+
Here is the user's question: %s`
37+
question = fmt.Sprintf(promptTemplate, question)
3438
return question, nil
3539
}
3640

@@ -39,7 +43,7 @@ func (p *SuggestionCarrier) GetQuestion(question string) (string, error) {
3943
format += p.divider + "<Predicted question " + strconv.Itoa(i+1) + ">"
4044
}
4145

42-
promptTemplate := "\n\nYour response must be in the same language as my query." + `Please follow the steps below to optimize your answer:
46+
promptTemplate := `\n\nPlease follow the steps below to optimize your answer:
4347
4448
1. **Generate an answer**: Provide a clear, accurate, and helpful answer to the user's question.
4549
@@ -61,6 +65,8 @@ Examples of generated predicted questions:
6165
1. Do you know the weather today?
6266
2. Do you have any news to share?
6367
68+
Your reasoning and response must be in the same language as user's question.
69+
6470
Here is the user's question: %s`
6571

6672
question = fmt.Sprintf(promptTemplate, p.divider, p.suggestionCount, p.divider, format, p.divider, question)

carrier/title.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (p *TitleCarrier) GetQuestion(question string) (string, error) {
3232

3333
format := "<title>"
3434
question = question +
35-
"\n\nYour response must be in the same language as my query." +
35+
"\n\nYour reasoning and response must be in the same language as user's question." +
3636
"\n\n**At the end of your answer, if and only if a clear, concise, and meaningful title can be generated to summarize the content, append it.**\n" +
3737
"The title should appear at the very end of the response, prefixed by: " + p.divider + "\n" +
3838
"Do not include the divider or title if a meaningful title cannot be generated.\n" +

0 commit comments

Comments
 (0)