blazor-devexpress-dot-aiintegration-dot-blazor-dot-chat-dot-dxaichat-b7cdefc7.md
Specifies whether the AI Chat displays basic details about an invoked function.
Namespace : DevExpress.AIIntegration.Blazor.Chat
Assembly : DevExpress.AIIntegration.Blazor.Chat.v25.2.dll
NuGet Package : DevExpress.AIIntegration.Blazor.Chat
[Parameter]
public bool IncludeFunctionCallInfo { get; set; }
| Type | Description |
|---|---|
| Boolean |
true to display function call details; otherwise, false.
|
Enable the IncludeFunctionCallInfo property to automatically append basic details about each invoked function into the AI chat response:
The name or unique identifier of the invoked function (AI tool).
Arguments passed to the function.
The return value.
@using DevExpress.AIIntegration.Blazor.Chat
@using DevExpress.AIIntegration.Tools
@inject AIToolsContextContainer aiToolsContextContainer
<DxAIChat IncludeFunctionCallInfo="true" />
@code {
protected override void OnAfterRender(bool firstRender) {
if(firstRender) {
var context = new AIToolsContextBuilder()
.WithToolMethods(MyAITools.Greet, MyAITools.AddNumbers)
.Build();
aiToolsContextContainer.Add(context);
}
}
}
using DevExpress.AIIntegration;
using System.ComponentModel;
public class MyAITools
{
[AIIntegrationTool("Generic_Greeting")]
[Description("Greets a user with their name.")]
public static string Greet(
[Description("The name of the user.")] string name) {
var now = DateTime.Now;
if(now.Hour < 7)
return $"Good night, {name}!";
else if(now.Hour < 12)
return $"Good morning, {name}!";
else if(now.Hour < 18)
return $"Good afternoon, {name}!";
else
return $"Good evening, {name}!";
}
[AIIntegrationTool("Generic_Calculator")]
[Description("Adds two numbers.")]
public static int AddNumbers(
[Description("First number")] int a,
[Description("Second number")] int b) {
return a + b;
}
}
using Azure.AI.OpenAI;
using DevExpress.AIIntegration;
using DxAI.Components;
using Microsoft.Extensions.AI;
using System.ClientModel;
/* ... */
string azureOpenAiKey = Environment.GetEnvironmentVariable("AZURE_OPENAI_KEY")
?? throw new InvalidOperationException("AZURE_OPENAI_KEY environment variable is not set.");
string azureOpenAiEndpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")
?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT environment variable is not set.");
string azureOpenAiModel = Environment.GetEnvironmentVariable("AZURE_OPENAI_MODEL")
?? throw new InvalidOperationException("AZURE_OPENAI_MODEL environment variable is not set.");
AzureOpenAIClient azureOpenAIClient = new(
new Uri(azureOpenAiEndpoint),
new ApiKeyCredential(azureOpenAiKey)
);
IChatClient azureOpenAIChatClient = azureOpenAIClient.GetChatClient(azureOpenAiModel).AsIChatClient();
/** Register scoped chat client with DevExpress AI tool calling */
builder.Services.AddScoped((sp) => {
return azureOpenAIChatClient.AsBuilder()
.UseDXTools()
.UseFunctionInvocation()
.Build(sp);
});
/** Register DevExpress AI services */
builder.Services.AddDevExpressAI();
/** Register DevExpress Blazor services */
builder.Services.AddDevExpressBlazor();
Use this property to test and debug AI tools during development. For production purposes, we recommend that you define a custom message template and use the FunctionCalls property to limit showing information like raw technical data to users.
See Also