fix openai payload
This commit is contained in:
+6
-6
@@ -20,13 +20,14 @@ func NewClient(token string) *Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c Client) ChatCompletions(prompt string) (*CompletionResponse, error) {
|
func (c Client) ChatCompletions(prompt string) (*CompletionResponse, error) {
|
||||||
fmt.Println("using prompt: ", prompt, cleanPrompt(prompt))
|
|
||||||
body := &ChatCompletionPayload{
|
body := &ChatCompletionPayload{
|
||||||
Model: "gpt-3.5-turbo",
|
Model: "gpt-3.5-turbo",
|
||||||
Messages: []CompletionPayloadMessage{},
|
Messages: []CompletionPayloadMessage{
|
||||||
Prompt: cleanPrompt(prompt),
|
{Role: "system", Content: "You are a fun comedian who only respond in french"},
|
||||||
|
{Role: "user", Content: cleanPrompt(prompt)},
|
||||||
|
},
|
||||||
MaxTokens: 50,
|
MaxTokens: 50,
|
||||||
Temperature: 0.2,
|
Temperature: 1,
|
||||||
N: 1,
|
N: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +68,6 @@ func cleanPrompt(p string) string {
|
|||||||
type ChatCompletionPayload struct {
|
type ChatCompletionPayload struct {
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
Messages []CompletionPayloadMessage `json:"messages"`
|
Messages []CompletionPayloadMessage `json:"messages"`
|
||||||
Prompt string `json:"prompt"`
|
|
||||||
MaxTokens int `json:"max_tokens"`
|
MaxTokens int `json:"max_tokens"`
|
||||||
Temperature float32 `json:"temperature"`
|
Temperature float32 `json:"temperature"`
|
||||||
TopP float32 `json:"top_p"`
|
TopP float32 `json:"top_p"`
|
||||||
|
|||||||
Reference in New Issue
Block a user