Documentation
¶
Overview ¶
Package ai provides a TrackedClient decorator that wraps an AI client with automatic request timing and tracking capabilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TrackedChatResult ¶
type TrackedChatResult struct {
Response *ai.ChatResponse
TrackData ai.TrackRequest
Error error
}
TrackedChatResult contains both the response and tracking information.
type TrackedClient ¶
type TrackedClient struct {
// contains filtered or unexported fields
}
TrackedClient wraps an ai.Client and automatically tracks all requests. This implements the Decorator pattern.
func NewTrackedClient ¶
NewTrackedClient creates a TrackedClient that wraps the given client and tracks requests.
func (*TrackedClient) Chat ¶
func (tc *TrackedClient) Chat(functionID string, req ai.ChatRequest) (*ai.ChatResponse, error)
Chat executes a chat request with automatic tracking. It measures duration, captures request/response data, and tracks the result.
func (*TrackedClient) ChatWithTracking ¶
func (tc *TrackedClient) ChatWithTracking(functionID string, req ai.ChatRequest) TrackedChatResult
ChatWithTracking executes a chat request and returns both the response and tracking data. This is useful when you need access to the tracking information.