some docs fix
Browse files- README.md +2 -2
- README_zh.md +2 -2
- owl/run_deepseek_example.py +3 -3
- owl/run_qwq_demo.py +93 -0
README.md
CHANGED
@@ -232,8 +232,8 @@ If you find this repo useful, please cite:
|
|
232 |
# 🔥 Community
|
233 |
Join us for further discussions!
|
234 |
<!--  -->
|
235 |
-

|
237 |
|
238 |
# ❓ FAQ
|
239 |
|
|
|
232 |
# 🔥 Community
|
233 |
Join us for further discussions!
|
234 |
<!--  -->
|
235 |
+

|
236 |
+
<!--  -->
|
237 |
|
238 |
# ❓ FAQ
|
239 |
|
README_zh.md
CHANGED
@@ -226,8 +226,8 @@ python run_gaia_roleplaying.py
|
|
226 |
# 🔥 社区
|
227 |
加入我们,参与更多讨论!
|
228 |
<!--  -->
|
229 |
-

|
231 |
|
232 |
# ❓ 常见问题
|
233 |
|
|
|
226 |
# 🔥 社区
|
227 |
加入我们,参与更多讨论!
|
228 |
<!--  -->
|
229 |
+

|
230 |
+
<!--  -->
|
231 |
|
232 |
# ❓ 常见问题
|
233 |
|
owl/run_deepseek_example.py
CHANGED
@@ -35,15 +35,15 @@ def construct_society(question: str) -> OwlRolePlaying:
|
|
35 |
|
36 |
tools_list = [
|
37 |
*WebToolkit(
|
38 |
-
headless=False,
|
39 |
web_agent_model=assistant_model,
|
40 |
planning_agent_model=assistant_model
|
41 |
).get_tools(),
|
42 |
*DocumentProcessingToolkit().get_tools(),
|
43 |
-
*VideoAnalysisToolkit().get_tools(), # This requires OpenAI and Qwen Key
|
44 |
*CodeExecutionToolkit(sandbox="subprocess", verbose=True).get_tools(),
|
45 |
*ImageAnalysisToolkit(model=assistant_model).get_tools(),
|
46 |
-
*AudioAnalysisToolkit().get_tools(), # This requires OpenAI Key
|
47 |
*SearchToolkit(model=assistant_model).get_tools(),
|
48 |
*ExcelToolkit().get_tools()
|
49 |
]
|
|
|
35 |
|
36 |
tools_list = [
|
37 |
*WebToolkit(
|
38 |
+
headless=False, # Set to True if you want to run in headless mode (e.g. on a remote server)
|
39 |
web_agent_model=assistant_model,
|
40 |
planning_agent_model=assistant_model
|
41 |
).get_tools(),
|
42 |
*DocumentProcessingToolkit().get_tools(),
|
43 |
+
# *VideoAnalysisToolkit().get_tools(), # This requires OpenAI and Qwen Key
|
44 |
*CodeExecutionToolkit(sandbox="subprocess", verbose=True).get_tools(),
|
45 |
*ImageAnalysisToolkit(model=assistant_model).get_tools(),
|
46 |
+
# *AudioAnalysisToolkit().get_tools(), # This requires OpenAI Key
|
47 |
*SearchToolkit(model=assistant_model).get_tools(),
|
48 |
*ExcelToolkit().get_tools()
|
49 |
]
|
owl/run_qwq_demo.py
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
load_dotenv()
|
4 |
+
|
5 |
+
from camel.models import ModelFactory
|
6 |
+
from camel.toolkits import *
|
7 |
+
from camel.types import ModelPlatformType, ModelType
|
8 |
+
from camel.configs import ChatGPTConfig
|
9 |
+
|
10 |
+
from typing import List, Dict
|
11 |
+
|
12 |
+
from retry import retry
|
13 |
+
from loguru import logger
|
14 |
+
|
15 |
+
from utils import OwlRolePlaying, run_society
|
16 |
+
import os
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
def construct_society(question: str) -> OwlRolePlaying:
|
22 |
+
r"""Construct the society based on the question."""
|
23 |
+
|
24 |
+
user_role_name = "user"
|
25 |
+
assistant_role_name = "assistant"
|
26 |
+
|
27 |
+
user_model = ModelFactory.create(
|
28 |
+
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
|
29 |
+
model_type="qwq-32b",
|
30 |
+
api_key=os.getenv("QWEN_API_KEY"),
|
31 |
+
url="https://dashscope.aliyuncs.com/compatible-mode/v1",
|
32 |
+
model_config_dict={"temperature": 0.4, "max_tokens": 4096},
|
33 |
+
)
|
34 |
+
|
35 |
+
assistant_model = ModelFactory.create(
|
36 |
+
model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
|
37 |
+
model_type="qwq-32b",
|
38 |
+
api_key=os.getenv("QWEN_API_KEY"),
|
39 |
+
url="https://dashscope.aliyuncs.com/compatible-mode/v1",
|
40 |
+
model_config_dict={"temperature": 0.4, "max_tokens": 4096},
|
41 |
+
)
|
42 |
+
|
43 |
+
|
44 |
+
tools_list = [
|
45 |
+
*WebToolkit(
|
46 |
+
headless=False, # Set to True if you want to run in headless mode (e.g. on a remote server)
|
47 |
+
web_agent_model=assistant_model,
|
48 |
+
planning_agent_model=assistant_model
|
49 |
+
).get_tools(),
|
50 |
+
*DocumentProcessingToolkit().get_tools(),
|
51 |
+
# *VideoAnalysisToolkit(model=assistant_model).get_tools(), # This requires OpenAI Key
|
52 |
+
# *AudioAnalysisToolkit().get_tools(), # This requires OpenAI Key
|
53 |
+
*CodeExecutionToolkit().get_tools(),
|
54 |
+
*ImageAnalysisToolkit(model=assistant_model).get_tools(),
|
55 |
+
*SearchToolkit(model=assistant_model).get_tools(),
|
56 |
+
*ExcelToolkit().get_tools()
|
57 |
+
]
|
58 |
+
|
59 |
+
user_role_name = 'user'
|
60 |
+
user_agent_kwargs = dict(model=user_model)
|
61 |
+
assistant_role_name = 'assistant'
|
62 |
+
assistant_agent_kwargs = dict(model=assistant_model,
|
63 |
+
tools=tools_list)
|
64 |
+
|
65 |
+
task_kwargs = {
|
66 |
+
'task_prompt': question,
|
67 |
+
'with_task_specify': False,
|
68 |
+
}
|
69 |
+
|
70 |
+
society = OwlRolePlaying(
|
71 |
+
**task_kwargs,
|
72 |
+
user_role_name=user_role_name,
|
73 |
+
user_agent_kwargs=user_agent_kwargs,
|
74 |
+
assistant_role_name=assistant_role_name,
|
75 |
+
assistant_agent_kwargs=assistant_agent_kwargs,
|
76 |
+
)
|
77 |
+
|
78 |
+
return society
|
79 |
+
|
80 |
+
|
81 |
+
# Example case
|
82 |
+
question = "What was the volume in m^3 of the fish bag that was calculated in the University of Leicester paper `Can Hiccup Supply Enough Fish to Maintain a Dragon’s Diet?` "
|
83 |
+
|
84 |
+
society = construct_society(question)
|
85 |
+
answer, chat_history, token_count = run_society(society)
|
86 |
+
|
87 |
+
logger.success(f"Answer: {answer}")
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
|