ScopeUtils class

Unified utilities to populate scope tags from a TurnContext.

Methods

buildInvokeAgentDetails(AgentDetails, TurnContextLike, string)

Build agent details by merging provided details with TurnContext.

deriveAgentDetails(TurnContextLike, string)

Derive target agent details from the activity recipient.

deriveCallerAgent(TurnContextLike)

Derive caller agent details from the activity from.

deriveCallerDetails(TurnContextLike)

Derive caller identity details (id, email, name, tenant) from the activity from.

deriveChannelObject(TurnContextLike)

Derive channel (name and description) from the TurnContext.

deriveConversationId(TurnContextLike)

Derive conversation id from the TurnContext.

populateExecuteToolScopeFromTurnContext(ToolCallDetails, TurnContextLike, string, TimeInput, TimeInput, SpanKind)

Create an ExecuteToolScope enriched with values from the TurnContext.

populateInferenceScopeFromTurnContext(InferenceDetails, TurnContextLike, string, TimeInput, TimeInput)

Create an InferenceScope enriched with values from the TurnContext.

populateInvokeAgentScopeFromTurnContext(AgentDetails, InvokeAgentScopeDetails, TurnContextLike, string, TimeInput, TimeInput, SpanKind)

Create an InvokeAgentScope enriched with values from the TurnContext.

Method Details

buildInvokeAgentDetails(AgentDetails, TurnContextLike, string)

Build agent details by merging provided details with TurnContext.

static function buildInvokeAgentDetails(details: AgentDetails, turnContext: TurnContextLike, authToken: string): AgentDetails

Parameters

details
AgentDetails
turnContext
TurnContextLike
authToken

string

Returns

deriveAgentDetails(TurnContextLike, string)

Derive target agent details from the activity recipient.

static function deriveAgentDetails(turnContext: TurnContextLike, authToken: string): AgentDetails | undefined

Parameters

turnContext
TurnContextLike
authToken

string

Returns

AgentDetails | undefined

deriveCallerAgent(TurnContextLike)

Derive caller agent details from the activity from.

static function deriveCallerAgent(turnContext: TurnContextLike): AgentDetails | undefined

Parameters

turnContext
TurnContextLike

Returns

AgentDetails | undefined

deriveCallerDetails(TurnContextLike)

Derive caller identity details (id, email, name, tenant) from the activity from.

static function deriveCallerDetails(turnContext: TurnContextLike): UserDetails | undefined

Parameters

turnContext
TurnContextLike

Returns

UserDetails | undefined

deriveChannelObject(TurnContextLike)

Derive channel (name and description) from the TurnContext.

static function deriveChannelObject(turnContext: TurnContextLike): { description?: string, name?: string }

Parameters

turnContext
TurnContextLike

Returns

{ description?: string, name?: string }

deriveConversationId(TurnContextLike)

Derive conversation id from the TurnContext.

static function deriveConversationId(turnContext: TurnContextLike): string | undefined

Parameters

turnContext
TurnContextLike

Returns

string | undefined

populateExecuteToolScopeFromTurnContext(ToolCallDetails, TurnContextLike, string, TimeInput, TimeInput, SpanKind)

Create an ExecuteToolScope enriched with values from the TurnContext.

static function populateExecuteToolScopeFromTurnContext(details: ToolCallDetails, turnContext: TurnContextLike, authToken: string, startTime?: TimeInput, endTime?: TimeInput, spanKind?: SpanKind): ExecuteToolScope

Parameters

details
ToolCallDetails
turnContext
TurnContextLike
authToken

string

startTime

TimeInput

endTime

TimeInput

spanKind

SpanKind

Returns

populateInferenceScopeFromTurnContext(InferenceDetails, TurnContextLike, string, TimeInput, TimeInput)

Create an InferenceScope enriched with values from the TurnContext.

static function populateInferenceScopeFromTurnContext(details: InferenceDetails, turnContext: TurnContextLike, authToken: string, startTime?: TimeInput, endTime?: TimeInput): InferenceScope

Parameters

turnContext
TurnContextLike
authToken

string

startTime

TimeInput

endTime

TimeInput

Returns

populateInvokeAgentScopeFromTurnContext(AgentDetails, InvokeAgentScopeDetails, TurnContextLike, string, TimeInput, TimeInput, SpanKind)

Create an InvokeAgentScope enriched with values from the TurnContext.

static function populateInvokeAgentScopeFromTurnContext(details: AgentDetails, scopeDetails: InvokeAgentScopeDetails, turnContext: TurnContextLike, authToken: string, startTime?: TimeInput, endTime?: TimeInput, spanKind?: SpanKind): InvokeAgentScope

Parameters

details
AgentDetails
turnContext
TurnContextLike
authToken

string

startTime

TimeInput

endTime

TimeInput

spanKind

SpanKind

Returns