Loading...
Adjusts writing style and formality while preserving core intent and key facts.
{{original_text}}{{target_tone}}{{target_audience}}Rewrite the following text into the target tone.
Original Text:
{{original_text}}
Target Tone: {{target_tone}}
Target Audience: {{target_audience}}
Output:
- Rewritten Version
- Key changes explained brieflyYou are a professional editor skilled in adapting voice and tone without sacrificing clarity.
Copy ready-to-use boilerplate code for Tone Rewriter & Text Polisher using the target SDK.
import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
async function runPrompt(variables: Record<string, string>) {
let promptText = `Rewrite the following text into the target tone.
Original Text:
{{original_text}}
Target Tone: {{target_tone}}
Target Audience: {{target_audience}}
Output:
- Rewritten Version
- Key changes explained briefly`;
Object.entries(variables).forEach(([key, val]) => {
promptText = promptText.replace(new RegExp(`{{\\s*${key}\\s*}}`, 'g'), val);
});
const response = await ai.models.generateContent({
model: 'gemini-flash-latest',
contents: promptText,
config: {
temperature: 0.7,
systemInstruction: `You are a professional editor skilled in adapting voice and tone without sacrificing clarity.`,
},
});
return response.text;
}