prompts
Client for the Prompts endpoints.
Classes
PromptsClient
PromptsClient(client: OWUIClientBase)
Bases: ResourceBase
Client for the Prompts endpoints.
Prompts are reusable command templates that can be invoked with /command syntax.
They support versioning, tagging, and access control.
- Code Reference client Classes OpenWebUI Attributes prompts
Source code in src/owui_client/client_base.py
Functions
get_prompts
get_prompts() -> List[PromptModel]
Get all prompts the user has read access to.
Returns:
| Type | Description |
|---|---|
List[PromptModel]
|
List[PromptModel]: List of prompts. |
get_prompt_tags
Get all unique tags from prompts the user has access to.
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: Sorted list of unique tag strings. |
Source code in src/owui_client/routers/prompts.py
get_prompt_list
get_prompt_list(query: Optional[str] = None, view_option: Optional[str] = None, tag: Optional[str] = None, order_by: Optional[str] = None, direction: Optional[str] = None, page: Optional[int] = None) -> PromptAccessListResponse
Get paginated list of prompts with access information.
Supports filtering and pagination for browsing prompts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
Optional[str]
|
Search string to filter prompts by name or command. |
None
|
view_option
|
Optional[str]
|
Filter by view option (e.g., 'all', 'owned', 'shared'). |
None
|
tag
|
Optional[str]
|
Filter by tag name. |
None
|
order_by
|
Optional[str]
|
Field to order by (e.g., 'name', 'created_at', 'updated_at'). |
None
|
direction
|
Optional[str]
|
Sort direction ('asc' or 'desc'). |
None
|
page
|
Optional[int]
|
Page number (1-indexed, default 1). |
None
|
Returns:
| Type | Description |
|---|---|
PromptAccessListResponse
|
|
Source code in src/owui_client/routers/prompts.py
create_new_prompt
create_new_prompt(form_data: PromptForm) -> Optional[PromptModel]
Create a new prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form_data
|
PromptForm
|
The prompt data. The |
required |
Returns:
| Type | Description |
|---|---|
Optional[PromptModel]
|
Optional[PromptModel]: The created prompt. |
Source code in src/owui_client/routers/prompts.py
get_prompt_by_command
get_prompt_by_command(command: str) -> Optional[PromptAccessResponse]
Get a prompt by its command trigger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
The command trigger (e.g., '/help' or 'help'). Leading slash is optional. |
required |
Returns:
| Type | Description |
|---|---|
Optional[PromptAccessResponse]
|
Optional[PromptAccessResponse]: The prompt with access info. |
Source code in src/owui_client/routers/prompts.py
get_prompt_by_id
get_prompt_by_id(prompt_id: str) -> Optional[PromptAccessResponse]
Get a prompt by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
Returns:
| Type | Description |
|---|---|
Optional[PromptAccessResponse]
|
Optional[PromptAccessResponse]: The prompt with access info. |
Source code in src/owui_client/routers/prompts.py
update_prompt_by_command
update_prompt_by_command(command: str, form_data: PromptForm) -> Optional[PromptModel]
Update a prompt by its command trigger.
Resolves the prompt by command then updates by ID. Creates a new history entry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
The command trigger (e.g., '/help' or 'help'). |
required |
form_data
|
PromptForm
|
The updated prompt data. |
required |
Returns:
| Type | Description |
|---|---|
Optional[PromptModel]
|
Optional[PromptModel]: The updated prompt. |
Source code in src/owui_client/routers/prompts.py
update_prompt_by_id
update_prompt_by_id(prompt_id: str, form_data: PromptForm) -> Optional[PromptModel]
Update a prompt by ID.
Creates a new history entry for the update. Requires write access.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
form_data
|
PromptForm
|
The updated prompt data. |
required |
Returns:
| Type | Description |
|---|---|
Optional[PromptModel]
|
Optional[PromptModel]: The updated prompt. |
Source code in src/owui_client/routers/prompts.py
update_prompt_metadata
update_prompt_metadata(prompt_id: str, form_data: PromptMetadataForm) -> Optional[PromptModel]
Update prompt metadata (name, command, tags) without creating history.
Lightweight update for metadata changes that don't affect content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
form_data
|
PromptMetadataForm
|
The metadata to update. |
required |
Returns:
| Type | Description |
|---|---|
Optional[PromptModel]
|
Optional[PromptModel]: The updated prompt. |
Source code in src/owui_client/routers/prompts.py
set_prompt_version
set_prompt_version(prompt_id: str, form_data: PromptVersionUpdateForm) -> Optional[PromptModel]
Set the active version of a prompt.
Rolls back to a previous version by specifying its history entry ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
form_data
|
PromptVersionUpdateForm
|
Contains the version_id to set as active. |
required |
Returns:
| Type | Description |
|---|---|
Optional[PromptModel]
|
Optional[PromptModel]: The updated prompt. |
Source code in src/owui_client/routers/prompts.py
update_prompt_access
update_prompt_access(prompt_id: str, form_data: PromptAccessGrantsForm) -> Optional[PromptModel]
Update access grants for a prompt.
Controls who can read or write the prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
form_data
|
PromptAccessGrantsForm
|
The access grants to set. |
required |
Returns:
| Type | Description |
|---|---|
Optional[PromptModel]
|
Optional[PromptModel]: The updated prompt. |
Source code in src/owui_client/routers/prompts.py
delete_prompt_by_command
Delete a prompt by its command trigger.
Resolves the prompt by command then deletes by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
The command trigger (e.g., '/help' or 'help'). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the prompt was found and deleted. |
Source code in src/owui_client/routers/prompts.py
delete_prompt_by_id
Delete a prompt by ID.
Requires write access to the prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if successful. |
Source code in src/owui_client/routers/prompts.py
toggle_prompt_active
toggle_prompt_active(prompt_id: str) -> Optional[PromptModel]
Toggle a prompt's active state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The ID of the prompt to toggle. |
required |
Returns:
| Type | Description |
|---|---|
Optional[PromptModel]
|
Optional[PromptModel]: The updated |
Source code in src/owui_client/routers/prompts.py
get_prompt_history
get_prompt_history(prompt_id: str, page: int = 0) -> List[PromptHistoryResponse]
Get version history for a prompt.
Returns paginated history entries ordered by creation time (newest first).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
page
|
int
|
Page number (0-indexed, default 0). |
0
|
Returns:
| Type | Description |
|---|---|
List[PromptHistoryResponse]
|
List[PromptHistoryResponse]: List of history entries with user info. |
Source code in src/owui_client/routers/prompts.py
get_prompt_history_entry
get_prompt_history_entry(prompt_id: str, history_id: str) -> PromptHistoryModel
Get a specific version from history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
history_id
|
str
|
The unique identifier of the history entry. |
required |
Returns:
| Type | Description |
|---|---|
PromptHistoryModel
|
|
Source code in src/owui_client/routers/prompts.py
delete_prompt_history_entry
Delete a history entry.
Cannot delete the active production version. Children are reparented to grandparent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
history_id
|
str
|
The unique identifier of the history entry. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if successful. |
Source code in src/owui_client/routers/prompts.py
get_prompt_diff
get_prompt_diff(prompt_id: str, from_id: str, to_id: str) -> PromptDiffResponse
Get diff between two prompt versions.
Computes a unified diff of the content between two history entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt_id
|
str
|
The unique identifier of the prompt. |
required |
from_id
|
str
|
ID of the source (from) history entry. |
required |
to_id
|
str
|
ID of the target (to) history entry. |
required |
Returns:
| Type | Description |
|---|---|
PromptDiffResponse
|
|