-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc:Tools #292
Doc:Tools #292
Conversation
5264e32
to
e9ab658
Compare
Updated tool doc
title: "🔧📖 Tool Development Guide" | ||
--- | ||
# 🔧📖 Tool Development Guide | ||
This documentation provides a complete guide for developers to create tools compatible with Open WebUI. By following these guidelines, you can ensure that your tools are efficient, user-friendly, and integrate well with the platform. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
efficient, user-friendly
is misleading
def __init__(self): | ||
pass | ||
``` | ||
### file_handler: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a heading above this to mention these two are reserved instance attributes
``` --> | ||
<!-- --- --> | ||
## Frontmatter Requirements | ||
Each tool should define its requirements and parameters in the frontmatter. The frontmatter must: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameters
?
|
||
1. Begin and end with triple backticks ("""). | ||
|
||
2. Start with a description (optional), followed by key-value pairs for parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be more detailed here
```python | ||
requirements: numpy, pandas | ||
``` | ||
### Versioning: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
term Versioning
is misleading.
### Versioning: | ||
Information about the required version of Open WebUI for compatibility. This ensures that the tool runs on the appropriate version of the platform. Example: | ||
|
||
```python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide full frontmatter.
``` | ||
--- | ||
## Function Documentation | ||
All functions must use [**Sphinx-style docstrings**](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html) for documentation. This ensures clarity, consistency, and compatibility for generating tool specifications. The docstring will be used to communicate to the model about the tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm
This ensures clarity, consistency, and compatibility for generating tool specifications.
Guidelines: | ||
1. Use Sphinx-style Format: The docstrings should include parameter and return type information. | ||
2. Description: Begin with a brief description of the function. | ||
3. Parameters: Document each parameter with its name and description (except for __user__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not true, not just __user__
, it's all reversed params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- and 3. should really be merged
:::info | ||
Guidelines: | ||
1. Use Sphinx-style Format: The docstrings should include parameter and return type information. | ||
2. Description: Begin with a brief description of the function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicitly mention "function docstring"
:::tip | ||
Reserved params do not require type hints. | ||
::: | ||
### Some of the supported types for tool parameters: String, Integer, Number, Boolean, Array, Object, Null, Literal, Optional. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary
|
||
|
||
## Valves and User Valves | ||
Valves are optional configurations that control a tool's behavior. The key difference is that valves can only be configured by admins, whereas user valves can be set by any user to suit their individual needs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capitalise Valves
|
||
They can be defined as follows: | ||
|
||
```python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visual aids would be helpful here.
self.valves = self.Valves() | ||
pass | ||
``` | ||
> **Note:** As you can see, you can give default value to valves and user valves. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
|
||
![Event_emitter Demo](/img/demo-event-emit.gif) | ||
|
||
You can pass event emitter directly to your function as input, and use it as follow: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a parameter
{ | ||
"type": "status", # We set the type here | ||
"data": {"description": "Message that shows up in the chat", "done": False}, | ||
# Note done is False here indicating we are still emitting statuses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misleading, "done": False
is used to display loading indicator from the frontend.
{ | ||
"type": "status", | ||
"data": {"description": "Completed a task message", "done": True}, | ||
# Note done is True here indicating we are done emitting statuses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again misleading
return f"Tell the user: {e}" | ||
``` | ||
|
||
### Sending messages: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are many different sub types for this.
|
||
### Citation | ||
|
||
It is possible also to sent citations using event emitter with **citation** type: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
send
*
|
||
|
||
## Event Calls | ||
Event Calls are a powerful way to communicate with users while your tool is running. They let you share messages, update progress, handle errors, and even gather user feedback in real time, making your workflows more interactive and adaptable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They let you share messages, update progress, handle errors
?
|
||
![Even_call Demo](/img/demo-event-call.gif) | ||
|
||
You can pass event call directly to your function as input, and use it as follow: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here a parameter
Now that Tools are enabled for the model, you can click the “+” icon when chatting with an LLM to use various Tools. Please keep in mind that enabling a Tool does not force it to be used. It means the LLM will be provided the option to call this Tool. | ||
|
||
Lastly, we do provide a filter function on the community site that allows LLMs to autoselect Tools without you needing to enable them in the “+” icon menu: https://openwebui.com/f/hub/autotool_filter/ | ||
## What sorts of things can Tools do? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What can you do with Tools?
--- | ||
|
||
## What are Tools? | ||
Tools are python scripts that are provided to an LLM at the time of the request. Tools allow LLMs to perform actions and receive additional context as a result. Generally speaking, your LLM of choice will need to support function calling for tools to be reliably utilized. | ||
Tools are Python scripts provided to a LLM, during a request, enabling the LLM to perform specific actions or access additional context. To use Tools, the LLM must support **function calling**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To use Tools, the LLM must support **function calling**.
misleading.
|
||
Lastly, we do provide a filter function on the community site that allows LLMs to autoselect Tools without you needing to enable them in the “+” icon menu: https://openwebui.com/f/hub/autotool_filter/ | ||
## What sorts of things can Tools do? | ||
Tools empower LLMs with diverse functionalities to enrich interactive conversations, such as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verbose
1) Navigate to the [community site](https://openwebui.com/tools/): | ||
2) Click on the Tool you wish to import | ||
3) Click the blue “Get” button in the top right-hand corner of the page | ||
4) Enter the IP address of your OpenWebUI instance and click “Import to WebUI” which will automatically open your instance and allow you to import the Tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IP address
-> Url
|
||
Please note: when using the AutoTool Filter, you will still need to take the steps above to enable the Tools per model. | ||
- [**Web Search**](https://openwebui.com/t/constliakos/web_search/): Fetch live, real-time information from the web. | ||
- [**Image Generation**](https://openwebui.com/t/justinrahb/image_gen/): Create images based on user prompts. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add How to get started
section here.
## How to set Valves and User Valves | ||
Valves and User Valves are configuration options that allow admins and users to customize how Tools behave. | ||
|
||
### Valves |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed here anymore.
Feel free to reopen after addressing all the comments and squashing your commits. Appreciate the effort. |
--- | ||
|
||
## Introduction | ||
Open WebUI allows developers to extend its functionality by building custom tools using **pure python**. To maintain consistency and usability across the platform, it is essential to follow the development standards outlined in this guide. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To maintain consistency and usability
? Misleading here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at the end add one example and start analyzing the code and let the readers know how they all work in tandem
Doc: The tool user and development manual
The tool user and development manual
Doc:Tools
Tools usar guide