Skip to content

Commit

Permalink
update the prompt to translate the generated phrase
Browse files Browse the repository at this point in the history
  • Loading branch information
wuqinqiang committed Mar 8, 2023
1 parent 987e777 commit 37eb1ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions generator/gpt3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
gogpt "github.com/sashabaranov/go-gpt3"
)

var prompt = "使用单词:%s 写一篇英语短文。短文最后标注这几个单词的中文意思"
var prompt = "请使用单词:%s 写一篇120字左右的英语短文。必须单独标注 %s 单词中文意思,同时把短文翻译成中文"

type Client struct {
*gogpt.Client
Expand Down Expand Up @@ -43,7 +43,7 @@ func NewClient(token string, proxyUrl string) (*Client, error) {

func (client *Client) Generate(ctx context.Context, words []string) (phrase string, err error) {
wordStr := strings.Join(words, ",")
return client.request(ctx, fmt.Sprintf(prompt, wordStr))
return client.request(ctx, fmt.Sprintf(prompt, wordStr, wordStr))
}

func (client *Client) request(ctx context.Context, text string) (string, error) {
Expand All @@ -56,7 +56,7 @@ func (client *Client) request(ctx context.Context, text string) (string, error)
Content: text,
},
},
MaxTokens: 400,
MaxTokens: 2000,
}

var (
Expand Down

0 comments on commit 37eb1ad

Please sign in to comment.