> ## Documentation Index
> Fetch the complete documentation index at: https://www.adaline.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompts

# PromptsClient

`adaline.prompts` creates, reads, updates, and deletes prompts. Related prompt-scoped resources — drafts, playgrounds, evaluators, and evaluations — are exposed through nested sub-clients. Every method is async.

## Access

```python theme={null}
from adaline.main import Adaline

adaline = Adaline()
prompts = adaline.prompts  # PromptsClient
```

The class is also exported directly:

```python theme={null}
from adaline.clients import PromptsClient
```

## Sub-clients

`PromptsClient` exposes four nested namespaces — evaluators and evaluations are here (not at the top level) because every URL is `/prompts/{prompt_id}/...`:

| Attribute                     | Client                                                                           | Covers                                                                    |
| ----------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `adaline.prompts.draft`       | [`PromptDraftClient`](/docs/reference/sdk/v2/python/classes/prompt-draft)             | Get the current draft                                                     |
| `adaline.prompts.playgrounds` | [`PromptPlaygroundsClient`](/docs/reference/sdk/v2/python/classes/prompt-playgrounds) | List / get playgrounds                                                    |
| `adaline.prompts.evaluators`  | [`PromptEvaluatorsClient`](/docs/reference/sdk/v2/python/classes/prompt-evaluators)   | CRUD for evaluators attached to the prompt                                |
| `adaline.prompts.evaluations` | [`PromptEvaluationsClient`](/docs/reference/sdk/v2/python/classes/prompt-evaluations) | Create / list / cancel evaluation runs (+ `.results` for per-row results) |

Types from `adaline_api`:

```python theme={null}
from adaline_api.models.prompt import Prompt
from adaline_api.models.create_prompt_request import CreatePromptRequest
from adaline_api.models.patch_prompt_request import PatchPromptRequest
from adaline_api.models.list_prompts_response import ListPromptsResponse
```

[`Prompt`](/docs/reference/api/v2/openapi/get-prompt) embeds a [`PromptSnapshot`](/docs/reference/sdk/v2/python/types/PromptSnapshot) with the latest config, [`PromptMessage[]`](/docs/reference/sdk/v2/python/types/PromptMessage), [`ToolFunction[]`](/docs/reference/sdk/v2/python/types/ToolFunction), and [`PromptVariable[]`](/docs/reference/sdk/v2/python/types/PromptVariable).

***

## list()

List prompts in a project (paginated).

```python theme={null}
async def list(
    *,
    project_id: str,
    limit: Optional[int] = None,
    cursor: Optional[str] = None,
    sort: Optional[SortOrderInput] = None,
    created_after: Optional[int] = None,
    created_before: Optional[int] = None,
    fields: Optional[str] = None,
) -> ListPromptsResponse
```

### Parameters

| Name                               | Type                       | Required | Description                                  |
| ---------------------------------- | -------------------------- | -------- | -------------------------------------------- |
| `project_id`                       | `str`                      | Yes      | Project whose prompts should be returned.    |
| `limit`                            | `Optional[int]`            | No       | Page size (default 50, max 200).             |
| `cursor`                           | `Optional[str]`            | No       | Opaque cursor from a previous response.      |
| `sort`                             | `Optional[SortOrderInput]` | No       | Sort order.                                  |
| `created_after` / `created_before` | `Optional[int]`            | No       | Unix millisecond bounds.                     |
| `fields`                           | `Optional[str]`            | No       | Comma-separated top-level fields to include. |

### Returns

[`ListPromptsResponse`](/docs/reference/api/v2/openapi/list-prompts) with `{ data: list[Prompt]; pagination: Pagination }`.

### Example

```python theme={null}
response = await adaline.prompts.list(
    project_id="project_abc123",
    limit=50,
    sort="createdAt:desc",
    fields="id,title,createdAt",
)

for prompt in response.data:
    print(prompt.id, prompt.title)
```

***

## create()

Create a new prompt in a project. The optional `draft` seeds the prompt's initial config, messages, and tools.

```python theme={null}
async def create(*, prompt: CreatePromptRequest) -> Prompt
```

### Parameters

