Document Translator Agent

Document Translator Agent

The document translator agent is responsible for the communication with the user via the chat interface and to initialize the usage of tools to ask the user about information or to start the document translation procces.

Configuration

The configuration of the document translator agent consists of the following two parts

AgentConfig

Parameter

Description

Default

Parameter

Description

Default

historyTokenLimit

The number of tokens used from the history when calling the LLM.

400

languageModelName

The name of the language model to use for the agent.

"AZURE_GPT_4_TURBO_2024_0409"

proposedLanguagesForTranslation

The languages that the agent proposes to translate to.

["English", "Spanish", "French", "German", "Italian", "Portuguese","Dutch","Russian", "Swedish"]

Example

{ "historyTokenLimit": 400, "languageModelName": "AZURE_GPT_4_TURBO_2024_0409", "proposedLanguagesForTranslation": ["English", "Spanish", "French", "German", "Italian", "Portuguese","Dutch","Russian", "Swedish"], }

AgentPromptConfig

❗Only adjust prompts if you are fully familiar with the code logic. Small changes can break the module or reduce the output quality.

Parameter

Description

Parameter

Description

systemPromptTemplate

System prompt jinja2 template for document translation agent.

Default jinja2 Template

{% if file_types|length == 0 -%} Unfortunately at the moment the file translation feature has not been activated. If asked for for file translation inform the user about this, otherwise have a normal conversation with the user. {%- endif -%} {%- if file_types|length > 0 -%} Therefore, you must find out which uploaded documents they want to translate and to what language before starting the translation. If you cannot find the information from the conversation, nicely ask them to provide it or to upload a document. You have access to tools that can help you with these tasks, but use only one at the time elsewise it is complicated for the user. At the moment the following file types can be translated **Available file types for translation** {% for type in file_types -%} - {{ type }} {% endfor %} Thus, the files must end with an {%- if extensions|length > 1 -%} {{ ' ' ~ extensions[:-1] | join(', ') }} or {{ extensions[-1] }} {%- else -%} {{ ' ' ~ extensions[0] }} {%- endif %}. Mention the available file types if the user uploads other files. {% if uploaded_files|length == 0 -%} Currently the user has not uploaded any documents. {% elif uploaded_files|length == 1 -%} The only uploaded file is '{{ uploaded_files[0] }}' {% elif uploaded_files|length > 1 -%} The following list of documents was uploaded to the chat **Uploaded documents** {% for file in uploaded_files -%} - '{{ file }}' {% endfor %} {%- endif %} {%- endif -%}

Prompting instructions
On templating with jinja2. The systemPromptTemplate will be rendered with a specific set of variables in the code. The below table lists them so a user defined template can optionally use them.

Parameter

Description

Parameter

Description

file_types

A list of allowed file types as they are commonly refered to e.g. ["word", "excel"]

extensions

A list with the file extensions that the allowed files correspond to e.g. [".docx", ".xlsx"]

uploaded_files

A list of the names of the uploaded files

© 2024 Unique AG. All rights reserved. Privacy PolicyTerms of Service