Documentation
¶
Index ¶
- func New(authToken string) ai.AI
- func NewWithBaseURL(authToken, baseURL string) ai.AI
- func NewWithClient(client *openai.Client) ai.AI
- type ChatGPT
- func (ai *ChatGPT) Chat(ctx context.Context, messages ...string) (ai.ChatResponse, error)
- func (ai *ChatGPT) ChatSession() ai.ChatSession
- func (ai *ChatGPT) ChatStream(ctx context.Context, messages ...string) (ai.ChatStream, error)
- func (ai *ChatGPT) Close() error
- func (ai *ChatGPT) SetCount(i int32)
- func (chatgpt *ChatGPT) SetLimit(limit rate.Limit)
- func (ai *ChatGPT) SetMaxTokens(i int32)
- func (ai *ChatGPT) SetModel(model string)
- func (ai *ChatGPT) SetTemperature(f float32)
- func (ai *ChatGPT) SetTopP(f float32)
- type ChatGPTResponse
- type ChatResponse
- type ChatSession
- type ChatStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWithBaseURL ¶ added in v1.0.3
func NewWithClient ¶
Types ¶
type ChatGPT ¶
type ChatGPT struct {
// contains filtered or unexported fields
}
func (*ChatGPT) ChatSession ¶
func (ai *ChatGPT) ChatSession() ai.ChatSession
func (*ChatGPT) ChatStream ¶
func (*ChatGPT) SetMaxTokens ¶
func (*ChatGPT) SetTemperature ¶
type ChatGPTResponse ¶
type ChatGPTResponse interface { openai.ChatCompletionResponse | openai.ChatCompletionStreamResponse }
type ChatResponse ¶
type ChatResponse[Response ChatGPTResponse] struct { // contains filtered or unexported fields }
func (*ChatResponse[Response]) Results ¶
func (resp *ChatResponse[Response]) Results() (res []string)
func (*ChatResponse[Response]) String ¶ added in v1.0.2
func (resp *ChatResponse[Response]) String() string
type ChatSession ¶
type ChatSession struct {
// contains filtered or unexported fields
}
func (*ChatSession) Chat ¶
func (session *ChatSession) Chat(ctx context.Context, messages ...string) (ai.ChatResponse, error)
func (*ChatSession) ChatStream ¶
func (session *ChatSession) ChatStream(ctx context.Context, messages ...string) (ai.ChatStream, error)
func (*ChatSession) History ¶
func (session *ChatSession) History() (history []ai.Message)
type ChatStream ¶
type ChatStream struct {
// contains filtered or unexported fields
}
func (*ChatStream) Close ¶ added in v1.0.2
func (stream *ChatStream) Close() error
func (*ChatStream) Next ¶
func (stream *ChatStream) Next() (ai.ChatResponse, error)
Click to show internal directories.
Click to hide internal directories.