Skip to main content
You are viewing help content for pre-release software. This document and the features it describes are subject to change.
All docs
V26.1
  • SmartPasteBase.PromptAugmentation Property

    Specifies additional instructions appended to the default Smart Paste prompt.

    Namespace: DevExpress.AIIntegration.Blazor

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

    Declaration

    [Parameter]
    public string PromptAugmentation { get; set; }

    Property Value

    Type Description
    String

    Instructions appended to the default Smart Paste prompt.

    Remarks

    The following code snippet adds a Smart Paste extension to a Form Layout component:

    • The snippet uses hard-coded text, but you can use a different source. For example, obtain text from the clipboard or from a file.
    • The extension’s ItemDescriptions property specifies formatting rules for the Phone Number field.
    • The extension’s PromptAugmentation property instructs AI to replace existing field values with extracted data.
    @using DevExpress.AIIntegration.Blazor.Layout
    @using DevExpress.AIIntegration.Blazor
    @using DevExpress.AIIntegration.Extensions
    
    <DxMemo @bind-Text="SampleText"
            Rows="14"
            ResizeMode="MemoResizeMode.Auto" />
    
    <DxFormLayout @ref="FormLayout"
                  Data="@model"
                  CssClass="w-100 mb-2">
        <Extensions>
            <FormLayoutSmartPaste ItemDescriptions="@fieldDescriptions"
                                  PromptAugmentation="@PromptAugmentation" />
        </Extensions>
        <ChildContent>
            <DxFormLayoutItem Caption="Full Name" ColSpanMd="12"
                              Field="@nameof(BillingFormModel.FullName)">
                <DxTextBox @bind-Text="@model.FullName"
                           NullText="Full Name" />
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Amount Due" ColSpanMd="12"
                              Field="@nameof(BillingFormModel.AmountDue)">
                <DxMaskedInput @bind-Value="@model.AmountDue"
                               Mask="@NumericMask.Currency"
                               NullText="$0.00" />
            </DxFormLayoutItem>
            <DxFormLayoutItem Caption="Statement Date" ColSpanMd="12"
                              Field="@nameof(BillingFormModel.StatementDate)">
                <DxDateEdit @bind-Date="@model.StatementDate"
                            NullText="MM/DD/YYYY" />
            </DxFormLayoutItem>
            @*...*@
        </ChildContent>
    </DxFormLayout>
    
    <DxButton Text="Smart Paste"
              IconCssClass="icon-ai-sparkle"
              RenderStyle="ButtonRenderStyle.Primary"
              Click="OnSmartPaste" />
    <DxButton Text="Reset"
              RenderStyle="ButtonRenderStyle.Secondary"
              Click="@OnResetClick" />
    
    @code {
        DxFormLayout FormLayout { get; set; }
        BillingFormModel model = new();
    
        readonly Dictionary<string, string> fieldDescriptions = new() {
            { nameof(BillingFormModel.PhoneNumber), "US phone number. 
            Return exactly 10 digits without any formatting characters."}
        };
    
        const string PromptAugmentation =
            "Always override the current field value with the extracted one.";
    
        string SampleText { get; set; } =
            "Hi there,\n" +
            " \n" +
            "Following up on billing for April. The balance should be twelve hundred " +
            "— it was adjusted after our last conversation.\n" +
            "I also moved recently. My new billing address is:\n" +
            "123 Market Street, San Francisco, CA 94103\n" +
            "You can keep using my email: john.smith@dx-email.com.\n" +
            "For phone, please use my mobile number going forward: 415-555-0199 " +
            "(not the office line).\n" +
            "The statement date should be mid-April.\n" +
            "Let me know if you need anything else.\n" +
            " \n" +
            "Best regards,\n" +
            "John Smith";
    
        async Task OnSmartPaste() {
            model.Reset();
            await FormLayout.SmartPasteAsync(SampleText);
        }
    
        void OnResetClick() {
            model.Reset();
        }
    }
    
    See Also