@kudoai/ai-personas
v1.11.0
Published
1,300+ AI personas for LLMs and agents.
Maintainers
Readme
> KudoAI / ai-personas
1,300+ AI personas for LLMs and agents.
It's just a JSON file, so you can use it in any environment.
⚡ Installation
Node.js:
From your project root:
npm install @kudoai/ai-personasGreasemonkey:
// ==UserScript==
...
// @resource ai-personas https://cdn.jsdelivr.net/npm/@kudoai/ai-personas@1/dist/ai-personas.min.json
// @grant GM_getResourceText
...
// ==/UserScript==🔌 Usage
ES Modules (ESM):
import personas from '@kudoai/ai-personas'
console.log(personas['Linux Terminal'].prompt)
// => I want you to act as a linux terminal. I will type commands and you will...CommonJS (CJS):
const personas = require('@kudoai/ai-personas')
console.log(personas['Linux Terminal'].prompt)
// => I want you to act as a linux terminal. I will type commands and you will...Web:
<script type="module">
const personas = await (await fetch(
'https://cdn.jsdelivr.net/npm/@kudoai/ai-personas@1/dist/ai-personas.min.json'
)).json()
console.log(personas['Linux Terminal'].prompt)
// => I want you to act as a linux terminal. I will type commands and you will...
</script>Greasemonkey:
const personas = JSON.parse(GM_getResourceText('ai-personas'))
console.log(personas['Linux Terminal'].prompt)
// => I want you to act as a linux terminal. I will type commands and you will...💻 Examples
Find personas by keyword:
function findPersonas(keyword) {
return Object.entries(personas)
.filter(([name, data]) => data.prompt.toLowerCase().includes(keyword.toLowerCase()))
.map(([name]) => name)
}
console.log(findPersonas('coach'))
// => [ 'Interview Preparation Coach', 'Life Coach', ... ]Get prompt for a persona:
function getPrompt(persona) { return personas[persona].prompt }
console.log(getPrompt('Food Critic'))
// => I want you to act as a food critic. I will tell you about a restaurant...Get random personas:
function randomPersona(qty = 1) {
const shuffledPersonas = Object.keys(personas).sort(() => 0.5 - Math.random()),
randomPersonas = shuffledPersonas.slice(0, qty)
return qty == 1 ? randomPersonas[0] : randomPersonas
}
console.log(randomPersona())
// => e.g. Reverse Prompt Engineer
console.log(randomPersona(10))
// => e.g. [ 'Internet Trend & Slang Intelligence', 'Tic-Tac-Toe Game', ... ]Get random prompt:
function randomPrompt() {
return Object.values(personas).sort(() => 0.5 - Math.random())[0].prompt
}
console.log(randomPrompt())
/** e.g. =>
Act as a Node.js Automation Script Developer. You are an expert in creating
automated scripts using Node.js to streamline tasks such as file
manipulation, web scraping, and API interactions.
Your task is to:
- Write efficient Node.js scripts to automate ${taskType}.
- Ensure the scripts are robust and handle errors gracefully.
- Use modern JavaScript syntax and best practices.
...
**/Fill variables in template prompts:
function fillVarsInTemplate(prompt, vals = {}) {
return prompt.replace(/\$\{(.*?)\}/g, (_, key) => vals[key] ?? `\${${key}}`) }
const prompt = personas['Node.js Automation Script Developer'].prompt,
filledPrompt = fillVarsInTemplate(prompt, { taskType: 'web scraping' })
console.log(filledPrompt)
/** =>
...
Your task is to:
- Write efficient Node.js scripts to automate web scraping.
...
**/Combine prompts:
const megaPrompt = `
When I start w/ sh: follow prompt A. When I start w/ win: follow prompt B.
Prompt A: ${personas['Linux Terminal'].prompt}
Prompt B: ${personas['Windows Terminal'].prompt}
`
console.log(megaPrompt)
/** =>
When I start w/ sh: follow prompt A. When I start w/ win: follow prompt B.
Prompt A: I want you to act as a linux terminal...
Prompt B: I want you to act as a Windows Terminal...
**/Build system prompt:
const systemPrompt = ai_personas['Study Planner'].prompt
const messages = [
{ role: 'system', content: systemPrompt },
{ role: 'user', content: 'Create a weekly study plan for calculus' }
]🏛️ License
🧠 Contributors
All contributions are very welcome!
🤖 Related
🤖 ai-personas (Python)
More JavaScript utilities / Discuss / Report bug / Report vulnerability / Back to top ↑
