Translation
The translation models plamo-3.0-translate and plamo-3.0-translate-trial translate without any special prompt. Put the source text in the last user message of messages, and the target language in target_lang of chat_template_kwargs. 53 languages are supported, including Japanese and English (Supported Languages). The other request parameters are the same as Chat Completions.
Request
bash
# Put the source text in the last user message and the target language in target_lang
$ curl \
-H "Authorization: Bearer ${PLAMO_API_KEY}" \
-H "Content-Type: application/json" \
"https://api.platform.preferredai.jp/v1/chat/completions" \
-d @- << EOF
{
"model": "plamo-3.0-translate",
"messages": [
{"role": "user", "content": "プロジェクトの管理画面を開いてください。"}
],
"chat_template_kwargs": {"source_lang": "ja", "target_lang": "en"},
"temperature": 0
}
EOFbash
# Earlier source (user) and translation (assistant) pairs keep terms and style consistent; only the last user message is translated
$ curl \
-H "Authorization: Bearer ${PLAMO_API_KEY}" \
-H "Content-Type: application/json" \
"https://api.platform.preferredai.jp/v1/chat/completions" \
-d @- << EOF
{
"model": "plamo-3.0-translate",
"messages": [
{"role": "user", "content": "プロジェクトの管理画面を開きます。"},
{"role": "assistant", "content": "Open the project dashboard."},
{"role": "user", "content": "進行中のタスクがすべて表示されます。"},
{"role": "assistant", "content": "It lists all active tasks."},
{"role": "user", "content": "オーナーでフィルタリングすることもできます。"}
],
"chat_template_kwargs": {"source_lang": "ja", "target_lang": "en"},
"temperature": 0
}
EOFbash
# Put the background of the source text in context and terms with fixed translations in glossary
$ curl \
-H "Authorization: Bearer ${PLAMO_API_KEY}" \
-H "Content-Type: application/json" \
"https://api.platform.preferredai.jp/v1/chat/completions" \
-d @- << EOF
{
"model": "plamo-3.0-translate",
"messages": [
{"role": "user", "content": "オーナーでフィルタリングすることもできます。"}
],
"chat_template_kwargs": {
"source_lang": "ja",
"target_lang": "en",
"context": "プロジェクト管理ツールのヘルプページです。",
"glossary": [{"source": "オーナー", "target": "assignee"}]
},
"temperature": 0
}
EOFbash
# When translating into Japanese, choose plain or polite style with form
$ curl \
-H "Authorization: Bearer ${PLAMO_API_KEY}" \
-H "Content-Type: application/json" \
"https://api.platform.preferredai.jp/v1/chat/completions" \
-d @- << EOF
{
"model": "plamo-3.0-translate",
"messages": [
{"role": "user", "content": "Click Save to apply your changes."}
],
"chat_template_kwargs": {"source_lang": "en", "target_lang": "ja", "form": "polite"},
"temperature": 0
}
EOFpython
from openai import OpenAI
client = OpenAI(base_url="https://api.platform.preferredai.jp/v1")
# With the OpenAI SDK, put chat_template_kwargs in extra_body
completion = client.chat.completions.create(
model="plamo-3.0-translate",
messages=[
# Earlier source texts and their translations
{"role": "user", "content": "プロジェクトの管理画面を開きます。"},
{"role": "assistant", "content": "Open the project dashboard."},
{"role": "user", "content": "進行中のタスクがすべて表示されます。"},
{"role": "assistant", "content": "It lists all active tasks."},
# Source text to translate
{"role": "user", "content": "オーナーでフィルタリングすることもできます。"},
],
temperature=0,
extra_body={
"chat_template_kwargs": {
"source_lang": "ja",
"target_lang": "en",
"context": "プロジェクト管理ツールのヘルプページです。",
"glossary": [{"source": "オーナー", "target": "assignee"}],
}
},
)
print(completion.choices[0].message.content)
# Example output: You can also filter by assignee.messagesmust start withuser, alternate betweenuserandassistant, and end withuser.systemcannot be used asrole.- If
max_tokensis omitted, it is 1.5 × the number of input tokens + 256. - Input and output tokens are limited to 32,768 in total; output beyond that is cut off.
chat_template_kwargs
| Key | Type | Required | Description |
|---|---|---|---|
| target_lang | string | required | The language code of the target language (Supported Languages). |
| source_lang | string | optional | The language code of the source text. If omitted, the model decides. |
| context | string | optional | Context for interpreting the source text, such as the surrounding text or a description of the situation. |
| glossary | array of object | optional | A glossary. List {"source": "source term", "target": "translation"} for each term. Each entry must contain only source and target. |
| form | string | optional | The style of a Japanese translation: plain (da/dearu) or polite (desu/masu). Only with target_lang ja. |
contextis used as context for all ofmessages.glossaryandformapply only when translating thecontentof the lastusermessage.- Write language codes in lowercase (e.g.
zh-hans). Region subtags such asen-USare not supported. - A 400 error is returned in the following cases.
target_langis missing, or a language code is malformed.- There is a
systemmessage. messagesdoes not end withuser.userandassistantdo not alternate.toolsis specified.contentis an empty string.sourceortargetinglossaryis an empty string.- A message or a value in
chat_template_kwargscontains<|plamo:.
Supported Languages
| Language | Code | Language | Code |
|---|---|---|---|
| Japanese | ja | English | en |
| Chinese (Simplified) | zh-hans | Chinese (Traditional) | zh-hant |
| Korean | ko | Arabic | ar |
| Azerbaijani | az | Belarusian | be |
| Bulgarian | bg | Bengali | bn |
| Catalan | ca | Cebuano | ceb |
| German | de | Spanish | es |
| Estonian | et | Basque | eu |
| Persian | fa | French | fr |
| Gujarati | gu | Hebrew | he |
| Hindi | hi | Croatian | hr |
| Hungarian | hu | Armenian | hy |
| Indonesian | id | Italian | it |
| Javanese | jv | Georgian | ka |
| Kazakh | kk | Khmer | km |
| Lithuanian | lt | Latvian | lv |
| Malayalam | ml | Marathi | mr |
| Malay | ms | Burmese | my |
| Nepali | ne | Dutch | nl |
| Punjabi | pa | Polish | pl |
| Russian | ru | Sinhala | si |
| Slovak | sk | Slovenian | sl |
| Serbian | sr | Swahili | sw |
| Tamil | ta | Telugu | te |
| Thai | th | Tagalog | tl |
| Urdu | ur | Uzbek | uz |
| Vietnamese | vi |
Models on Hugging Face
The model is published on Hugging Face as PLaMo 3 Translate, so you can also run it in your own environment. messages and chat_template_kwargs are processed with the chat template published on Hugging Face as is. For translation accuracy, refer to the tech blog.
