中文 | English
Qwen-Agent is a framework for harnessing the tool usage, planning, and memory capabilities of the open-source language model Qwen. Building upon Qwen-Agent, we have developed a Chrome browser extension called BrowserQwen, which has key features such as:
- Discuss with Qwen about the current web page or PDF document.
- BrowserQwen records the web pages and PDF materials that you have browsed, with your permission. It helps you quickly understand the contents of multiple pages, summarize your browsing content, and eliminate tedious writing tasks.
- Supports plugin intergration, including Code Interpreter for math problem solving and data visualization.
If you prefer watching videos instead of screenshots, you can refer to the video demonstration.
Long article creation based on browsed web pages and PDFs
Calling plugins to assist rich text creation
Multi-webpage QA
Drawing data charts using the code interpreter
Web page QA
PDF document QA
Supported platforms: MacOS, Linux, Windows.
You can skip this step if you are using the model service provided by DashScope from Alibaba Cloud.
However, if you prefer to deploy your own model service instead of using DashScope, please follow the following instruction provided by the Qwen project to deploy a model service compatible with the OpenAI API:
# Install dependencies.
git clone [email protected]:QwenLM/Qwen.git
cd Qwen
pip install -r requirements.txt
pip install fastapi uvicorn openai "pydantic>=2.3.0" sse_starlette
# Start the model service, specifying the model version with the -c parameter.
# --server-name 0.0.0.0 allows other machines to access your service.
# --server-name 127.0.0.1 only allows the machine deploying the model to access the service.
python openai_api.py --server-name 0.0.0.0 --server-port 7905 -c QWen/QWen-14B-Chat
Currently, we can specify the -c argument with the following models, ordered in increasing GPU memory consumption:
For the 7B models, please use the versions pulled from the official HuggingFace repository after September 25, 2023, as both the code and model weights have changed.
On your local machine (the machine where you can open the Chrome browser), you will need to deploy a database service to manage your browsing history and conversation history.
Please install the following dependencies if you have not done so already:
# Install dependencies.
git clone https://github.com/QwenLM/Qwen-Agent.git
cd Qwen-Agent
pip install -r requirements.txt
If you have skipped Step 1 and decided to use DashScope's model service, then please execute the following command:
# Start the database service, specifying the model on DashScope by using the --llm flag.
# The value of --llm can be one of the following, in increasing order of resource consumption:
# - qwen-7b-chat (the same as the open-sourced 7B-Chat model)
# - qwen-14b-chat (the same as the open-sourced 14B-Chat model)
# - qwen-turbo
# - qwen-plus
# You need to replace YOUR_DASHSCOPE_API_KEY with your actual api key.
export DASHSCOPE_API_KEY=YOUR_DASHSCOPE_API_KEY
python run_server.py --model_server dashscope --llm qwen-7b-chat --workstation_port 7864
If you have followed Step 1 and are using your own model service instead of DashScope, then please execute the following command:
# Start the database service, specifying the model service deployed in Step 1 with --model_server.
# If the IP address of the machine in Step 1 is 123.45.67.89,
# you can specify --model_server http://123.45.67.89:7905/v1
# If Step 1 and Step 2 are on the same machine,
# you can specify --model_server http://127.0.0.1:7905/v1
python run_server.py --model_server http://{MODEL_SERVER_IP}:7905/v1 --workstation_port 7864
Now you can access http://127.0.0.1:7864/ to use the Workstation's Editor mode and Chat mode.
For tips on using the Workstation, please refer to the instructions on the Workstation page or watch the video demonstration.
Install the BrowserQwen Chrome extension:
- Open the Chrome browser and enter
chrome://extensions/
in the address bar, then press Enter. - Make sure that the
Developer mode
in the top right corner is turned on, then click onLoad unpacked
to upload thebrowser_qwen
directory from this project and enable it. - Click the extension icon in the top right corner of the Chrome browser to pin BrowserQwen to the toolbar.
Note that after installing the Chrome extension, you need to refresh the page for the extension to take effect.
When you want Qwen to read the content of the current webpage:
- Click the
Add to Qwen's Reading List
button on the screen to authorize Qwen to analyze the page in the background. - Click the Qwen icon in the browser's top right corner to start interacting with Qwen about the current page's content.
You can watch the following showcase videos to learn about the basic operations of BrowserQwen:
- Long-form writing based on visited webpages and PDFs video
- Drawing a plot using code interpreter based on the given information video
- Uploading files, multi-turn conversation, and data analysis using code interpreter video
We have also open-sourced a benchmark for evaluating the performance of a model in writing Python code and using Code Interpreter for mathematical problem solving, data analysis, and other general tasks. The benchmark can be found in the benchmark directory. The current evaluation results are as follows:
Executable Rate of Generated Code (%) | |||
---|---|---|---|
Model | Math↑ | Visualization↑ | General↑ |
GPT-4 | 91.9 | 85.9 | 82.8 |
GPT-3.5 | 89.2 | 65.0 | 74.1 |
LLaMA2-7B-Chat | 41.9 | 33.1 | 24.1 |
LLaMA2-13B-Chat | 50.0 | 40.5 | 48.3 |
CodeLLaMA-7B-Instruct | 85.1 | 54.0 | 70.7 |
CodeLLaMA-13B-Instruct | 93.2 | 55.8 | 74.1 |
InternLM-7B-Chat-v1.1 | 78.4 | 44.2 | 62.1 |
InternLM-20B-Chat | 70.3 | 44.2 | 65.5 |
Qwen-7B-Chat | 82.4 | 64.4 | 67.2 |
Qwen-14B-Chat | 89.2 | 84.1 | 65.5 |
Accuracy of Code Execution Results (%) | |||
---|---|---|---|
Model | Math↑ | Visualization-Hard↑ | Visualization-Easy↑ |
GPT-4 | 82.8 | 66.7 | 60.8 |
GPT-3.5 | 47.3 | 33.3 | 55.7 |
LLaMA2-7B-Chat | 3.9 | 14.3 | 39.2 |
LLaMA2-13B-Chat | 8.3 | 8.3 | 40.5 |
CodeLLaMA-7B-Instruct | 14.3 | 26.2 | 60.8 |
CodeLLaMA-13B-Instruct | 28.2 | 27.4 | 62.0 |
InternLM-7B-Chat-v1.1 | 28.5 | 4.8 | 40.5 |
InternLM-20B-Chat | 34.6 | 21.4 | 45.6 |
Qwen-7B-Chat | 41.9 | 40.5 | 54.4 |
Qwen-14B-Chat | 58.4 | 53.6 | 59.5 |
Qwen-7B-Chat refers to the version updated after September 25, 2023.
This project is not intended to be an official product, rather it serves as a proof-of-concept project that highlights the capabilities of the Qwen series models.