all Technical posts

Adding Azure Translate to Your Semantic Kernel Copilot

In this blog post, I will explore how to seamlessly integrate Azure Translate into your Semantic Kernel Copilot, enhancing its ability to handle multilingual conversations with precision.

Once the Translator client is initialized, you can create plugin functions to translate the text. To call the translation API, you traditionally needed three arguments: the source language, the target language, and the text to translate. However, with the Translator client’s Translate method, it now automatically calls the detect language API endpoint to determine the language of the original text. This means that specifying the source language is no longer necessary for our plugin, simplifying the integration, as we no longer need to request the original language from the user. This enhancement streamlines the translation process, making it more user-friendly and efficient.

Now that our plugin is operational within the Semantic Kernel, we can utilize it after analyzing the user’s question to determine if translation is necessary. If so, the plugin becomes one of the potential pathways to execute. The example below illustrates a simple program that allows us to test various questions and assess the outcomes. This practical approach enables us to fine-tune the plugin’s performance and ensure it meets the user’s translation needs effectively.

Running some examples gives the following results:

The plugin is now primed for integration with our Copilot, where it can swiftly perform translations of text within the user’s question, as well as of the previous responses provided by the chatbot. This enhancement allows for seamless, real-time translation, enriching the user experience by ensuring clear and accurate communication.

With the translator plugin, our chatbot can swiftly execute text translations, enhancing accuracy and speed. While the chatbot currently excels in translating individual queries and responses, I’m exploring the possibility of extending its capabilities to include full document translations. For instance, documents located on SharePoint or in a storage account could be translated. This would involve leveraging the Document Translation feature of the Azure Translate service. However, due to the potential time required for such translations, it might be necessary to run the process asynchronously to avoid prolonged wait times for the user.

I’m considering various approaches to address these challenges and provide efficient solutions for comprehensive document translations. Let’s see what I come up with!

Subscribe to our RSS feed

Talk to the author

Contact Steven

IoT Data & AI Domain Lead - Data & AI Solution Architect

Hi there,
how can we help?

Got a project in mind?

Connect with us

Let's talk

Let's talk

Thanks, we'll be in touch soon!

Call us

Thanks, we've sent the link to your inbox

Invalid email address

Submit

Your download should start shortly!

Stay in Touch - Subscribe to Our Newsletter

Keep up to date with industry trends, events and the latest customer stories

Invalid email address

Submit

Great you’re on the list!