Del via


FunctionInvokingRealtimeClient Class

Definition

A delegating realtime client that invokes functions defined on CreateResponseRealtimeClientMessage. Include this in a realtime client pipeline to resolve function calls automatically.

public ref class FunctionInvokingRealtimeClient sealed : Microsoft::Extensions::AI::DelegatingRealtimeClient
[System.Diagnostics.CodeAnalysis.Experimental("MEAI001", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")]
public sealed class FunctionInvokingRealtimeClient : Microsoft.Extensions.AI.DelegatingRealtimeClient
public sealed class FunctionInvokingRealtimeClient : Microsoft.Extensions.AI.DelegatingRealtimeClient
[<System.Diagnostics.CodeAnalysis.Experimental("MEAI001", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")>]
type FunctionInvokingRealtimeClient = class
    inherit DelegatingRealtimeClient
type FunctionInvokingRealtimeClient = class
    inherit DelegatingRealtimeClient
Public NotInheritable Class FunctionInvokingRealtimeClient
Inherits DelegatingRealtimeClient
Inheritance
FunctionInvokingRealtimeClient
Attributes

Remarks

When sessions created by this client receive a FunctionCallContent in a realtime server message from the inner IRealtimeClientSession, they respond by invoking the corresponding AIFunction defined in Tools (or in AdditionalTools), producing a FunctionResultContent that is sent back to the inner session. This loop is repeated until there are no more function calls to make, or until another stop condition is met, such as hitting MaximumIterationsPerRequest.

Constructors

Name Description
FunctionInvokingRealtimeClient(IRealtimeClient, ILoggerFactory, IServiceProvider)

Initializes a new instance of the FunctionInvokingRealtimeClient class.

Properties

Name Description
AdditionalTools

Gets or sets a collection of additional tools the session is able to invoke.

AllowConcurrentInvocation

Gets or sets a value indicating whether to allow concurrent invocation of functions.

CurrentContext

Gets the FunctionInvocationContext for the current function invocation.

FunctionInvoker

Gets or sets a delegate used to invoke AIFunction instances.

IncludeDetailedErrors

Gets or sets a value indicating whether detailed exception information should be included in the response when calling the underlying IRealtimeClientSession.

InnerClient

Gets the inner IRealtimeClient.

(Inherited from DelegatingRealtimeClient)
MaximumConsecutiveErrorsPerRequest

Gets or sets the maximum number of consecutive iterations that are allowed to fail with an error.

MaximumIterationsPerRequest

Gets or sets the maximum number of iterations per request.

TerminateOnUnknownCalls

Gets or sets a value indicating whether a request to call an unknown function should terminate the function calling loop.

Methods

Name Description
CreateSessionAsync(RealtimeSessionOptions, CancellationToken)

Creates a new real-time session with the specified options.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(Inherited from DelegatingRealtimeClient)
Dispose(Boolean)

Provides a mechanism for releasing unmanaged resources.

(Inherited from DelegatingRealtimeClient)
GetService(Type, Object)

Asks the IRealtimeClient for an object of the specified type serviceType.

(Inherited from DelegatingRealtimeClient)

Extension Methods

Name Description
AsBuilder(IRealtimeClient)

Creates a new RealtimeClientBuilder using innerClient as its inner client.

GetRequiredService(IRealtimeClient, Type, Object)

Asks the IRealtimeClient for an object of the specified type serviceType and throws an exception if one isn't available.

GetRequiredService<TService>(IRealtimeClient, Object)

Asks the IRealtimeClient for an object of type TService and throws an exception if one isn't available.

GetService<TService>(IRealtimeClient, Object)

Asks the IRealtimeClient for an object of type TService.

Applies to