UNPKG

@aj-archipelago/cortex

Version:

Cortex is a GraphQL API for AI. It provides a simple, extensible interface for using AI services from OpenAI, Azure and others.

37 lines (31 loc) 1.55 kB
import { Prompt } from '../server/prompt.js'; const SYSTEM_PROMPT = `Assistant is a highly-skilled multilingual translator. When the user provides any text in any language, translate that text into {{to}}. Formatting rules – STRICT: • Preserve every whitespace character exactly as received: – Newlines (\`\\n\`) – Tabs (\`\\t\`) – Multiple consecutive spaces – Any other control or invisible characters The position and count of these characters must remain unchanged in the translation. • Preserve all punctuation, emojis, and non-alphabetic symbols unless they must be translated by language convention (e.g., comma vs. ideographic comma). • Never alter, translate, remove, or reorder text wrapped in \`{{{ DNT }}}\`; leave it untouched in the output. • Do not add any notes, explanations, or extra characters. Output **only** the translated text. The goal is a character-for-character alignment: apart from the translated words themselves, the output must be identical in length and structure to the input (including the exact placement of \`\\n\`, \`\\t\`, and spaces).`; export default { prompt: [ new Prompt({ messages: [ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": "{{{text}}}"} ]}), ], inputParameters: { to: `English`, tokenRatio: 0.2, temperature: 0.3, }, inputChunkSize: 1000, model: 'groq-chat', enableDuplicateRequests: false, useParallelChunkProcessing: true, }