ExplainFormulaRequest Class
A request to explain the Excel formula.
Namespace: DevExpress.AIIntegration.Extensions
Assembly: DevExpress.AIIntegration.v24.2.dll
NuGet Package: DevExpress.AIIntegration
Declaration
Remarks
The following example registers an Azure OpenAI client to use the AI-powered extension to explain the excelFormula
:
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 excelFormula = "=F30*H30";
var response = await defaultAIExtensionsContainer.ExplainFormulaAsync(
new ExplainFormulaRequest(excelFormula)
);
Console.WriteLine(response);
/* Output:
* This Excel formula multiplies the value in cell F30 by the value in cell H30.
* For example, if cell F30 contains the number 5 and cell H30 contains the number 10,
* the formula will calculate 5 times 10, giving the result of 50.
*/
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});
}
Inheritance
Object
DevExpress.AIIntegration.Extensions.BaseRequest
TextRequest
ExplainFormulaRequest
See Also