ChangeStyleRequest.Style Property
Gets or sets a writing style that determines the tone and structure of text.
Namespace: DevExpress.AIIntegration.Extensions
Assembly: DevExpress.AIIntegration.v24.2.dll
NuGet Package: DevExpress.AIIntegration
#Declaration
public WritingStyle Style { get; set; }
#Property Value
Type | Description |
---|---|
Writing |
The writing style that determines the tone and structure of text. |
Available values:
Name | Description |
---|---|
Formal | A style that follows conventional rules of grammar and syntax, with a serious and respectful tone. |
Informal | A casual and conversational style for everyday communication. |
Technical | A style that conveys complex and specialized information. |
Business | A style for corporate communications, including emails, reports, and proposals. |
Creative | A free-form style that emphasizes originality and artistic expression. |
Journalistic | A concise and fact-based style. |
Academic | A formal, objective, and well-structured style. |
Persuasive | A style that aims to convince or influence the reader by presenting arguments. This style is used in marketing and speeches. |
Narrative | A style with a clear structure (beginning, middle, end). |
Expository | A style that explains or informs the reader about a topic. |
Descriptive | A style that uses detailed descriptions of people, places, objects, or events to create vivid imagery. |
Conversational | A casual style that is used in blogs or other informal writing. |
#Remarks
The following example registers an Azure OpenAI client and uses the AI-powered extension to change the writing style of originalText
:
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 = "DevExpress released Universal v24.2 - the award-winning software development platform for .NET and Visual Studio developers.";
var response = await defaultAIExtensionsContainer.ChangeStyleAsync(
new ChangeStyleRequest(originalText, WritingStyle.Academic)
);
Console.WriteLine(response);
/* Output:
* DevExpress has announced the release of Universal v24.2, an acclaimed software development platform
* designed specifically for .NET and Visual Studio developers.
*/
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});
}