# Prompt Templating

> Use Liquid templates in your prompts.

URL: https://store.crowdin.com/prompt-templating
Identifier: prompt-templating
Category: AI
Type: App
Author: Awesome Crowdin

The Prompt Templating app allows you to leverage Liquid templates for creating advanced and customizable prompts for AI translations.

**Key Features:**

 - More Flexible Templates: Provide a Liquid template that the app uses to generate prompts, allowing for highly customizable translation instructions. This is particularly useful if you are using a fine-tuned LLM model that expects the prompt to be in a particular format.
 
 - Conditional Logic: Liquid allows the use of conditions to specify instructions based on language, project files, or text groups, enhancing your control over the translation process.
 
 - Improved RAG: Enjoy a more flexible RAG approach than native Crowdin prompts.
 
  - Easy Integration: Once installed, you can select the Prompt Templating as your prompt provider when configuring prompts.
 
 - Default Template: The app includes a default template to help you get started, which can be used as a reference or boilerplate for creating custom templates.
 
 ## Payload example
 ```json
{
  "project": {
    "id": 462,
    "type": 0,
    "sourceLanguage": {
      "id": "en-US",
      "name": "English, United States",
      "twoLettersCode": "en",
      "threeLettersCode": "eng",
      "locale": "en-US",
      "pluralCategoryNames": [
        "one",
        "other"
      ],
      "pluralRules": "(n != 1)",
      "pluralExamples": [
        "1",
        "0, 2-999; 1.2, 2.07..."
      ],
      "textDirection": "ltr",
      "dialectOf": {
        "id": "en",
        "name": "English",
        "twoLettersCode": "en",
        "threeLettersCode": "eng",
        "locale": "en-US",
        "pluralCategoryNames": [
          "one",
          "other"
        ],
        "pluralRules": "(n != 1)",
        "pluralExamples": [
          "1",
          "0, 2-999; 1.2, 2.07..."
        ],
        "textDirection": "ltr",
        "dialectOf": null
      }
    },
    "targetLanguages": [
      {
        "id": "fr",
        "name": "French",
        "twoLettersCode": "fr",
        "threeLettersCode": "fra",
        "locale": "fr-FR",
        "pluralCategoryNames": [
          "one",
          "other"
        ],
        "pluralRules": "(n > 1)",
        "pluralExamples": [
          "0, 1",
          "2-999; 1.2, 2.07..."
        ],
        "textDirection": "ltr",
        "dialectOf": null
      },
      {
        "id": "pl",
        "name": "Polish",
        "twoLettersCode": "pl",
        "threeLettersCode": "pol",
        "locale": "pl-PL",
        "pluralCategoryNames": [
          "one",
          "few",
          "many",
          "other"
        ],
        "pluralRules": "(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3)",
        "pluralExamples": [
          "1",
          "2-4, 22-24, 32-34, 42-44, 52-54, 62...",
          "0, 5~19, 100, 1000, 10000...",
          "0.0-1.5, 10.0, 100.0, 1000.0..."
        ],
        "textDirection": "ltr",
        "dialectOf": null
      }
    ],
    "name": "spreadsheet-test",
    "description": "this project contains files from our mobile app, website and wubitlt files.",
    "fields": {
      "deadline": "2024-04-24"
    }
  },
  "sourceLanguage": {
    "id": "en-US",
    "name": "English, United States",
    "twoLettersCode": "en",
    "threeLettersCode": "eng",
    "locale": "en-US",
    "pluralCategoryNames": [
      "one",
      "other"
    ],
    "pluralRules": "(n != 1)",
    "pluralExamples": [
      "1",
      "0, 2-999; 1.2, 2.07..."
    ],
    "textDirection": "ltr",
    "dialectOf": {
      "id": "en",
      "name": "English",
      "twoLettersCode": "en",
      "threeLettersCode": "eng",
      "locale": "en-US",
      "pluralCategoryNames": [
        "one",
        "other"
      ],
      "pluralRules": "(n != 1)",
      "pluralExamples": [
        "1",
        "0, 2-999; 1.2, 2.07..."
      ],
      "textDirection": "ltr",
      "dialectOf": null
    }
  },
  "targetLanguage": {
    "id": "pl",
    "name": "Polish",
    "twoLettersCode": "pl",
    "threeLettersCode": "pol",
    "locale": "pl-PL",
    "pluralCategoryNames": [
      "one",
      "few",
      "many",
      "other"
    ],
    "pluralRules": "(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3)",
    "pluralExamples": [
      "1",
      "2-4, 22-24, 32-34, 42-44, 52-54, 62...",
      "0, 5~19, 100, 1000, 10000...",
      "0.0-1.5, 10.0, 100.0, 1000.0..."
    ],
    "textDirection": "ltr",
    "dialectOf": null
  },
  "strings": [
    {
      "id": 2533087,
      "text": "this {} is {} a test",
      "key": "identifier_2",
      "context": "asdfasdfa\n\n✨ AI Context\nUsed as the name of the CLI tool.\nUsed as a description for the '--type' option in a CLI command.\n✨ 🔚",
      "maxLength": 24,
      "pluralForm": null,
      "fields": []
    }
  ],
  "siblingsStrings": {
    "previous": {
      "id": 2533085,
      "text": "String for translation 1",
      "key": "identifier_1",
      "context": "identifier_1",
      "maxLength": 24,
      "fields": []
    },
    "next": {
      "id": 2533089,
      "text": "String for translation 3",
      "key": "identifier_3",
      "context": "identifier_3\n\n✨ AI Context\nthis is my ai context\n✨ 🔚",
      "maxLength": 24,
      "fields": []
    }
  },
  "filteredStrings": [
    {
      "id": 2533087,
      "text": "this {} is {} a test",
      "key": "identifier_2",
      "context": "asdfasdfa\n\n✨ AI Context\nUsed as the name of the CLI tool.\n✨ 🔚",
      "maxLength": 24,
      "fields": []
    },
    {
      "id": 2533089,
      "text": "String for translation 3",
      "key": "identifier_3",
      "context": "identifier_3\n\n✨ AI Context\nthis is my ai context\n✨ 🔚",
      "maxLength": 24,
      "fields": []
    },
    {
      "id": 2533093,
      "text": " String for translation 5",
      "key": "identifier_5",
      "context": "identifier_5",
      "maxLength": 15,
      "fields": []
    },
    {
      "id": 2533095,
      "text": {
        "one": "%s apple",
        "other": "%s apples"
      },
      "key": "apples_count",
      "context": "apples_count\ndo not change placeholder format [one] [other]",
      "maxLength": 9,
      "fields": []
    }
  ],
  "tmSuggestions": [],
  "terms": [],
  "file": {
    "id": 17983,
    "name": "strings.xml",
    "title": null,
    "context": null,
    "type": "android",
    "path": "/strings.xml",
    "fields": []
  }
}
```

## Screenshot
![Advanced prompt template in Crowdin](https://developers.app.crowdin.net/api/media/file/edd89454-f5f4-4e44-b9b3-1f1f7e493dcd.png)
