Back to Devexpress

ReportPromptToReportBehavior Class

xtrareports-devexpress-dot-aiintegration-dot-wpf-dot-reporting.md

latest6.3 KB
Original Source

ReportPromptToReportBehavior Class

An AI-powered Prompt-to-Report functionality that uses natural language processing to build reports based on text descriptions.

Namespace : DevExpress.AIIntegration.Wpf.Reporting

Assembly : DevExpress.AIIntegration.Wpf.Reporting.v25.2.dll

NuGet Package : DevExpress.AIIntegration.Wpf.Reporting

Declaration

csharp
public class ReportPromptToReportBehavior :
    ReportDesignerBehaviorBase
vb
Public Class ReportPromptToReportBehavior
    Inherits ReportDesignerBehaviorBase

Remarks

Use the following properties to specify behavior’s settings:

FixLayoutErrorsSpecifies whether to automatically resolve overlapping report controls.PredefinedPromptsSpecifies predefined prompts that can be used to create a report in the Report Wizard.RetryAttemptCountSpecifies the number of attempts to fix report layout errors that may appear in the LLM response.TemperatureGets or sets the balance between creativity and consistency in AI responses. Higher values increase variation.PromptAugmentationSpecifies additional instructions that modify the prompt before processing.

Attach the ReportPromptToReportBehavior to the WPF Report Designer to enable AI-powered Prompt-to-Report functionality:

Markup:

xaml
xmlns:dxrud="http://schemas.devexpress.com/winfx/2008/xaml/reports/userdesigner" 
xmlns:dxai="http://schemas.devexpress.com/winfx/2008/xaml/ai" 
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm" 
xmlns:reporting="clr-namespace:DevExpress.AIIntegration.Reporting;assembly=DevExpress.AIIntegration.Reporting.Common.v25.2" 
... 
<dxrud:ReportDesigner x:Name="designer">
    <dxmvvm:Interaction.Behaviors>
        <dxai:ReportPromptToReportBehavior Temperature="0.6" RetryAttemptsCount="5" >
            <dxai:ReportPromptToReportBehavior.PredefinedPrompts>
                <reporting:AIReportPrompt Title="Custom Prompt" Text="Custom Text"/>
            </dxai:ReportPromptToReportBehavior.PredefinedPrompts>
        </dxai:ReportPromptToReportBehavior>
    </dxmvvm:Interaction.Behaviors>
</dxrud:ReportDesigner>

Code-Behind:

csharp
using DevExpress.AIIntegration.Wpf.Reporting;
using DevExpress.Mvvm.UI.Interactivity;
using DevExpress.AIIntegration.Reporting;
// ...
public partial class MainWindow : Window {
    public MainWindow() {
        InitializeComponent();
        ReportPromptToReportBehavior reportBehavior = new ReportPromptToReportBehavior();
        // Set the number of attempts.  
        reportBehavior.RetryAttemptCount = 5;
        // Specify output randomness.
        reportBehavior.Temperature = 0.6f;
        // Add a custom prompt to the collection.
        var collection = reportBehavior.PredefinedPrompts;
        AIReportPrompt customPrompt = new AIReportPrompt();
        customPrompt.Title = "Custom Prompt";
        customPrompt.Text = "Custom Text";
        collection.Add(customPrompt);
        reportBehavior.PredefinedPrompts = collection;
        // Attach the behavior.
        Interaction.GetBehaviors(designer).Add(reportBehavior);
    }
}
vb
Imports DevExpress.AIIntegration.Wpf.Reporting
Imports DevExpress.Mvvm.UI.Interactivity
Imports DevExpress.AIIntegration.Reporting
' ...
Partial Public Class MainWindow
    Inherits Window

    Public Sub New()
        InitializeComponent()
        Dim reportBehavior As New ReportPromptToReportBehavior()
        ' Set the number of attempts.  
        reportBehavior.RetryAttemptCount = 5
        ' Specify output randomness.
        reportBehavior.Temperature = 0.6F
        ' Add a custom prompt to the collection.
        Dim collection = reportBehavior.PredefinedPrompts
        Dim customPrompt As New AIReportPrompt()
        customPrompt.Title = "Custom Prompt"
        customPrompt.Text = "Custom Text"
        collection.Add(customPrompt)
        reportBehavior.PredefinedPrompts = collection
        ' Attach the behavior.
        Interaction.GetBehaviors(designer).Add(reportBehavior)
    End Sub
End Class

Review the following help topic for more information on how to use this functionality in the WPF Report Designer: Prompt to Report Behavior in the WPF Report Designer (CTP).

Inheritance

Show 11 items

Object DispatcherObject DependencyObject Freezable Animatable DevExpress.Mvvm.UI.Interactivity.AttachableObjectBase DevExpress.Mvvm.UI.Interactivity.Behavior DevExpress.Mvvm.UI.Interactivity.Behavior<DependencyObject> DevExpress.AIIntegration.Wpf.Internal.AIBehavior ReportDesignerBehaviorBase ReportPromptToReportBehavior

See Also

ReportPromptToReportBehavior Members

DevExpress.AIIntegration.Wpf.Reporting Namespace