Documentation
¶
Index ¶
- type ChatResponse
- type Client
- type FunctionCallData
- type FunctionResponseData
- type Message
- type OpenAIProvider
- func (p *OpenAIProvider) Chat(messages []common.Message, tools []common.Tool, thinkingEnabled bool) (*common.ChatResponse, error)
- func (p *OpenAIProvider) ChatStream(messages []common.Message, tools []common.Tool, thinkingEnabled bool, ...) (*common.ChatResponse, error)
- func (p *OpenAIProvider) Close() error
- type StreamCallback
- type TokenUsage
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatResponse ¶
type ChatResponse struct {
Message string
Reasoning string // Reasoning/thinking content
ToolCalls []FunctionCallData
}
ChatResponse represents the response from a chat completion
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a custom OpenAI/OpenRouter client
func NewClientWithConfig ¶
NewClientWithConfig creates a new client with explicit configuration
func (*Client) Chat ¶
func (c *Client) Chat(messages []Message, tools []Tool) (*ChatResponse, *TokenUsage, error)
Chat sends a non-streaming chat request
func (*Client) ChatStream ¶
func (c *Client) ChatStream(messages []Message, tools []Tool, thinkingEnabled bool, callback StreamCallback) (*ChatResponse, *TokenUsage, error)
ChatStream sends a streaming chat request
type FunctionCallData ¶
FunctionCallData represents a function/tool call
type FunctionResponseData ¶
type FunctionResponseData struct {
ID string // tool_call_id from the original tool call block
Name string
Response map[string]interface{}
}
FunctionResponseData represents a function/tool response
type Message ¶
type Message struct {
Role string
Content string
FunctionResponse *FunctionResponseData
FunctionCalls []FunctionCallData
}
Message represents a chat message
type OpenAIProvider ¶
type OpenAIProvider struct {
// contains filtered or unexported fields
}
OpenAIProvider implements common.Provider for OpenAI/OpenRouter
func NewOpenAIProvider ¶
func NewOpenAIProvider(config common.ProviderConfig) (*OpenAIProvider, error)
NewOpenAIProvider creates a new OpenAI/OpenRouter provider
func (*OpenAIProvider) Chat ¶
func (p *OpenAIProvider) Chat(messages []common.Message, tools []common.Tool, thinkingEnabled bool) (*common.ChatResponse, error)
Chat sends a non-streaming chat request
func (*OpenAIProvider) ChatStream ¶
func (p *OpenAIProvider) ChatStream(messages []common.Message, tools []common.Tool, thinkingEnabled bool, callback common.StreamCallback) (*common.ChatResponse, error)
ChatStream sends a streaming chat request
type StreamCallback ¶
StreamCallback is called for each chunk as it's streamed isThought indicates if this chunk is reasoning/thinking (true) or regular content (false)
type TokenUsage ¶
TokenUsage represents token usage information