Code Monkey home page Code Monkey logo

actionflow's Introduction

🇨🇳中文 | 🌐English


ActionFlow: Agent Workflows with Prompts and Tools

PyPI version Downloads Contributions welcome License Apache 2.0 python_version GitHub issues Wechat Group

actionflow: A Human-Centric Framework for Large Language Model Agent Workflows

ActionFlow是一个LLMs驱动的工作流构建工具,支持如下功能:

  • 通过自然语言(prompt)在json文件中编排复杂工作流
  • 工作流的编排不仅支持多个prompt命令,还支持工具调用(tool_calls)
  • 基于变量名动态更改prompt输入
  • 支持OpenAI API和Moonshot API(kimi)调用

Install

pip install -U actionflow

or

git clone https://github.com/shibing624/actionflow.git
cd actionflow
pip install -e .

Usage

  1. 复制example.env文件为.env,并粘贴OpenAI API key或者Moonshoot API key。

  2. 运行actionflow示例:

cd examples
python run_flow_demo.py --flow_path flows/example.json

可选参数

使用variables参数

python run_flow_demo.py --flow_path flows/example_with_variables.json --variables 'market=college students' 'price_point=$50'

新建工作流(Flow)

复制 examples/flows/example.json 或者按照如下格式创建一个工作流(json文件):

{
    "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": "..."
        }
    ]
}

新建工具(Tools)

复制 actionflow/tools/save_file.py 并修改,或者按如下指引新增一个工具(记得替换tool_name为你的工具名):

  1. actionflow/tools文件夹新增tool_name.py
  2. 新建类ToolName 继承自BaseTool
  3. 在类中新增get_definition()execute()方法,具体参考BaseTool

这样,你就可以在工作流中使用新增的tool_name工具。

Contact

  • Issue(建议) :GitHub issues
  • 邮件我:xuming: [email protected]
  • 微信我: 加我微信号:xuming624, 备注:姓名-公司-NLP 进NLP交流群。

Citation

如果你在研究中使用了actionflow,请按如下格式引用:

APA:

Xu, M. actionflow: A Human-Centric Framework for Large Language Model Agent Workflows (Version 0.0.2) [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

Thanks for their great work!

actionflow's People

Contributors

shibing624 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.