> ## Documentation Index
> Fetch the complete documentation index at: https://arize-ax.mintlify.site/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Build, Test, and Optimize a Trip-Planner Prompt

> An end-to-end walkthrough of the prompt iteration cycle in Arize AX, using a trip-planner use case.

<Frame caption="End-to-end notebook — create a Prompt Object, run an experiment with an evaluator, save an improved version, compare results.">
  <Card title="Run in Google Colab" href="https://colab.research.google.com/github/Arize-ai/tutorials/blob/main/python/llm/prompts/trip-planner-build-test-optimize.ipynb" icon="https://storage.googleapis.com/arize-phoenix-assets/assets/images/arize-docs-images/cookbooks/gc.png" horizontal iconType="solid" />
</Frame>

This guide is a runnable companion to the [Prompts concepts section](/docs/ax/concepts/prompts/overview). You'll work through three sections that mirror the iteration cycle the concept docs describe.

## What you'll build

A trip-planner prompt that takes a destination, duration, and travel style and produces a day-by-day itinerary. You'll:

1. **Create** a Prompt Object and save it to [Prompt Hub](/docs/ax/concepts/prompts/prompt-hub).
2. **Test** the prompt against a [dataset](/docs/ax/concepts/prompts/datasets-for-prompts) with an evaluator, as an [Arize experiment](/docs/ax/concepts/prompts/experiments-for-prompts).
3. **Iterate** — tighten the prompt, save a new version, and compare runs side by side.

By the end you'll have:

* A versioned trip-planner prompt in your Prompt Hub.
* Two experiment runs against the same dataset.
* A measurable improvement between v1 and v2 — in the reference run, mean score went from 0.86 to 1.00.

## What you'll need

* An [Arize account](https://app.arize.com) with an API key and space ID.
* An OpenAI API key (the notebook uses `gpt-4o-mini`; total cost is a few cents).
* Python 3.10+ with `arize>=8.0.0` and `openai` installed (the notebook handles this).

## What the notebook covers

| Section                | What it demonstrates                                                                                                          | Concept page                                                            |
| :--------------------- | :---------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------- |
| Setup                  | Install dependencies; configure API keys; initialize the Arize client                                                         | —                                                                       |
| 1. Create the prompt   | Define a Prompt Object's template, model, and invocation parameters; save the first version with a commit message             | [The Prompt Object](/docs/ax/concepts/prompts/prompt-object)                 |
| 2. Test the prompt     | Build a small dataset, define a task that runs the prompt, attach a deterministic evaluator, run the experiment               | [Experiments for prompts](/docs/ax/concepts/prompts/experiments-for-prompts) |
| 3. Iterate and compare | Tighten the system prompt, save a new immutable version, tag as `production`, run a second experiment, compare scores per row | [Versioning and tags](/docs/ax/concepts/prompts/versioning-and-tags)         |

## Where to go next

After running the notebook:

* **Open the prompt in Prompt Hub** in the UI to see both versions side by side and diff the templates.
* **Open the experiments tab** to compare the two runs row by row.
* **Add an LLM-as-a-judge evaluator** for subjective dimensions the deterministic eval can't catch. See [Evaluators](/docs/ax/concepts/evaluators/overview).
* **Wire the experiment into CI/CD** so prompt edits become PR checks. See [Prompts in CI/CD](/docs/ax/concepts/prompts/prompts-in-ci-cd).
* **Try Prompt Learning** for automated optimization once you have a golden dataset. See [Optimizing prompts](/docs/ax/concepts/prompts/optimizing-prompts).

## Source

The notebook source lives in the [tutorials repo](https://github.com/Arize-ai/tutorials/blob/main/python/llm/prompts/trip-planner-build-test-optimize.ipynb).
