LLM agent workflows
Project description
🇨🇳中文 | 🌐English | 📖文档/Docs | 🤖模型/Models
ActionFlow: A Human-Centric Framework for Large Language Model Agent Workflows
actionflow: A Human-Centric Framework for Large Language Model Agent Workflows
Features
ActionFlow
是一个LLMs驱动的工作流构建工具,支持如下功能:
- 在标准Json文件中以自然语言(prompt)编写工作流
- 工作流不仅支持多个prompt命令,还支持工具调用(tool_calls)
- 基于变量名动态更改prompt输入
Install
pip install -U actionflow
or
git clone https://github.com/shibing624/actionflow.git
cd actionflow
pip install -e .
Usage
- Sign up for the OpenAI API and get an API key
- Clone or download this repository.
- Create a
.env
file from example.env and add your OpenAI API key. - Run
pip install -r requirements.txt
to install dependencies.
Now you can run flows from the command line, like this:
cd examples
python run_flow_demo.py --flow_path flows/example.json
Optional Arguments
Use variables
to pass variables to your flow
python run_flow_demo.py --flow_path flows/example_with_variables.json --variables 'market=college students' 'price_point=$50'
Create New Flows
Copy example.json or create a flow from scratch in this format:
{
"system_message": "An optional message that guides the model's behavior.",
"tasks": [
{
"action": "Instruct the LLM here!"
},
{
"action": "Actions can have settings, including function calls and temperature, like so:",
"settings": {
"tool_name": "save_file",
"temperature": 0.8
}
},
{
"action": "..."
}
]
}
Create New Functions
Copy save_file.py and modify it, or follow these instructions (replace "tool_name" with your tool name):
- Create
tool_name.py
in the tools folder. - Create a class within called
ToolName
that inherits fromBaseFunction
. - Add
get_definition()
andexecute()
in the class. See descriptions of these inBaseTool
.
That's it! You can now use your function in tool_name
as shown above.
Contact
- Issue(建议)
:
- 邮件我:xuming: xuming624@qq.com
- 微信我: 加我微信号:xuming624, 备注:姓名-公司-NLP 进NLP交流群。
Citation
如果你在研究中使用了actionflow
,请按如下格式引用:
APA:
Xu, M. actionflow: A Human-Centric Framework for Large Language Model Agent Workflows (Version 1.0.1) [Computer software]. https://github.com/shibing624/actionflow
BibTeX:
@misc{Xu_actionflow,
title={actionflow: A Human-Centric Framework for Large Language Model Agent Workflows},
author={Xu Ming},
year={2024},
howpublished={\url{https://github.com/shibing624/actionflow}},
}
License
授权协议为 The Apache License 2.0,可免费用做商业用途。请在产品说明中附加actionflow
的链接和授权协议。
Contribute
项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目,在提交之前,注意以下两点:
- 在
tests
添加相应的单元测试 - 使用
python -m pytest
来运行所有单元测试,确保所有单测都是通过的
之后即可提交PR。
Acknowledgements
- https://github.com/langchain-ai/langchain
- https://github.com/shibing624/actionflow/blob/main/actionflow Thanks for their great work!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
actionflow-0.0.2.tar.gz
(22.5 kB
view hashes)