Get your prompt using its slug, with a specific version or tag.
const { value } await basalt.prompt.get('my-prompt-slug')
// Using object syntax const { value } = await basalt.prompt.get({ slug: 'welcome-message', tag: 'staging' }) // Using parameter syntax const { value } = await basalt.prompt.get('welcome-message', { tag: 'staging' })
production
// Using object syntax const { value } = await basalt.prompt.get({ slug: 'welcome-message', version: '1.0.0' }) // Using parameter syntax const { value } = await basalt.prompt.get('welcome-message', { version: '1.0.0' })
{{name}}
const { value } = await basalt.prompt.get({ slug: 'welcome-message', variables: { name: 'John Doe', company: 'Acme Inc' } }) // The variables can also be provided with the parameter syntax const { value } = await basalt.prompt.get('welcome-message', { variables: { name: 'John Doe' } })
interface PromptResult { text: string; // User Prompt systemText: string | undefined; // System Prompt model: { provider: 'anthropic' | 'open-ai' | 'mistral' | 'gemini'; model: string; version: string | 'latest'; parameters: { temperature: number; topP: number; frequencyPenalty?: number; presencePenalty?: number; topK?: number; maxLength: number; responseFormat: ResponseFormat; jsonObject?: Record<string, any>; }; }; }
{ "text": "Can you help me with...", "systemText": "You are an AI assistant that helps users with their tasks.", "model": { "provider": "open-ai", "model": "4.1-nano", "version": "latest", "parameters": { "temperature": 0.7, "topP": 0.95, "frequencyPenalty": 1, "presencePenalty": 1, "topK": 40, "maxLength": 1000, "responseFormat": "text", "jsonObject": null } } }
Was this page helpful?