- clean up their source code
- make edits to prompts without re-deploying code
- collaborate with non-technical teammates
- A/B test prompts
Creating a template
You can create a prompt template by clicking on the “Create prompt template” button in the Prompts section of the dashboard.Usage with OpenAI
You can use templates seamlessly with OpenAI’s API with our SDKs. This will make sure the tracking of the prompt is done automatically.- Javascript
- Python
Usage with LangChain’s templates
You can pull templates in the LangChain format and use them directly as PromptTemplate and ChatPromptTemplate classes. Example with simple text template:- Javascript
- Python
The
getLangChainTemplate
method returns a PromptTemplate
object for simple templates, which can be used directly in chains or to format prompts.- Javascript
- Python
The
getLangChainTemplate
function directly returns a ChatPromptTemplate
object for chat messages templates, which can be used to format messages.Manual LangChain Usage with LLM Classes
Using with LangChain LLM Classes is similar to using with OpenAI, but requires you to format the messages in the LangChain format as well as pass the template id in the metadata.- Javascript
- Python
Manual usage
You can also use templates manually with any LLM API by accessing the relevant fields (returned in OpenAI’s format).- Javascript
- Python