LLM

Extra options for Large Language Model (LLM)

1. Conversation memory

Stores conversation memory and utilizes it in API requests. You can customize the initial prompt to your preferences and set the maximum number of conversations that can be stored.

  • Import from JSON file Fill in with the path of the JSON file to be imported

  • Data Source Selection:

    • Translation Memory Retrieves conversation data from the most recent Translation Memory

    • New Translation / New Request Starts a new conversation each time it begins

    • JSON File imports from a JSON file in the "Import from JSON file" field

  • Max Conversation Entries Maximum stored conversation data

API Variables:

  • $MT::ConversationMemory.Entries::ToArray()

Example in OpenAI GPT:

Initial prompt:

You will be provided with a sentence in Japanese,
and your task is to translate it into English accurately.
if there are any cultural references or nuances within the text, 
kindly provide a brief explanation or context for those as well. 
The text is as follows:

System template:

[{"role": "system", "content": "$PROMPT"}]

User template:

[{"role": "user", "content": "$ORIGINAL_TEXT"}]

Assistant template:

[{"role": "assistant", "content": "$TRANSLATED_TEXT"}]

Custom MT:

{
  "version": "2",
  "service": "openai",
  "lang": {
    "source": [
      { "name": "Custom", "value": "Custom" },
    ],
    "target": [
      { "name": "Custom", "value": "Custom" },
    ]
  },
  "config": {
    "method": "post",
    "encodeURI": false,
    "encodeURIComponent": false,
    "postURL": "https://api.openai.com/v1/chat/completions",
    "postData": {
      "model": "gpt-3.5-turbo",	  
      "messages": "$MT::ConversationMemory.Entries::ToArray()",	  
      "temperature": 0.9,
      "max_tokens": 4096,
      "top_p": 1,
      "frequency_penalty": 0.7,
      "presence_penalty": 0.7
    },
    "postOptions": {
      "headers": {
        "Authorization": "Bearer [YOUR_API_KEY_HERE]",
        "Content-Type": "application/json"
      }
    },
    "responseParse": true,
    "responseType": "json",
    "responseQuery": "choices[0].message.content"
  }
}

Last updated