QwenLM / Qwen-Agent

Agent framework and applications built upon Qwen2, featuring Function Calling, Code Interpreter, RAG, and Chrome extension.
https://pypi.org/project/qwen-agent/
Other
2.51k stars 249 forks source link

Move tools like `code_interpreter` in an optional package #177

Open ligaz opened 1 month ago

ligaz commented 1 month ago

Currently the Python package for qwen-agent has all the tools including code_interpreter. However if you are not using this tool in your setup there is no need to install its dependencies.

Consider moving this tool into an optional package like:

qwen-agent[code_interpreter]
ligaz commented 1 week ago

@JianxinMa Do you have any thoughts on this one?

JianxinMa commented 1 week ago

@JianxinMa Do you have any thoughts on this one?

Hi, may I ask which dependency in the requirements.txt you find to be particularly troublesome? I will check if it is related to the code interpreter and mark it as optional.

ligaz commented 1 week ago

They are:

JianxinMa commented 4 days ago

Hello,

Running pip install qwen-agent by default installs the dependencies for code interpreter.

However, if you prefer not to install these optional dependencies, you can now install qwen-agent with the commands below:

curl -O https://raw.githubusercontent.com/QwenLM/Qwen-Agent/main/requirements.txt
pip install -r requirements.txt
pip install -U --no-deps "qwen-agent>=0.0.6"

P.S.: I'm hesitant to make the code interpreter dependencies optional by default, as some users may voice complaints, particularly those who do not read the README.

ligaz commented 4 days ago

@JianxinMa Thanks. I have already workaround this on my end by installing qwen-agent with --no-deps and manually listing out all relevant dependencies that are needed for the core functionality.

Nevertheless I do believe it makes more sense to extract different tools into different optional extra packages. For example keywork_search right now imports jieba and snowballstemmer which are not needed if your are not using RAG.

This way you will have the core agent framework and a couple of extra packages for rag, code_interpreter, etc.

ligaz commented 2 days ago

We should also note that currently the base agent module imports all tools (regarding of whether you are using them or not).

Importing the Agent class: https://github.com/QwenLM/Qwen-Agent/blob/94431706e5998ee6f4f1afcffc2bed7a7078c2dc/qwen_agent/agent.py#L11

which results in all those imports: https://github.com/QwenLM/Qwen-Agent/blob/94431706e5998ee6f4f1afcffc2bed7a7078c2dc/qwen_agent/tools/__init__.py#L1-L30

JianxinMa commented 2 days ago

We should also note that currently the base agent module imports all tools (regarding of whether you are using them or not).

Importing the Agent class:

https://github.com/QwenLM/Qwen-Agent/blob/94431706e5998ee6f4f1afcffc2bed7a7078c2dc/qwen_agent/agent.py#L11

which results in all those imports:

https://github.com/QwenLM/Qwen-Agent/blob/94431706e5998ee6f4f1afcffc2bed7a7078c2dc/qwen_agent/tools/__init__.py#L1-L30

Thanks for the reminder! In version 0.0.6, I have modified the code interpreter-related imports such that they are lazy, meaning they are only imported when actually needed. As for the RAG-related imports, I will make them lazy as well when I have the time.