Documentation
¶
Index ¶
Constants ¶
View Source
const ( ModelGPT3Dot5Turbo = openai.GPT3Dot5Turbo ModelGPT4 = openai.GPT4 ModelGPT4Turbo = openai.GPT4Turbo ModelGPT4o = openai.GPT4o // default ModelGPT4oMini = openai.GPT4oMini ModelO1Mini = openai.O1Mini ModelO1Preview = openai.O1Preview DefaultModel = ModelO1Mini RoleTypeGopher = "You are a Go Language Coder Assistant, an AI specialized in writing, debugging, " + "and explaining Go code. You only provide solutions and explanations for Go programming " + "language. Always provide clear and concise code examples, and explain your solutions step by step." RoleTypeGeneral = "You are a General Assistant, an AI that can help with a wide range of tasks, including " + "answering questions, writing content, generating code, translating languages, and more. " + "Always provide clear, concise, and helpful responses." )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { ModelName string Cli *openai.Client // contains filtered or unexported fields }
Client is a chat GPT client.
func NewClient ¶
func NewClient(apiKey string, opts ...ClientOption) (*Client, error)
NewClient creates a new chat client.
func (*Client) ListModelNames ¶
ListModelNames lists all available model names.
func (*Client) RefreshContext ¶
func (c *Client) RefreshContext()
RefreshContext refreshes assistant context
func (*Client) SendStream ¶
func (c *Client) SendStream(ctx context.Context, prompt string) *StreamReply
SendStream sends a prompt to the chat gpt and returns a channel of responses.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function that sets a Client option.
func WithMaxTokens ¶
func WithMaxTokens(max int) ClientOption
WithMaxTokens sets the maximum number of tokens
func WithTemperature ¶
func WithTemperature(temperature float32) ClientOption
WithTemperature sets the temperature
func WithUseContext ¶
func WithUseContext(isUse bool) ClientOption
WithUseContext sets assistant context
type StreamReply ¶
StreamReply reply with stream response
Click to show internal directories.
Click to hide internal directories.