Skip to content

Exporting to LangChain & LlamaIndex

FormatDescription
rawPlain string with variables substituted
langchainLangChain PromptTemplate constructor object
llamaindexLlamaIndex PromptTemplate object
jsonFull structured export with version history
import { PromptExporter } from 'minions-prompts';
const exporter = new PromptExporter(storage);
const langchain = await exporter.toLangChain(promptId);
// Use with LangChain:
// const template = new PromptTemplate(langchain);
console.log(langchain);
// {
// template: "Summarize {{topic}} for {{audience}}.",
// inputVariables: ["topic", "audience"],
// outputParser: null
// }
const llamaindex = await exporter.toLlamaIndex(promptId);
// {
// template: "Summarize {{topic}} for {{audience}}.",
// templateVars: ["topic", "audience"]
// }
Terminal window
# Export to LangChain format
prompts export <id> --format langchain
# Export to file
prompts export <id> --format json --output prompt-export.json
# Render with variables
prompts export <id> --format raw --vars topic=AI audience=engineers