Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatCompletion ¶
type ChatCompletion interface {
// StartRequest initializes timing for a new request.
StartRequest()
// SetModel sets the model the request. This is usually called after parsing the request body .
SetModel(model string)
// SetBackend sets the selected backend when the routing decision has been made. This is usually called
// after parsing the request body to determine the model and invoke the routing logic.
SetBackend(backend filterapi.Backend)
// RecordTokenUsage records token usage metrics.
RecordTokenUsage(ctx context.Context, inputTokens, outputTokens, totalTokens uint32)
// RecordRequestCompletion records latency metrics for the entire request
RecordRequestCompletion(ctx context.Context, success bool)
// RecordTokenLatency records latency metrics for token generation.
RecordTokenLatency(ctx context.Context, tokens uint32)
}
ChatCompletion is the interface for the chat completion AI Gateway metrics.
func NewChatCompletion ¶
func NewChatCompletion(meter metric.Meter) ChatCompletion
NewChatCompletion creates a new ChatCompletion instance.
Click to show internal directories.
Click to hide internal directories.