prompt templates : contexts

This commit is contained in:
lovebird 2025-03-26 17:51:59 +01:00
parent a867769a0e
commit aa1d18e70d
6 changed files with 324 additions and 0 deletions

30
src/base/kbot-contexts.ts Normal file
View File

@ -0,0 +1,30 @@
export const enum TemplateContext {
COMMON = 'common',
HOWTO = 'howto',
DIRECTORY = 'directory',
MARKETPLACE = 'marketplace'
}
export interface TemplateContextConfig {
path: string;
description: string;
}
export const TEMPLATE_CONTEXTS: Record<TemplateContext, TemplateContextConfig> = {
[TemplateContext.COMMON]: {
path: './src/config/templates/common.json',
description: 'Common language and utility templates'
},
[TemplateContext.HOWTO]: {
path: './src/config/templates/howto.json',
description: 'Tutorial and guide related templates'
},
[TemplateContext.DIRECTORY]: {
path: './src/config/templates/directory.json',
description: 'Directory and listing related templates'
},
[TemplateContext.MARKETPLACE]: {
path: './src/config/templates/marketplace.json',
description: 'Marketplace and commerce related templates'
}
};

View File

@ -0,0 +1,65 @@
{
"templates": {
"simple": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"keywords": {
"router": "openai",
"model": "google/gemini-exp-1206:free",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"references": {
"router": "openai",
"model": "google/gemini-exp-1206:free",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"codeSimple": {
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"research": {
"router": "openai",
"model": "gpt-4.5-preview",
"mode": "completion",
"preferences": "none",
"filters": "code"
}
},
"instructions": {
"tone": [
{ "flag": "formal", "text": "Use formal and professional language" },
{ "flag": "casual", "text": "Use casual and friendly language" },
{ "flag": "technical", "text": "Use technical and precise language" }
],
"content": [
{ "flag": "spellCheck", "text": "Ensure proper spelling and grammar" },
{ "flag": "removeEmojis", "text": "Remove any emojis or informal symbols" },
{ "flag": "removePersonalPrefs", "text": "Remove personal preferences and subjective statements" },
{ "flag": "shorten", "text": "Keep responses concise and to the point" }
],
"moderation": [
{ "flag": "mafiaFilter", "text": "Filter out inappropriate or harmful content" },
{ "flag": "deprogramming", "text": "Remove any manipulative or biased content" }
],
"format": [
{ "flag": "markdown", "text": "Format response in Markdown" },
{ "flag": "plain", "text": "Use plain text formatting" }
]
},
"defaults": {
"tone": ["formal"],
"content": ["spellCheck", "removeEmojis", "removePersonalPrefs", "shorten"],
"moderation": ["mafiaFilter", "deprogramming"],
"format": ["markdown"]
}
}

View File

@ -0,0 +1,52 @@
{
"templates": {
"simple": {
"router": "openai",
"model": "gpt-4o",
"preferences": "none",
"mode": "completion"
},
"codeSimple": {
"model": "gpt-4o",
"preferences": "none",
"mode": "completion"
},
"research": {
"router": "openai",
"model": "gpt-4.5-preview",
"preferences": "none",
"mode": "completion"
}
},
"instructions": {
"tone": [
{ "flag": "formal", "text": "use a formal tone" },
{ "flag": "friendly", "text": "be friendly and approachable" }
],
"content": [
{ "flag": "spellCheck", "text": "spell check the text, fix any errors" },
{ "flag": "removeEmojis", "text": "remove emojis" },
{ "flag": "removePersonalPrefs", "text": "remove personal preferences or biases" },
{ "flag": "removeRedundancy", "text": "remove redundancy, eg: we attached the files" },
{ "flag": "shorten", "text": "shorten text if possible but preserve personality" }
],
"moderation": [
{ "flag": "mafiaFilter", "text": "remove references to preciousplastic, bazar and Discord" },
{ "flag": "deprogramming", "text": "remove any brain/green washing, eg: sustainable, circular, recycling ... inflated prospects" }
],
"context": [
{ "flag": "makerTutorials", "text": "Context: howto tutorials, for makers" },
{ "flag": "units", "text": "Convert units, from metric to imperial and vice versa (in braces)" }
],
"format": [
{ "flag": "markdown", "text": "dont comment just return as Markdown" }
]
},
"defaults": {
"tone": ["formal"],
"content": ["spellCheck", "removeEmojis", "removePersonalPrefs", "shorten"],
"moderation": ["mafiaFilter", "deprogramming"],
"context": ["makerTutorials", "units"],
"format": ["markdown"]
}
}

View File

@ -0,0 +1,62 @@
{
"templates": {
"categoryList": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"itemDetails": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"searchSuggestions": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"relatedItems": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"categoryDescription": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"itemComparison": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
}
},
"instructions": {
"context": [
{ "flag": "categorization", "text": "Focus on proper categorization and organization" },
{ "flag": "metadata", "text": "Include relevant metadata and attributes" },
{ "flag": "relationships", "text": "Highlight relationships between items" },
{ "flag": "searchability", "text": "Optimize for search and discovery" }
],
"format": [
{ "flag": "structured", "text": "Use structured data format" },
{ "flag": "hierarchical", "text": "Show hierarchical relationships" }
]
},
"defaults": {
"context": ["categorization", "metadata", "relationships", "searchability"],
"format": ["structured", "hierarchical"]
}
}

View File

@ -0,0 +1,87 @@
{
"templates": {
"keywords": {
"_router": "openai",
"model": "google/gemini-exp-1206:free",
"preferences": "none",
"mode": "completion",
"prompt": "Return a list of max. 10 keywords that can be used for SEO purposes, separated by commas (dont comment, just the list) : "
},
"references": {
"_router": "openai",
"model": "google/gemini-exp-1206:free",
"preferences": "none",
"mode": "completion",
"prompt": "Return a list of useful references (only with links), as Markdown, grouped : Articles, Books, Papers, Youtube, Opensource Designs, ... Dont comment !",
"filters": "code"
},
"toolsAndHardware": {
"router_": "openai",
"model": "perplexity/sonar-deep-research",
"preferences": "none",
"mode": "completion",
"prompt": "Extract the required tools, software hardware from the following tutorial.Return as Markdown chapters (H3) with very short bullet points (not bold), with links, max. 5.",
"filters": "code"
},
"requiredSkills": {
"router": "openai",
"model": "gpt-4o",
"preferences": "none",
"mode": "completion",
"prompt": "Analyze the following tutorial and identify all the skills that a person would need in order to complete the project. Return as JSON with this structure:\n\n{\n \"skills\": [\n {\n \"name\": \"Skill name\", \n \"level\": \"Beginner, Intermediate, or Advanced\", \n \"description\": \"Brief description of where/how this skill is needed\"\n }\n ],\n \"prerequisiteKnowledge\": [\n \"Background knowledge or familiarity with concepts\"\n ],\n \"safetyConsiderations\": [\n \"Any safety considerations or precautions needed\"\n ]\n}\n\nReturn only the JSON. No introductions or explanations.",
"filters": "code"
},
"learnedSkills": {
"router": "openai",
"model": "gpt-4o",
"preferences": "none",
"mode": "completion",
"prompt": "Analyze the following tutorial and identify all the skills that a person would learn or improve by completing this project, modest, humble, simple - dont enflate (sustainable, recylcing, ...), Return as Markdown chapter (H2) with very short bullet points (not bold), max. 5.",
"filters": "code"
},
"local": {
"model": "perplexity/sonar-deep-research",
"preferences": "none",
"mode": "completion",
"prompt": "Markdown chapter (h4) with a list of local resources, services & suppliers, max. 5, with links,group by category. dont comment, just the list",
"filters": "code"
},
"difficulty": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"timeEstimate": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
},
"prerequisites": {
"router": "openai",
"model": "gpt-4o",
"mode": "completion",
"preferences": "none",
"filters": "code"
}
},
"instructions": {
"context": [
{ "flag": "makerTutorials", "text": "Focus on maker and DIY tutorial content" },
{ "flag": "units", "text": "Include relevant units and measurements" },
{ "flag": "safety", "text": "Include safety considerations and warnings" },
{ "flag": "troubleshooting", "text": "Include common issues and solutions" }
],
"format": [
{ "flag": "stepByStep", "text": "Format as clear step-by-step instructions" },
{ "flag": "checklist", "text": "Include progress checkpoints" }
]
},
"defaults": {
"context": ["makerTutorials", "units", "safety", "troubleshooting"],
"format": ["stepByStep", "checklist"]
}
}

View File

@ -0,0 +1,28 @@
{
"templates": {
"productDescription": {
"router": "openai",
"model": "gpt-4o",
"preferences": "none",
"mode": "completion",
"prompt": "Write a clear and concise product description that highlights the key features and benefits. Include technical specifications where relevant.",
"filters": "code"
},
"pricingAnalysis": {
"router": "openai",
"model": "gpt-4o",
"preferences": "none",
"mode": "completion",
"prompt": "Analyze the market value and suggest a competitive price range for this product. Consider materials, manufacturing costs, and market positioning.",
"filters": "code"
},
"marketResearch": {
"router": "openai",
"model": "perplexity/sonar-deep-research",
"preferences": "none",
"mode": "completion",
"prompt": "Provide market research insights including target audience, competitors, and market trends. Format as Markdown sections.",
"filters": "code"
}
}
}