Back to Tensorzero

Code Example: How to create a prompt template

examples/docs/guides/gateway/create-a-prompt-template/README.md

2026.4.1665 B
Original Source

Code Example: How to create a prompt template

This folder contains the code for the Guides » Gateway » Create a prompt template page in the documentation.

Running the Example

  1. Set the OPENAI_API_KEY environment variable:
bash
export OPENAI_API_KEY="sk-..." # Replace with your OpenAI API key
  1. Launch the TensorZero Gateway and a local Postgres database:
bash
docker compose up
  1. Run the example:

Install the Python dependencies. We recommend using uv:

bash
uv sync

Run the example:

bash
uv run openai_sdk.py