Tool

Translate Text Using Azure

LlamaIndex tool that lets an agent translate text into a target language via Azure's Translator service.

Works with azureopenai

72
Spark score
out of 100
Updated 2 days ago
Version 0.14.23
Models

Add to Favorites

Why it matters

Integrate Azure's powerful translation capabilities into your applications. This tool allows agents to translate text into a variety of languages, enabling seamless multilingual communication and content localization.

Outcomes

What it gets done

01

Translate text to a target language using Azure.

02

Integrate translation functionality into an agent workflow.

03

Automate multilingual content generation.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-tool-tools-azure-translate | bash

Overview

Azure Translate Tool

The Azure Translate Tool wires Azure's Translator service into a LlamaIndex agent as a callable tool, exposing a single translate function that turns text into a target language. Use it when an agent needs to translate text mid-workflow. It requires an existing Azure AI Translator resource and API key.

What it does

The Azure Translate Tool connects to an Azure account and gives an agent the ability to translate text into a variety of different languages. It exposes a single translate function: translate text to a target language. It is meant to be used as a Tool wired into a LlamaIndex Agent (for example a FunctionAgent) rather than run as a standalone script.

When to use - and when NOT to

Use it when an agent needs to translate text as part of a larger workflow -- for example a multilingual FunctionAgent that fields prompts like "Say 'hello world' in 5 different languages." It requires an Azure API key and a Translator instance already set up in Azure, so it is not usable without an existing Azure AI Translator resource.

Inputs and outputs

Given text and a target language, the translate function returns the translated text. Setup requires an Azure api_key and region (for example eastus) passed to AzureTranslateToolSpec, which is then attached to an agent via to_tool_list():

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.azure_translate import AzureTranslateToolSpec

translate_tool = AzureTranslateToolSpec(api_key="your-key", region="eastus")

agent = FunctionAgent(
    tools=translate_tool.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)
print(await agent.run('Say "hello world" in 5 different languages'))

Who it's for

Developers building LlamaIndex agents that need multilingual output and already have, or are willing to set up, an Azure AI Translator resource.

Source README

Azure Translate Tool

This tool connects to a Azure account and allows an Agent to perform text translation into a variet of different languages

You will need to set up an api key and translate instance using Azure, learn more here: https://learn.microsoft.com/en-us/azure/ai-services/translator/translator-overview

For a full list of supported languages see here: https://learn.microsoft.com/en-us/azure/ai-services/translator/language-support

This tool has a more extensive example usage documented in a Jupyter notebook here

Usage

Here's an example usage of the AzureTranslateToolSpec.

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.azure_translate import AzureTranslateToolSpec

translate_tool = AzureTranslateToolSpec(api_key="your-key", region="eastus")

agent = FunctionAgent(
    tools=translate_tool.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)
print(await agent.run('Say "hello world" in 5 different languages'))

translate: Translate text to a target language

This loader is designed to be used as a way to load data as a Tool in a Agent.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.