Prompt Focusing
The Prompt Focusing operation analyzes an input prompt or multi-turn conversation and returns a sharper, purpose-aligned version. It helps reduce verbosity, re-align user questions with a predefined purpose, and improve overall clarity before sending the prompt to an LLM, resulting in lower token costs and more accurate responses.
Overview
Prompt Focusing addresses common challenges in LLM interactions by:
- Reducing Verbosity: Eliminates unnecessary words and redundant information while preserving intent
- Purpose Alignment: Ensures prompts stay focused on the intended goal or objective
- Clarity Enhancement: Restructures confusing or ambiguous requests for better comprehension
- Token Optimization: Reduces token usage without sacrificing meaning, leading to cost savings
- Response Quality: Improves LLM output by providing clearer, more focused input
The operation analyzes the conversation context and applies intelligent refinements based on the specified purpose statement and target audience. It can output either an improved prompt, suggestions for improvement, or both depending on your needs.
Key benefits include faster processing times, reduced API costs, and more accurate LLM responses through clearer input prompts.
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
purposeStatement | string | undefined | Short text that describes the intended purpose/goal. If omitted the original system/context message is used. |
targetAudience | 'general' | 'technical' | 'creative' | 'educational' | "general" | Adapts wording / tone to the audience profile. |
outputFormat | 'improved_prompt' | 'suggestions' | 'both' | "both" | Choose whether the operation returns only the rewritten prompt, only bullet-point suggestions, or both. |
Target Audience Options
general- Uses clear, accessible language suitable for most userstechnical- Employs precise technical terminology and structured formattingcreative- Maintains creative flow while improving focus and clarityeducational- Optimizes for learning objectives with clear, instructional language
Output Format Options
improved_prompt- Returns only the refined, focused version of the inputsuggestions- Provides bullet-point recommendations for manual improvementboth- Includes both the improved prompt and actionable suggestions
Configuration Example
interface PromptFocusingConfig {
purposeStatement?: string;
targetAudience?: 'general' | 'technical' | 'creative' | 'educational';
outputFormat?: 'improved_prompt' | 'suggestions' | 'both';
}
Result Format
interface PromptFocusingResult {
improvedPrompt: string; // Focused / rewritten prompt
confidence: number; // 0-1 confidence score
suggestions?: string[]; // Available when outputFormat includes 'suggestions'
}
Examples
- REST API
- JavaScript SDK
- Python
curl -X POST https://api.meta-prompt.com/v1/process \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": "Here are the commit messages from sprint 14. Could you write release notes so that operations understands what changed? Make sure you mention the tickets addressed and also add emojis where suitable. Also shorten things if you can…"
}
],
"operations": [
{
"name": "promptFocusing",
"config": {
"purposeStatement": "Generate concise release-note summaries",
"targetAudience": "technical",
"outputFormat": "both"
}
}
]
}'
Response:
{
"messages": [
{
"role": "user",
"content": "Create concise release notes from the provided Sprint 14 commit messages. Include: ticket references, key changes for operations team, and relevant emojis."
}
],
"operations": [
{
"name": "promptFocusing",
"result": {
"improvedPrompt": "Create concise release notes from the provided Sprint 14 commit messages. Include: ticket references, key changes for operations team, and relevant emojis.",
"confidence": 0.92,
"suggestions": [
"Removed redundant phrasing ('Also shorten things if you can')",
"Structured requirements as clear bullet points",
"Eliminated unnecessary hedging language",
"Made the action verb more direct ('Create' vs 'Could you write')"
]
}
}
]
}
import { MetaPrompt } from '@meta-prompt/sdk-js';
const client = new MetaPrompt('YOUR_API_KEY');
const result = await client.process(
[
{
role: 'user',
content: 'Here are the commit messages from sprint 14. Could you write release notes so that operations understands what changed? Make sure you mention the tickets addressed and also add emojis where suitable. Also shorten things if you can…'
}
],
[
{
name: 'promptFocusing',
config: {
purposeStatement: 'Generate concise release-note summaries',
targetAudience: 'technical',
outputFormat: 'both'
}
}
]
);
console.log(result.operations[0].result);
// Output:
// {
// improvedPrompt: "Create concise release notes from the provided Sprint 14 commit messages. Include: ticket references, key changes for operations team, and relevant emojis.",
// confidence: 0.92,
// suggestions: [
// "Removed redundant phrasing ('Also shorten things if you can')",
// "Structured requirements as clear bullet points",
// "Eliminated unnecessary hedging language",
// "Made the action verb more direct ('Create' vs 'Could you write')"
// ]
// }
// Example with creative audience
const creativeResult = await client.process(
[
{
role: 'user',
content: 'I want to write a story but I don\'t know where to start and I have so many ideas floating around in my head and I can\'t seem to organize them properly...'
}
],
[
{
name: 'promptFocusing',
config: {
purposeStatement: 'Help organize creative ideas for story writing',
targetAudience: 'creative',
outputFormat: 'improved_prompt'
}
}
]
);
console.log(creativeResult.operations[0].result);
// Output:
// {
// improvedPrompt: "Help me organize multiple story ideas into a structured writing plan. I have many concepts but need guidance on prioritizing and developing them.",
// confidence: 0.88
// }