npm i generaltranslation
Internationalize instantly ⚡
Just write your prompt and that's it.
General Translation offers low-latency prompt translation and caching, letting your AI apps support dozens of languages stress-free.
Get Started, or see Pricing
import GT from 'generaltranslation'
const gt = new GT({
apiKey: process.env.GT_API_KEY // your API key
});
async function main() {
const prompt = 'Write me a story about ';
const input = 'gatos con espadas';
const translatedPrompt = await gt.getPrompt([
prompt, { text: input, translate: false }
], 'es');
console.log(translatedPrompt); // 'Escríbeme una historia sobre gatos con espadas'
};
main()
Read the docs.
Can my AI model understand ?
Use the generaltranslation
JavaScript toolkit to get data on which LLMs speak which languages. Language information is completely free and requires no API key.
import { getModelLanguages } from 'generaltranslation'
async function main() {
const languages = await getModelLanguages('gpt-4-turbo')
console.log(languages) // ['en', 'fr', ... ]
}
main()
Read the docs.