Documentation
¶
Index ¶
- func New(opts ...ai.ClientOption) (ai.AI, error)
- func NewWithClient(client *openai.Client, model string) ai.AI
- type ChatCompletionResponse
- type ChatGPT
- func (ai *ChatGPT) Chat(ctx context.Context, messages ...ai.Part) (ai.ChatResponse, error)
- func (ai *ChatGPT) ChatSession() ai.ChatSession
- func (ai *ChatGPT) ChatStream(ctx context.Context, messages ...ai.Part) (ai.ChatStream, error)
- func (ai *ChatGPT) Close() error
- func (ChatGPT) LLMs() ai.LLMs
- func (chatgpt *ChatGPT) Limit() (rpm int64)
- func (chatgpt *ChatGPT) Model(_ context.Context) (string, error)
- func (ai *ChatGPT) SetCount(i int64)
- func (chatgpt *ChatGPT) SetFunctionCall(f []ai.Function, mode ai.FunctionCallingMode)
- func (ai *ChatGPT) SetJSONResponse(b bool)
- func (chatgpt *ChatGPT) SetLimit(rpm int64)
- func (ai *ChatGPT) SetMaxTokens(i int64)
- func (ai *ChatGPT) SetModel(model string)
- func (ai *ChatGPT) SetTemperature(f float64)
- func (ai *ChatGPT) SetTopP(f float64)
- type ChatResponse
- func (resp *ChatResponse[Response]) FunctionCalls() (res []ai.FunctionCall)
- func (resp *ChatResponse[Response]) Raw() any
- func (resp *ChatResponse[Response]) Results() (res []string)
- func (resp *ChatResponse[Response]) String() string
- func (resp *ChatResponse[Response]) TokenCount() (res ai.TokenCount)
- type ChatSession
- type ChatStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWithClient ¶
Types ¶
type ChatCompletionResponse ¶ added in v1.0.18
type ChatCompletionResponse interface { *openai.ChatCompletion | openai.ChatCompletionChunk }
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) SetFunctionCall ¶ added in v1.0.19
func (chatgpt *ChatGPT) SetFunctionCall(f []ai.Function, mode ai.FunctionCallingMode)
func (*ChatGPT) SetJSONResponse ¶ added in v1.0.11
func (*ChatGPT) SetMaxTokens ¶
func (*ChatGPT) SetTemperature ¶
type ChatResponse ¶
type ChatResponse[Response ChatCompletionResponse] struct { // contains filtered or unexported fields }
func (*ChatResponse[Response]) FunctionCalls ¶ added in v1.0.19
func (resp *ChatResponse[Response]) FunctionCalls() (res []ai.FunctionCall)
func (*ChatResponse[Response]) Raw ¶ added in v1.0.19
func (resp *ChatResponse[Response]) Raw() any
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 ...ai.Part) (ai.ChatResponse, error)
func (*ChatSession) ChatStream ¶
func (session *ChatSession) ChatStream(ctx context.Context, messages ...ai.Part) (ai.ChatStream, error)
func (*ChatSession) History ¶
func (session *ChatSession) History() (history []ai.Content)
type ChatStream ¶
type ChatStream struct {
// contains filtered or unexported fields
}
func (*ChatStream) Close ¶ added in v1.0.2
func (cs *ChatStream) Close() error
func (*ChatStream) Next ¶
func (cs *ChatStream) Next() (ai.ChatResponse, error)
Click to show internal directories.
Click to hide internal directories.