Skip to main content
All docs
V25.2
  • AIChatFunctionCall.Result Property

    Returns execution results of an AI-invoked function.

    Namespace: DevExpress.AIIntegration.Blazor.Chat

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

    NuGet Package: DevExpress.AIIntegration.Blazor.Chat

    Declaration

    public FunctionResultContent Result { get; set; }

    Property Value

    Type Description
    Microsoft.Extensions.AI.FunctionResultContent

    The function results.

    Remarks

    Access the execution results of an AI-invoked function from the MessageContentTemplate context. Refer to the FunctionResultContent class description for details.

    The following code snippet appends information about each invoked function to the AI chat response:

    @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