ai

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 3 Imported by: 0

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

func NewTrackedClient(client ai.Client, tracker ai.Tracker, executionID string) *TrackedClient

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL