Documentation Index
Fetch the complete documentation index at: https://docs.tracia.io/llms.txt
Use this file to discover all available pages before exploring further.
const { prompts } = await tracia.prompts.list();
Retrieve all prompts associated with your account, ordered by most recently updated.
Parameters
This method takes no parameters.
Response
interface PromptListItem {
id: string;
slug: string;
name: string;
description: string | null;
provider: 'OPENAI' | 'ANTHROPIC' | 'GOOGLE' | 'AMAZON_BEDROCK' | null;
model: string | null;
temperature: number | null;
topP: number | null;
maxOutputTokens: number | null;
currentVersion: number;
variables: string[];
createdAt: string;
updatedAt: string;
}
Examples
Basic Usage
const { prompts } = await tracia.prompts.list();
console.log(`Found ${prompts.length} prompts`);
Iterating Over Prompts
const { prompts } = await tracia.prompts.list();
prompts.forEach(prompt => {
console.log(`${prompt.name} (${prompt.slug}) - v${prompt.currentVersion}`);
console.log(` Variables: ${prompt.variables.join(', ') || 'none'}`);
});
Filtering Prompts
const { prompts } = await tracia.prompts.list();
// Find prompts with specific variables
const emailPrompts = prompts.filter(p =>
p.variables.includes('email')
);
// Find prompts using a specific model
const gpt4Prompts = prompts.filter(p =>
p.model === 'gpt-4'
);
Error Handling
import { TraciaError, TraciaErrorCode } from 'tracia';
try {
const { prompts } = await tracia.prompts.list();
} catch (error) {
if (error instanceof TraciaError) {
if (error.code === TraciaErrorCode.UNAUTHORIZED) {
console.error('Invalid API key');
}
}
}