Categorygithub.com/zzzzer91/chatgpt-go
modulepackage
0.0.0-20230809111228-f67d4543bb7b
Repository: https://github.com/zzzzer91/chatgpt-go.git
Documentation: pkg.go.dev

# README

ChatGPT go client

Usage:

func main() {
	secretKey := ""
	cli := chatgpt.NewService(secretKey, chatgpt.WithHost("api.openai.com"), chatgpt.WithTimeout(15*time.Second))
	msgs := []*Message{
		{Role: RoleTypeUser, Content: "who are you"},
	}

	ctx := context.Background()
	resp, err := cli.Chat(ctx, msgs)
	if err != nil {
		panic(err)
	}
	fmt.Println(resp.Choices[0].Message.Content)

	err = s.ChatStream(ctx, msgs, func(resp *ChatResponse) error {
		fmt.Print(resp.Choices[0].Delta.Content)
		return nil
	})
	if err != nil {
		panic(err)
	}
}

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
WithTemperature sets temperature.
No description provided by the author
WithTopP sets top_p An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author