Skip to main content
All docs
V24.2

CustomPromptRequest(String, String) Constructor

Initializes a new instance of the CustomPromptRequest class with specified settings.

Namespace: DevExpress.AIIntegration.Extensions

Assembly: DevExpress.AIIntegration.v24.2.dll

NuGet Package: DevExpress.AIIntegration

Declaration

public CustomPromptRequest(
    string prompt,
    string text
)

Parameters

Name Type Description
prompt String

The prompt. This value is assigned to the Prompt property.

text String

The text to be managed. This value is assigned to the Text property.

Remarks

The following example registers an Azure OpenAI client to use an AI-powered extension to transform originalText based on a custom prompt:

using Azure;
using Azure.AI.OpenAI;
using Microsoft.Extensions.AI;
using DevExpress.AIIntegration;
using DevExpress.AIIntegration.Extensions;

SetEnvironmentVariables();

// Register an Azure OpenAI client
AIExtensionsContainerDefault defaultAIExtensionsContainer = RegisterAzureOpenAIClient(
    Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT"),
    Environment.GetEnvironmentVariable("AZURE_OPENAI_APIKEY")
);

string originalText = "Specify the original text to transform...";
var response = await defaultAIExtensionsContainer.CustomPromptAsync(
    new CustomPromptRequest("Specify a prompt...", originalText)
);

Console.WriteLine(response);

AIExtensionsContainerDefault RegisterAzureOpenAIClient(string azureOpenAIEndpoint, string azureOpenAIKey) {
    IChatClient client = new AzureOpenAIClient(
        new Uri(azureOpenAIEndpoint),
        new AzureKeyCredential(azureOpenAIKey))
            .AsChatClient("gpt-4o-mini");
    return AIExtensionsContainerConsole.CreateDefaultAIExtensionContainer(client);
}

void SetEnvironmentVariables() {
    Environment.SetEnvironmentVariable("AZURE_OPENAI_ENDPOINT", {SPECIFY_YOUR_AZURE_ENDPOINT});
    Environment.SetEnvironmentVariable("AZURE_OPENAI_APIKEY", {SPECIFY_YOU_AZURE_KEY});
}
See Also