Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an OpenAI client wrapper It implements the provider.Provider interface
func NewClient ¶
func NewClient(ctx context.Context, cfg *latest.ModelConfig, env environment.Provider, opts ...options.Opt) (*Client, error)
NewClient creates a new OpenAI client from the provided configuration
func (*Client) CreateChatCompletion ¶
func (*Client) CreateChatCompletionStream ¶
func (c *Client) CreateChatCompletionStream( ctx context.Context, messages []chat.Message, requestTools []tools.Tool, ) (chat.MessageStream, error)
CreateChatCompletionStream creates a streaming chat completion request It returns a stream that can be iterated over to get completion chunks
type StreamAdapter ¶
type StreamAdapter struct {
// contains filtered or unexported fields
}
StreamAdapter adapts the OpenAI stream to our interface
func (*StreamAdapter) Recv ¶
func (a *StreamAdapter) Recv() (chat.MessageStreamResponse, error)
Recv gets the next completion chunk
Click to show internal directories.
Click to hide internal directories.