utils
Client for the Utils endpoints.
Classes
UtilsClient
UtilsClient(client: OWUIClientBase)
Bases: ResourceBase
Client for utility operations such as Gravatar, code formatting/execution, markdown conversion, and database downloads.
- Code Reference client Classes OpenWebUI Attributes utils
Source code in src/owui_client/client_base.py
Functions
get_gravatar
Get the Gravatar URL for a given email address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
The email address to retrieve the Gravatar URL for. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The URL of the Gravatar image. |
Source code in src/owui_client/routers/utils.py
format_code
format_code(form_data: CodeForm) -> Dict[str, str]
Format the provided code using Black (Python formatter).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form_data
|
CodeForm
|
The |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
A dictionary containing the formatted code under the "code" key. |
Source code in src/owui_client/routers/utils.py
execute_code
execute_code(form_data: CodeForm) -> Dict
Execute the provided code using a Jupyter kernel.
Note: Code execution must be enabled and configured (e.g., Jupyter URL) on the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form_data
|
CodeForm
|
The |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
The output of the code execution from Jupyter. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If the code execution engine is not supported or configured. |
Source code in src/owui_client/routers/utils.py
get_html_from_markdown
get_html_from_markdown(
form_data: MarkdownForm,
) -> Dict[str, str]
Convert Markdown content to HTML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form_data
|
MarkdownForm
|
The |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
A dictionary containing the generated HTML under the "html" key. |
Source code in src/owui_client/routers/utils.py
download_chat_as_pdf
download_chat_as_pdf(
form_data: ChatTitleMessagesForm,
) -> bytes
Generate and download a PDF version of a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form_data
|
ChatTitleMessagesForm
|
The |
required |
Returns:
| Type | Description |
|---|---|
bytes
|
The PDF file content as bytes. |
Source code in src/owui_client/routers/utils.py
download_db
Download the database file.
Note: Requires admin privileges and ENABLE_ADMIN_EXPORT must be True.
Only supported for SQLite databases.
Returns:
| Type | Description |
|---|---|
bytes
|
The database file content as bytes. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If access is prohibited or the database is not SQLite. |