Skip to main content
All docs
V25.2
  • BlazorChatMessage.FunctionCalls Property

    Returns information on all functions invoked by the AI model.

    Namespace: DevExpress.AIIntegration.Blazor.Chat

    Assembly: DevExpress.AIIntegration.Blazor.Chat.v25.2.dll

    NuGet Package: DevExpress.AIIntegration.Blazor.Chat

    Declaration

    public List<AIChatFunctionCall> FunctionCalls { get; }

    Property Value

    Type Description
    List<AIChatFunctionCall>

    The collection of function calls.

    Remarks

    The FunctionCalls collection contains information about all functions invoked in response to an AI chat message. Use this information to build custom message templates.

    Note

    If the same function is called more than once, the FunctionCalls collection contains a distinct item for each call.

    The following code snippet appends function call information to the AI chat response. Details include the function name/unique identifier and the return value:

    @using DevExpress.AIIntegration.Blazor.Chat
    @using DevExpress.AIIntegration.Tools
    @inject AIToolsContextContainer aiToolsContextContainer
    
    <DxAIChat>
        <MessageContentTemplate>
            @context.Content
            @if(context.FunctionCalls.Count > 0) {
                <ul>
                    @foreach(var functionCall in context.FunctionCalls) {
                        <li>
                            Called function: <b>@functionCall.Request.Name</b><br />
                            Return value: <b>@functionCall.Result.Result.ToString()</b>
                        </li>
                    }
                </ul>
            }
        </MessageContentTemplate>
    </DxAIChat>
    
    @code {
        protected override void OnAfterRender(bool firstRender) {
            if(firstRender) {
                var context = new AIToolsContextBuilder()
                    .WithToolMethods(MyAITools.Greet, MyAITools.AddNumbers)
                    .Build();
                aiToolsContextContainer.Add(context);
            }
        }
    }
    

    AI Function Call

    See Also