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.Temperature Property

    Specifies the balance between creativity and consistency in AI responses.

    Namespace: DevExpress.AIIntegration.Blazor

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

    Declaration

    [Parameter]
    public float? Temperature { get; set; }

    Property Value

    Type Description
    Nullable<Single>

    A nullable value between 0 and 1 or 2, depending on the AI behavior and model.

    Remarks

    Use the Temperature property to specify the balance between creativity and consistency in AI responses. Lower values make output more focused and deterministic, while higher values increase randomness and creativity.

    The following code snippet adds the Smart Paste extension to a Form Layout component and sets the Temperature property to 0.7f:

    @using DevExpress.AIIntegration.Blazor
    @using DevExpress.AIIntegration.Blazor.Layout
    @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"
                                  Temperature="0.7f" />
        </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