Skip to content

11. Profiles

tetherscript edited this page Feb 8, 2025 · 14 revisions

A profile is a settings file that defines the type of translation service and the settings needed to use that service. You can create your own profile or modify an existing one. You can also code your own translation service type.

For AI services like OpenAI or LM Studio running locally, the host API is very similar, but there are differences, and further differences between the different models used. Some models can return json responsed. Some can do structured output. And some can provide reasoning.

A lot of prompt testing will be needed, and you ca use the Profile Editor for this.

This shows the profile editor for the OpenAI_gpt4_v1 profile. A translation test was attempted and you can see the results. The profile .prf file is also shown.

profileeditor1

image

Important

You don't need to use a paid AI API. You may be able to run a model locally, or use a legacy non-AI existing web service of some kind.

Preliminary testing on a local LM Studio with llama-3.2-1b-instruct has yielded impressive free, low latency results on a 8GB GTX1080. Judging how fast the AI field is innovating, local free near-perfect translations on typical PC hardware should be here very, very soon.

To code your own translation service, you only need to touch:

  • Edit \TranslatorEx\Translate.cs - add the name of your Translation Function here.
  • Add \TranslatorEx\YourTranslationService.cs

See the Loopback profile for the simplest example. It has no settings .prf file and only adds a $ prefix as the translated text.

Tip

If you are using AI, most of your time will be spent tweaking the prompts. Sometimes trying to get it to follow your rules and return only the translated text can require a lot of experimentation. Don't forget about the concepts of context (the models short term memory) which is why the OpenAI_1 function sends the prompt for every translated item. If we don't, we may exceed the context length and the model will forget what we were talking about.

We tried a batching approach, but you'd have to know the context length, calculate token consumption before translating, and responding to errors or resuming batches. It was super-complex and not worth it. Translation one-at-a-time is inexpensive, and fast-enough.

To test your profile, use the Translator's Profile Editor screen. This allows you to send one translation request to your profile and view the results.

Clone this wiki locally