Skip to main content
All docs
V26.1
  • PromptToReportRequest.ReportGenerationHost Property

    Specifies a host that handles prompt clarifications and progress updates.

    Namespace: DevExpress.AIIntegration.Reporting.Common.Extensions

    Assembly: DevExpress.AIIntegration.Reporting.Common.v26.1.dll

    Declaration

    public IAIReportGenerationHost ReportGenerationHost { get; set; }

    Property Value

    Type Description
    IAIReportGenerationHost

    A host implementation that supplies interaction callbacks for generation.

    Remarks

    Assign this property when the generation workflow should ask clarification questions and send status updates during report generation.

    The following code sample initializes an AI client, creates a report request, and generates a report based on a user prompt:

    View Example: DevExpress Reports - Generate a Report Based on a User Prompt Within a Console App

    using Reporting.Generation.Console;
    using Azure.AI.OpenAI;
    using System.ClientModel;
    using Microsoft.Extensions.AI;
    using DevExpress.AIIntegration.Reporting.Common.Extensions;
    using DevExpress.AIIntegration;
    using DevExpress.XtraReports.UI;
    
    // Retrieve the Azure OpenAI endpoint, key, and model from user environment variables.
    string endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT", EnvironmentVariableTarget.User) ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");
    string apiKey = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY", EnvironmentVariableTarget.User) ?? throw new InvalidOperationException("AZURE_OPENAI_API_KEY is not set.");
    string deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT", EnvironmentVariableTarget.User) ?? "gpt-5.2";
    
    // Create an Azure OpenAI client to work with the chat agent.
    IChatClient chatClient = new AzureOpenAIClient(new Uri(endpoint), new ApiKeyCredential(apiKey))
        .GetChatClient(deploymentName)
        .AsIChatClient();
    
    // Register chat client and reporting extensions.
    AIExtensionsContainerDefault container = AIExtensionsContainerConsole.CreateDefaultAIExtensionContainer(chatClient);
    container.RegisterReportingExtensions();
    
    // Ask the user for a report description in natural language.
    Console.WriteLine("Specify a prompt to generate the report:");
    string prompt = Console.ReadLine();
    try {
        // Create a host to handle clarification questions and progress notifications.
        ConsoleAIReportGenerationHost host = new ConsoleAIReportGenerationHost();
    
        // Build a generation request from the user prompt.
        PromptToReportRequest generationRequest = new PromptToReportRequest(userPrompt: prompt, dataSourceSchema: null, report: null) {
            ReportGenerationHost = host,
            FixLayoutErrors = true
        };
    
        // Generate a report layout and save it to a REPX file.
        XtraReport report = await container.GeneratePromptToReportAsync(generationRequest, default);
        report.SaveLayoutToXml("generatedReport.repx");
    }
    catch(Exception ex) {
        Console.ForegroundColor = ConsoleColor.Red;
        Console.WriteLine(ex.Message);
        Console.ResetColor();
        Console.WriteLine();
    }
    
    Console.ReadLine();
    
    See Also