Plugin: AI (OpenAI v2)

This plugin enables sending prompt requests to OpenAI, targeting either OpenAI cloud or Azure AI resources. It utilizes the OpenAI API v2 and the ChatCompletion client.

Provider URL: OpenAI

Class: LTGear.Flowme.Plugin.MT.OpenAI2.Translate

Pipeline Format: XLIFF (MT)

Parameters

  • ApiKey: API key to access OpenAI.

  • WriteTo: Specifies whether to write the OpenAI result to the source or target. Note that the prompt should be defined accordingly. Allowed values: Source or Target.

  • SystemPrompt: System Prompt, to provide context to Model. Allowed placeholders are {sourceLanguage}, {targetLanguage}.

  • Prompt: The prompt to ask the OpenAI chat. Allowed placeholders are: {sourceLanguage}, {targetLanguage}, {sourceText}, and {targetText}.

  • Temperature (Optional): Temperature 0-1.0, Higher number means more creative output, lower more deterministic. For translation recommendation is 0-0.2. If not specified defaults to 1.

  • ModelName (Optional): Specific for OpenAI cloud. Name of the model.

  • ForceStructuredOutput (Optional): YES/NO. Set to YES if your model supports structured output. When not specified it defaults to NO. The JSON schema is following:

{
  "type": "object",
  "properties": {
    "finalAnswer": {
      "type": "string"
    }
  },
  "required": [ "finalAnswer" ],
  "additionalProperties": false
}
  • AzureResourceName (Optional): Specific for Azure OpenAI. The name of your Azure OpenAI Resource.

  • AzureDeploymentName (Optional): Specific for Azure OpenAI. The deployment name you chose when you deployed the Azure OpenAI model.

Usage Examples

Sample 1: Using Azure Cloud model

ApiKey: your-azure-api-key
AzureResourceName: your-azure-resource-name
AzureDeploymentName: your-azure-deployment-name
SystemPropmt: You are a professional machine translation system.
              Translate the user-provided text from {sourceLanguage} into {targetLanguage}.
              Maintain meaning, style, and tone while producing natural, fluent output.
              Do not add explanations, comments, or formatting.
              If structured output is enabled, return the translation strictly inside the expected JSON field.
              If structured output is not enabled, return only the translated text.

Prompt: Translate the following text from {sourceLanguage} into {targetLanguage}:

        {sourceText}
WriteTo: Target

Sample 2: Using OpenAI cloud model

ApiKey: your-OpenAI-api-key
ModelName: your-model-name
SystemPropmt: You are a professional machine translation system.
              Translate the user-provided text from {sourceLanguage} into {targetLanguage}.
              Maintain meaning, style, and tone while producing natural, fluent output.
              Do not add explanations, comments, or formatting.
              If structured output is enabled, return the translation strictly inside the expected JSON field.
              If structured output is not enabled, return only the translated text.

Prompt: Translate the following text from {sourceLanguage} into {targetLanguage}:
WriteTo: Target