InferenceScope class
Provides OpenTelemetry tracing scope for generative AI inference operations.
- Extends
Methods
| record |
Records the finish reasons for telemetry tracking. |
| record |
Records the input messages for telemetry tracking. |
| record |
Records the number of input tokens for telemetry tracking. |
| record |
Records the output messages for telemetry tracking. |
| record |
Records the number of output tokens for telemetry tracking. |
| record |
Records the response id for telemetry tracking. |
| start(Inference |
Creates and starts a new scope for inference tracing. |
Inherited Methods
| dispose() | Legacy dispose method for compatibility |
| record |
Records an error that occurred during the operation |
| with |
Makes this span active for the duration of the async callback execution |
Method Details
recordFinishReasons(string[])
Records the finish reasons for telemetry tracking.
function recordFinishReasons(finishReasons: string[])
Parameters
- finishReasons
-
string[]
Array of finish reasons
recordInputMessages(string[])
Records the input messages for telemetry tracking.
function recordInputMessages(messages: string[])
Parameters
- messages
-
string[]
Array of input messages
recordInputTokens(number)
Records the number of input tokens for telemetry tracking.
function recordInputTokens(inputTokens: number)
Parameters
- inputTokens
-
number
Number of input tokens
recordOutputMessages(string[])
Records the output messages for telemetry tracking.
function recordOutputMessages(messages: string[])
Parameters
- messages
-
string[]
Array of output messages
recordOutputTokens(number)
Records the number of output tokens for telemetry tracking.
function recordOutputTokens(outputTokens: number)
Parameters
- outputTokens
-
number
Number of output tokens
recordResponseId(string)
Records the response id for telemetry tracking.
function recordResponseId(responseId: string)
Parameters
- responseId
-
string
The response ID
start(InferenceDetails, AgentDetails, TenantDetails)
Creates and starts a new scope for inference tracing.
static function start(details: InferenceDetails, agentDetails: AgentDetails, tenantDetails: TenantDetails): InferenceScope
Parameters
- details
- InferenceDetails
The inference call details
- agentDetails
- AgentDetails
The agent details
- tenantDetails
- TenantDetails
The tenant details
Returns
A new InferenceScope instance
Inherited Method Details
dispose()
Legacy dispose method for compatibility
function dispose()
Inherited From OpenTelemetryScope.dispose
recordError(Error)
Records an error that occurred during the operation
function recordError(error: Error)
Parameters
- error
-
Error
The error that occurred
Inherited From OpenTelemetryScope.recordError
withActiveSpanAsync<T>(() => Promise<T>)
Makes this span active for the duration of the async callback execution
function withActiveSpanAsync<T>(callback: () => Promise<T>): Promise<T>
Parameters
- callback
-
() => Promise<T>
Returns
Promise<T>
Inherited From OpenTelemetryScope.withActiveSpanAsync