Track an operation which uses Bedrock.
This function will track the duration of the operation, the token usage, and the success or error status.
The result of the Bedrock operation.
The input operation.
Track the duration of execution of the provided function.
If the provided function throws, then this method will also throw. In the case the provided function throws, this function will still record the duration.
This function does not automatically record an error when the function throws.
The function to track the duration of.
The result of the function.
Track sentiment about the generation.
Feedback about the generation.
Track metrics for a generic AI operation.
This function will track the duration of the operation, extract metrics using the provided metrics extractor function, and track success or error status accordingly.
If the provided function throws, then this method will also throw. In the case the provided function throws, this function will record the duration and an error. A failed operation will not have any token usage data.
Function that extracts LDAIMetrics from the operation result
Function which executes the operation
The result of the operation
Track an OpenAI operation.
This function will track the duration of the operation, the token usage, and the success or error status.
If the provided function throws, then this method will also throw. In the case the provided function throws, this function will record the duration and an error. A failed operation will not have any token usage data.
Function which executes the operation.
The result of the operation.
Track metrics for a streaming AI operation.
This function will track the duration of the operation, extract metrics using the provided metrics extractor function, and track success or error status accordingly.
Unlike trackMetricsOf, this method is designed for streaming operations where:
The stream is returned immediately so the caller can begin consuming it without waiting. Metrics extraction happens in the background and does not block stream consumption.
If the stream creator throws, then this method will also throw and record an error. If metrics extraction fails, the error is logged but does not affect stream consumption.
Function that creates and returns the stream (synchronous)
Function that asynchronously extracts metrics from the stream
The stream result (returned immediately, not a Promise)
Track information about token usage.
Token usage information.
Track a Vercel AI SDK generateText operation.
This function will track the duration of the operation, the token usage, and the success or error status.
If the provided function throws, then this method will also throw. In the case the provided function throws, this function will record the duration and an error. A failed operation will not have any token usage data.
Function which executes the operation.
The result of the operation.
Track a Vercel AI SDK streamText operation.
This function will track the duration of the operation, the token usage, and the success or error status.
If the provided function throws, then this method will also throw. In the case the provided function throws, this function will record the duration and an error. A failed operation will not have any token usage data.
Function which executes the operation.
The result of the operation.
Use trackStreamMetricsOf() with VercelProvider.createStreamMetricsExtractor() from the
@launchdarkly/server-sdk-ai-vercel package instead. This method will be removed in a future version.
Generated using TypeDoc
The LDAIConfigTracker is used to track various details about AI operations.