> ## Documentation Index
> Fetch the complete documentation index at: https://arizeai-433a7140-release-please--branches--main--components.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompts

> Manage prompts with @arizeai/phoenix-client

The prompts module lets you create prompt versions in Phoenix, fetch them back by selector, list prompts, update a prompt's description and metadata, delete a prompt, and adapt prompt versions to supported provider SDKs.

<section className="hidden" data-agent-context="relevant-source-files" aria-label="Relevant source files">
  <h2>Relevant Source Files</h2>

  <ul>
    <li><code>src/prompts/getPrompt.ts</code> for the exact selector shape</li>
  </ul>
</section>

## Create A Prompt

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import {
  createPrompt,
  promptVersion,
} from "@arizeai/phoenix-client/prompts";

await createPrompt({
  name: "support-response",
  description: "Customer support reply prompt",
  version: promptVersion({
    modelProvider: "OPENAI",
    modelName: "gpt-4o-mini",
    template: [{ role: "user", content: "Reply to {{question}}" }],
  }),
});
```

## Fetch By Selector

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { getPrompt } from "@arizeai/phoenix-client/prompts";

const prompt = await getPrompt({
  prompt: { name: "support-response", tag: "production" },
});
```

`prompt` can be selected by `{ name }`, `{ name, tag }`, or `{ versionId }`.

## Update Description And Metadata

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { updatePrompt } from "@arizeai/phoenix-client/prompts";

await updatePrompt({
  promptIdentifier: "support-response",
  description: "Customer support reply prompt",
  metadata: { team: "ml", env: "production" },
});
```

`promptIdentifier` is a prompt name or ID. Omit a field to leave it unchanged, and pass `description: null` to clear it. `metadata` replaces the existing metadata object as a whole rather than merging into it.

Requires a Phoenix server on 19.18.0 or later.

## Delete A Prompt

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { deletePrompt } from "@arizeai/phoenix-client/prompts";

await deletePrompt({ prompt: { name: "support-response" } });

// Or by prompt id
await deletePrompt({ prompt: { promptId: "UHJvbXB0OjE=" } });
```

`prompt` takes the same selector style as `getPrompt`, narrowed to the two selectors that identify a prompt rather than one of its versions: `{ name }` and `{ promptId }`. Passing a version selector — `{ versionId }`, or `{ name, tag }` — rejects instead of falling back to the whole prompt, so a variable holding a version never deletes more than you named.

Deletion cascades: every version of the prompt, along with its version tags and labels, is removed with it, and the deletion cannot be undone. A prompt that does not exist rejects with `Prompt not found: <identifier>`.

Requires a Phoenix server on 13.20.0 or later.

## Convert To Another SDK

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { toSDK } from "@arizeai/phoenix-client/prompts";

const promptAsAI = toSDK({
  sdk: "ai",
  prompt,
  variables: { question: "Where is my order?" },
});
```

Supported `sdk` targets:

* `ai`
* `openai`
* `anthropic`

<section className="hidden" data-agent-context="source-map" aria-label="Source map">
  <h2>Source Map</h2>

  <ul>
    <li><code>src/prompts/createPrompt.ts</code></li>
    <li><code>src/prompts/deletePrompt.ts</code></li>
    <li><code>src/prompts/getPrompt.ts</code></li>
    <li><code>src/prompts/listPrompts.ts</code></li>
    <li><code>src/prompts/updatePrompt.ts</code></li>
    <li><code>src/prompts/sdks/toSDK.ts</code></li>
    <li><code>src/types/prompts.ts</code></li>
  </ul>
</section>