| Name     | Type                                                             | Required | Description        |
| -------- | ---------------------------------------------------------------- | -------- | ------------------ |
| `prompt` | [`CreatePromptRequest`](/docs/reference/api/v2/openapi/create-prompt) | Yes      | Prompt definition. |

### Returns

[`Prompt`](/docs/reference/api/v2/openapi/get-prompt) — the created prompt.

### Example

```python theme={null}
from adaline_api.models.create_prompt_request import CreatePromptRequest

prompt = await adaline.prompts.create(
    prompt=CreatePromptRequest(
        project_id="project_abc123",
        title="Customer support triage",
        icon={"type": "emoji", "value": "🎧"},
        draft={
            "config": {
                "provider": "openai",
                "model": "gpt-4o",
                "settings": {"temperature": 0.3},
            },
            "messages": [
                {
                    "role": "system",
                    "content": [{"modality": "text", "value": "You are a helpful triage assistant."}],
                },
            ],
        },
    )
)

print(f"Created prompt {prompt.id}")
```

***

## get()

Retrieve a single prompt by ID. Use `expand="playground"` to include the default playground.

```python theme={null}
async def get(
    *,
    prompt_id: str,
    expand: Optional[str] = None,
    fields: Optional[str] = None,
) -> Prompt
```

### Parameters

| Name        | Type            | Required | Description                                            |
| ----------- | --------------- | -------- | ------------------------------------------------------ |
| `prompt_id` | `str`           | Yes      | Prompt identifier.                                     |
| `expand`    | `Optional[str]` | No       | Pass `"playground"` to include the default playground. |
| `fields`    | `Optional[str]` | No       | Comma-separated top-level fields to include.           |

### Example

```python theme={null}
prompt = await adaline.prompts.get(
    prompt_id="prompt_abc123",
    expand="playground",
)

print(f"Model: {prompt.config.provider}/{prompt.config.model}")
```

***

## update()

Partially update a prompt. Sent as `PATCH` under the hood. Any field you omit is left untouched.

```python theme={null}
async def update(
    *,
    prompt_id: str,
    prompt: PatchPromptRequest,
    playground_id: Optional[str] = None,
) -> Prompt
```

### Parameters

| Name            | Type                                                            | Required | Description                                                                    |
| --------------- | --------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------ |
| `prompt_id`     | `str`                                                           | Yes      | Prompt identifier.                                                             |
| `prompt`        | [`PatchPromptRequest`](/docs/reference/api/v2/openapi/update-prompt) | Yes      | Fields to update (all optional).                                               |
| `playground_id` | `Optional[str]`                                                 | No       | When patching playground-scoped fields, identifies which playground to update. |

### Example

```python theme={null}
from adaline_api.models.patch_prompt_request import PatchPromptRequest

updated = await adaline.prompts.update(
    prompt_id="prompt_abc123",
    prompt=PatchPromptRequest(
        title="Renamed prompt",
        config={
            "provider": "openai",
            "model": "gpt-4o-mini",
            "settings": {"temperature": 0.7},
        },
    ),
)
```

***

## delete()

Permanently delete a prompt and all associated resources (drafts, playgrounds, deployments, evaluators, evaluations). Irreversible.

```python theme={null}
async def delete(*, prompt_id: str) -> None
```

***

## See Also

* [PromptDraftClient](/docs/reference/sdk/v2/python/classes/prompt-draft) — `adaline.prompts.draft.get(...)`
* [PromptPlaygroundsClient](/docs/reference/sdk/v2/python/classes/prompt-playgrounds)
* [PromptEvaluatorsClient](/docs/reference/sdk/v2/python/classes/prompt-evaluators)
* [PromptEvaluationsClient](/docs/reference/sdk/v2/python/classes/prompt-evaluations)
* [Adaline class](/docs/reference/sdk/v2/python/classes/adaline)
* [PromptSnapshot](/docs/reference/sdk/v2/python/types/PromptSnapshot)
* API reference: [List prompts](/docs/reference/api/v2/openapi/list-prompts) · [Create](/docs/reference/api/v2/openapi/create-prompt) · [Get](/docs/reference/api/v2/openapi/get-prompt) · [Update](/docs/reference/api/v2/openapi/update-prompt)
