Skip to content

AI Prompt Provider

The AI Prompt Provider module is designed to streamline the process of generating prompts for both custom and natively supported AI providers.

Sample

index.js
const crowdinModule = require('@crowdin/app-project-module');
const configuration = {
baseUrl: 'https://123.ngrok.io',
clientId: 'clientId',
clientSecret: 'clientSecret',
name: 'Sample App',
identifier: 'sample-app',
description: 'Sample App description',
dbFolder: __dirname,
imagePath: __dirname + '/' + 'logo.png',
aiPromptProvider: {
formSchema: {
type: "object",
properties: {
firstOption: {
title: "Option 1",
type: "string"
}
},
required: ['firstOption']
},
compile: async function(options, payload, client, context, requestData) {
return 'Prompt text compiled based on options and payload';
}
}
};
crowdinModule.createApp(configuration);

Configuration

ParameterDescription
formSchemaReact JSON Schema for the form.

compile Function

Used to generate prompts based on the options and payload provided.

Parameters

  • options - Options selected by the user.
  • payload - Data provided by the AI provider.
  • client - Crowdin API client.
  • context - Context object.

Return Value

The function should return the prompt text.