The following project integrates AI capabilities into a DevExpress-powered Office File API Web API application. This project uses the following AI services:
- OpenAI API generates descriptions for images, charts and hyperlinks in Microsoft Word and Excel files.
- Azure AI Language API detects the language for text paragraphs in Word files.
- Azure AI Translator API translates paragraph text to the chosen language in Word files.
Note
Before you incorporate this solution in your app, please be sure to read and understand terms and conditions of using AI services.
The project uses the Azure.AI.OpenAI, Azure.AI.TextAnalytics and Azure.AI.Translation.Text NuGet packages. Azure.AI.OpenAI adapts OpenAI's REST APIs for use in non-Azure OpenAI development. Azure.AI.TextAnalytics and Azure.AI.Translation.Text require an Azure subscription. Once you obtain it, create a Language resource and a Translator resource (or a single multi-service resource) in the Azure portal to get your keys and endpoints for client authentication.
OpenAIController
includes endpoints to generate image, chart and hyperlink descriptions. The OpenAIClientImageHelper
class sends a request to describe an image and obtains a string with a response. The OpenAIClientHyperlinkHelper
class sends a request to describe an hyperlink and obtains a string with a response. The OpenAIClientImageHelper.DescribeImageAsync
and OpenAIClientHyperlinkHelper.DescribeHyperlinkAsync
methods are executed within the corresponding endpoints.
For Excel files, charts are converted to images to obtain relevant descriptions.
LanguageController
includes the endpoint to detect the language for text paragraphs and generate paragraph transaltions. The AzureAILanguageHelper
class sends a request to detect the language of the specified text and returns the language name in the "ISO 693-1" format. The AzureAITranslationHelper
class sends a request to translate the given text to the specified language and returns the transaled text string. The AzureAILanguageHelper.DetectTextLanguage
and AzureAITranslationHelper.TranslateText
methods are executed in the GenerateLanguageSettingsForParagraphs
endpoint.
- OpenAIController.cs
- LanguageController.cs
- OpenAIClientImageHelper.cs
- OpenAIClientHyperlinkHelper.cs
- AzureAILanguageHelper.cs
- AzureAITranslationHelper.cs
- Helpers.cs
- Office File API — Enhance Accessibility in Office Documents (Word & Excel) using OpenAI Models
- Office File API — Enhance Accessibility in Office Documents using OpenAI Models (Part 2)
(you will be redirected to DevExpress.com to submit your response)