ragflow/web/src/pages/flow
Song Fuchang a1f06a4fdc
Feat: Support tool calling in Generate component (#7572)
### What problem does this PR solve?

Hello, our use case requires LLM agent to invoke some tools, so I made a
simple implementation here.

This PR does two things:

1. A simple plugin mechanism based on `pluginlib`:

This mechanism lives in the `plugin` directory. It will only load
plugins from `plugin/embedded_plugins` for now.

A sample plugin `bad_calculator.py` is placed in
`plugin/embedded_plugins/llm_tools`, it accepts two numbers `a` and `b`,
then give a wrong result `a + b + 100`.

In the future, it can load plugins from external location with little
code change.

Plugins are divided into different types. The only plugin type supported
in this PR is `llm_tools`, which must implement the `LLMToolPlugin`
class in the `plugin/llm_tool_plugin.py`.
More plugin types can be added in the future.

2. A tool selector in the `Generate` component:

Added a tool selector to select one or more tools for LLM:


![image](https://github.com/user-attachments/assets/74a21fdf-9333-4175-991b-43df6524c5dc)

And with the `bad_calculator` tool, it results this with the `qwen-max`
model:


![image](https://github.com/user-attachments/assets/93aff9c4-8550-414a-90a2-1a15a5249d94)


### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):

Co-authored-by: Yingfeng <yingfeng.zhang@gmail.com>
2025-05-16 16:32:19 +08:00
..
canvas add show debug (#7390) 2025-05-12 17:15:19 +08:00
chat Fix:Agent running message i10n (#7635) 2025-05-14 14:27:12 +08:00
debug-content Feat: Support knowledge base type input in agent flow debugger (#7471) 2025-05-06 19:30:27 +08:00
flow-drawer Feat: Add the JS code (or other) executor component to Agent. #4977 (#7677) 2025-05-16 09:53:00 +08:00
flow-id-modal Feat: Add Template operator #3556 (#3559) 2024-11-21 18:05:31 +08:00
flow-setting Fix: Resolve FlowSetting not reading Title from .ts files (#6469) 2025-03-25 11:07:29 +08:00
flow-sider feat: Add hint for operators, round to square, input variable, readable operator ID. #3056 (#3057) 2024-10-28 14:31:19 +08:00
form Feat: Support tool calling in Generate component (#7572) 2025-05-16 16:32:19 +08:00
header Feat: add agent share team viewer (#6222) 2025-03-19 19:04:13 +08:00
history-version-modal Feat: support agent version history. (#6130) 2025-03-19 15:22:53 +08:00
hooks Iframe should support input variables (#5156) 2025-02-20 11:52:44 +08:00
json-upload-modal Feat: Import & export the agents. #3851 (#3894) 2024-12-06 13:43:17 +08:00
list Fix: InfiniteScroll sometimes can not fetch next page (#7550) 2025-05-12 17:15:55 +08:00
operator-icon feat: Add hint for operators, round to square, input variable, readable operator ID. #3056 (#3057) 2024-10-28 14:31:19 +08:00
run-drawer Feat: Add the iteration Node #4242 (#4247) 2024-12-27 11:24:17 +08:00
constant.tsx Feat: Add the JS code (or other) executor component to Agent. #4977 (#7677) 2025-05-16 09:53:00 +08:00
context.ts Feat: Add VariablePickerMenuPlugin to select variables in the prompt text box by menu #4764 (#4765) 2025-02-08 18:09:13 +08:00
customer_service.json feat: create flow from dsl template #918 (#1351) 2024-07-03 14:42:48 +08:00
flow-tooltip.tsx Feat: Add FilesTable #3221 (#4491) 2025-01-15 14:39:33 +08:00
form-hooks.ts feat: Add hint for operators, round to square, input variable, readable operator ID. #3056 (#3057) 2024-10-28 14:31:19 +08:00
headhunter_zh.json feat: customize edge arrow #918 (#1338) 2024-07-02 11:43:57 +08:00
hooks.tsx Feat: Add the JS code (or other) executor component to Agent. #4977 (#7677) 2025-05-16 09:53:00 +08:00
index.tsx Feat: The Begin and IterationStart operators cannot be deleted using shortcut keys #4287 (#4288) 2024-12-30 17:47:47 +08:00
interface.ts Feat: The Begin and IterationStart operators cannot be deleted using shortcut keys #4287 (#4288) 2024-12-30 17:47:47 +08:00
interpreter.json feat: create blank canvas #918 (#1356) 2024-07-03 17:06:48 +08:00
mock.tsx Feat: The Begin and IterationStart operators cannot be deleted using shortcut keys #4287 (#4288) 2024-12-30 17:47:47 +08:00
retrieval_relevant_rewrite_and_generate.json feat: build nodes and edges from chat bot dsl #918 (#1372) 2024-07-04 15:15:14 +08:00
store.ts Feat: The Begin and IterationStart operators cannot be deleted using shortcut keys #4287 (#4288) 2024-12-30 17:47:47 +08:00
utils.test.ts feat: build nodes and edges from chat bot dsl #918 (#1372) 2024-07-04 15:15:14 +08:00
utils.ts Feat: Add VariablePickerMenuPlugin to select variables in the prompt text box by menu #4764 (#4765) 2025-02-08 18:09:13 +08:00