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.
PromptsClient
adaline.prompts creates, reads, updates, and deletes prompts. Related prompt-scoped resources โ drafts, playgrounds, evaluators, and evaluations โ are exposed through nested sub-clients.
import { Adaline } from '@adaline/client';
const adaline = new Adaline();
const prompts = adaline.prompts; // PromptsClient
The class is also exported directly:
import { PromptsClient } from '@adaline/client';
Sub-clients
PromptsClient exposes four nested namespaces โ evaluators and evaluations are here (not at the top level) because every URL is /prompts/{promptId}/...:
| Property | Client | Covers |
|---|
adaline.prompts.draft | PromptDraftClient | Get the current draft |
adaline.prompts.playgrounds | PromptPlaygroundsClient | List / get playgrounds |
adaline.prompts.evaluators | PromptEvaluatorsClient | CRUD for evaluators attached to the prompt |
adaline.prompts.evaluations | PromptEvaluationsClient | Create / list / cancel evaluation runs (+ .results for per-row results) |
Types used below come from @adaline/api:
import type {
Prompt,
CreatePromptRequest,
PatchPromptRequest,
ListPromptsResponse,
SortOrder,
} from '@adaline/api';
Prompt embeds a PromptSnapshot with the latest config, PromptMessage[], ToolFunction[], and PromptVariable[].
List all prompts in a project (paginated). Use fields to trim the response payload.
list(options: {
projectId: string;
limit?: number;
cursor?: string;
sort?: SortOrder;
createdAfter?: number;
createdBefore?: number;
fields?: string;
}): Promise<ListPromptsResponse>
Parameters
| Name | Type | Required | Description |
|---|
projectId | string | Yes | Project whose prompts should be returned. |
limit | number | No | Page size (default 50, max 200). |
cursor | string | No | Opaque cursor from a previous responseโs pagination.nextCursor. |
sort | SortOrder | No | "createdAt:asc" or "createdAt:desc". |
createdAfter | number | No | Unix milliseconds. |
createdBefore | number | No | Unix milliseconds. |
fields | string | No | Comma-separated list of top-level fields to include (e.g. "id,title,createdAt"). |
Returns
Promise<ListPromptsResponse> with shape { data: Prompt[]; pagination: { limit, returned, hasMore, nextCursor } }.
Example
const { data, pagination } = await adaline.prompts.list({
projectId: 'project_abc123',
limit: 50,
sort: 'createdAt:desc',
fields: 'id,title,createdAt',
});
create()
Create a new prompt in a project. The optional draft seeds the promptโs initial config, messages, and tools.
create(options: { prompt: CreatePromptRequest }): Promise<Prompt>
Parameters
| Name | Type | Required | Description |
|---|
prompt | CreatePromptRequest | Yes | Prompt definition. |
CreatePromptRequest (abbreviated):
interface CreatePromptRequest {
projectId: string;
title: string;
icon?: BaseEntityIcon;
draft?: {
config: PromptSnapshotConfig;
messages: PromptMessage[];
tools?: ToolFunction[];
};
}
Returns
Promise<Prompt> โ the created prompt, including server-generated id and draft state.
Example
const prompt = await adaline.prompts.create({
prompt: {
projectId: '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.' }],
},
],
},
},
});
console.log(`Created prompt ${prompt.id}`);
Retrieve a single prompt by ID. Use expand: 'playground' to include the default playground inline. Use fields to trim the response.
get(options: {
promptId: string;
expand?: 'playground';
fields?: string;
}): Promise<Prompt>
Parameters
| Name | Type | Required | Description |
|---|
promptId | string | Yes | Prompt identifier. |
expand | 'playground' | No | Include the default playground in the response. |
fields | string | No | Comma-separated list of top-level fields to include. |
Returns
Promise<Prompt> โ full prompt with config, messages, tools, variables, and (if requested) playground data.
Example
const prompt = await adaline.prompts.get({
promptId: 'prompt_abc123',
expand: 'playground',
});
console.log(`Model: ${prompt.config.provider}/${prompt.config.model}`);
console.log(`Messages: ${prompt.messages.length}`);
update()
Partially update a prompt. You can update title, icon, config, messages, tools, or the default playground. Any field you omit is left untouched. Sent as PATCH under the hood.
update(options: {
promptId: string;
playgroundId?: string;
prompt: PatchPromptRequest;
}): Promise<Prompt>
Parameters
| Name | Type | Required | Description |
|---|
promptId | string | Yes | Prompt identifier. |
playgroundId | string | No | When patching playground-scoped fields, identifies which playground to update. |
prompt | PatchPromptRequest | Yes | Fields to update โ all top-level keys are optional. |
Returns
Promise<Prompt> โ the full updated prompt.
Example
const updated = await adaline.prompts.update({
promptId: 'prompt_abc123',
prompt: {
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.
delete(options: { promptId: string }): Promise<void>
Example
await adaline.prompts.delete({ promptId: 'prompt_abc123' });
See Also