Exporting to LangChain & LlamaIndex
Supported Formats
Section titled “Supported Formats”| Format | Description |
|---|---|
raw | Plain string with variables substituted |
langchain | LangChain PromptTemplate constructor object |
llamaindex | LlamaIndex PromptTemplate object |
json | Full structured export with version history |
LangChain Export
Section titled “LangChain Export”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// }from minions_prompts import PromptExporter
exporter = PromptExporter(storage)langchain_export = exporter.to_lang_chain(prompt_id)
# Use with LangChain:# from langchain.prompts import PromptTemplate# template = PromptTemplate(# template=langchain_export.template,# input_variables=langchain_export.input_variables,# )LlamaIndex Export
Section titled “LlamaIndex Export”const llamaindex = await exporter.toLlamaIndex(promptId);// {// template: "Summarize {{topic}} for {{audience}}.",// templateVars: ["topic", "audience"]// }llamaindex_export = exporter.to_llama_index(prompt_id)# LlamaIndexExport(# template="Summarize {{topic}} for {{audience}}.",# template_vars=["topic", "audience"]# )CLI Export
Section titled “CLI Export”# Export to LangChain formatprompts export <id> --format langchain
# Export to fileprompts export <id> --format json --output prompt-export.json
# Render with variablesprompts export <id> --format raw --vars topic=AI audience=engineers