Documentation
¶
Index ¶
- func New(opts ...ai.ClientOption) (ai.AI, error)
- func NewWithClient(client *openai.Client, model string) 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 (ChatGPT) LLMs() ai.LLMs
- func (chatgpt *ChatGPT) Model(_ context.Context) (string, error)
- func (ai *ChatGPT) SetCount(i int32)
- func (ai *ChatGPT) SetJSONResponse(b bool)
- 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 NewWithClient ¶
Types ¶
type ChatGPT ¶
type ChatGPT struct { *openai.Client // contains filtered or unexported fields }
func (*ChatGPT) ChatSession ¶
func (ai *ChatGPT) ChatSession() ai.ChatSession
func (*ChatGPT) ChatStream ¶
func (*ChatGPT) SetJSONResponse ¶ added in v1.0.11
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
func (*ChatResponse[Response]) TokenCount ¶ added in v1.0.13
func (resp *ChatResponse[Response]) TokenCount() (res ai.TokenCount)
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.