functions
Classes
FunctionsClient
FunctionsClient(client: OWUIClientBase)
Bases: ResourceBase
Client for the Functions endpoints.
- Code Reference client Classes OpenWebUI Attributes functions
Source code in src/owui_client/client_base.py
Functions
get_functions
get_functions() -> list[FunctionResponse]
Get all functions.
Returns:
| Type | Description |
|---|---|
list[FunctionResponse]
|
list[FunctionResponse]: A list of all functions. |
Source code in src/owui_client/routers/functions.py
get_function_list
get_function_list() -> list[FunctionUserResponse]
Get list of functions with user info.
Returns:
| Type | Description |
|---|---|
list[FunctionUserResponse]
|
list[FunctionUserResponse]: A list of functions including user details. |
Source code in src/owui_client/routers/functions.py
export_functions
export_functions(
include_valves: bool = False,
) -> list[Union[FunctionModel, FunctionWithValvesModel]]
Export functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_valves
|
bool
|
Whether to include valve configurations in the export. |
False
|
Returns:
| Type | Description |
|---|---|
list[Union[FunctionModel, FunctionWithValvesModel]]
|
list[Union[ |
Source code in src/owui_client/routers/functions.py
load_function_from_url
Load a function from a URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to load the function from. |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
Optional[dict]: A dictionary containing the function name and content if successful. |
Source code in src/owui_client/routers/functions.py
sync_functions
sync_functions(
functions: list[FunctionWithValvesModel],
) -> list[FunctionWithValvesModel]
Sync functions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
functions
|
list[FunctionWithValvesModel]
|
A list of functions to sync. |
required |
Returns:
| Type | Description |
|---|---|
list[FunctionWithValvesModel]
|
list[FunctionWithValvesModel]: The list of synced functions. |
Source code in src/owui_client/routers/functions.py
create_function
create_function(
form_data: FunctionForm,
) -> Optional[FunctionResponse]
Create a new function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
form_data
|
FunctionForm
|
The function data to create. |
required |
Returns:
| Type | Description |
|---|---|
Optional[FunctionResponse]
|
Optional[FunctionResponse]: The created function details. |
Source code in src/owui_client/routers/functions.py
get_function_by_id
get_function_by_id(id: str) -> Optional[FunctionModel]
Get a function by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function. |
required |
Returns:
| Type | Description |
|---|---|
Optional[FunctionModel]
|
Optional[FunctionModel]: The function details if found. |
Source code in src/owui_client/routers/functions.py
toggle_function_by_id
toggle_function_by_id(id: str) -> Optional[FunctionModel]
Toggle a function's active state by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function. |
required |
Returns:
| Type | Description |
|---|---|
Optional[FunctionModel]
|
Optional[FunctionModel]: The updated function details. |
Source code in src/owui_client/routers/functions.py
toggle_global_by_id
toggle_global_by_id(id: str) -> Optional[FunctionModel]
Toggle a function's global state by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function. |
required |
Returns:
| Type | Description |
|---|---|
Optional[FunctionModel]
|
Optional[FunctionModel]: The updated function details. |
Source code in src/owui_client/routers/functions.py
update_function_by_id
update_function_by_id(
id: str, form_data: FunctionForm
) -> Optional[FunctionModel]
Update a function by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function to update. |
required |
form_data
|
FunctionForm
|
The updated function data. |
required |
Returns:
| Type | Description |
|---|---|
Optional[FunctionModel]
|
Optional[FunctionModel]: The updated function details. |
Source code in src/owui_client/routers/functions.py
delete_function_by_id
Delete a function by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function to delete. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the function was deleted successfully. |
Source code in src/owui_client/routers/functions.py
get_function_valves_by_id
Get function valves by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function. |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
Optional[dict]: The function valves configuration. |
Source code in src/owui_client/routers/functions.py
get_function_valves_spec_by_id
Get function valves specification by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function. |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
Optional[dict]: The function valves specification (schema). |
Source code in src/owui_client/routers/functions.py
update_function_valves_by_id
Update function valves by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function. |
required |
valves
|
dict
|
The new valves configuration. |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
Optional[dict]: The updated valves configuration. |
Source code in src/owui_client/routers/functions.py
get_function_user_valves_by_id
Get function user valves by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function. |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
Optional[dict]: The function user valves configuration. |
Source code in src/owui_client/routers/functions.py
get_function_user_valves_spec_by_id
Get function user valves specification by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function. |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
Optional[dict]: The function user valves specification (schema). |
Source code in src/owui_client/routers/functions.py
update_function_user_valves_by_id
Update function user valves by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the function. |
required |
valves
|
dict
|
The new user valves configuration. |
required |
Returns:
| Type | Description |
|---|---|
Optional[dict]
|
Optional[dict]: The updated user valves configuration. |