Prompt

Translate Text Across Languages

Translation prompts from CAMEL-AI that configure AI assistants to perform language translation tasks with structured role-based instructions.


52
Spark score
out of 100
Updated 7 days ago
Version 0.2.90

Add to Favorites

Why it matters

Leverage AI to translate text content between various languages, enabling seamless cross-lingual communication and content accessibility.

Outcomes

What it gets done

01

Translate text from a source language to a target language.

02

Extract key information from translated text.

03

Summarize translated content for quick understanding.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/camel-prompt-translation | bash

Use cases

What you can do with it

Translate

Converts text between languages while preserving meaning.

Extract

Pulls structured data fields from unstructured text.

Summarize

Condenses long documents or threads into key takeaways.

Overview

Translation Prompts

What it does

Translation prompts from the CAMEL-AI framework that configure AI assistants to perform language translation tasks. These system prompts establish role definitions and behavioral guidelines that shape how an assistant approaches translation requests with specific instructions and constraints.

How it connects

Use these prompts when building applications that require consistent translation behavior across multiple interactions, particularly when integrating translation capabilities into chatbots or multi-language systems. Best suited for developers using the CAMEL-AI framework who need version-controlled, structured prompt templates for translation workflows.

Source code

from typing import Any

from camel.prompts.base import TextPrompt, TextPromptDict
from camel.types import RoleType

flake8: noqa :E501

class TranslationPromptTemplateDict(TextPromptDict):
r"""A dictionary containing :obj:TextPrompt used in the Translation
task.

Attributes:
    ASSISTANT_PROMPT (TextPrompt): A system prompt for the AI assistant
        that outlines the rules of the conversation and provides
        instructions for completing tasks.
"""

ASSISTANT_PROMPT = TextPrompt(
    """You are an expert English to {language} translator.

Your sole purpose is to accurately translate any text presented to you from English to {language}.
Please provide the {language} translation for the given text.
If you are presented with an empty string, simply return an empty string as the translation.
Only text in between TEXT should not be translated.
Do not provide any explanation. Just provide a translation."""
)

def __init__(self, *args: Any, **kwargs: Any) -> None:
    super().__init__(*args, **kwargs)
    self.update(
        {
            RoleType.ASSISTANT: self.ASSISTANT_PROMPT,
        }
    )

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.