Wendong-Fan commited on
Commit
0848a53
·
1 Parent(s): 49d629c

minor update

Browse files
README.md CHANGED
@@ -384,7 +384,7 @@ You can run OWL agent with your own task by modifying the `examples/run.py` scri
384
 
385
  ```python
386
  # Define your own task
387
- question = "Task description here."
388
 
389
  society = construct_society(question)
390
  answer, chat_history, token_count = run_society(society)
@@ -396,7 +396,7 @@ For uploading files, simply provide the file path along with your question:
396
 
397
  ```python
398
  # Task with a local file (e.g., file path: `tmp/example.docx`)
399
- question = "What is in the given DOCX file? Here is the file path: tmp/example.docx"
400
 
401
  society = construct_society(question)
402
  answer, chat_history, token_count = run_society(society)
 
384
 
385
  ```python
386
  # Define your own task
387
+ task = "Task description here."
388
 
389
  society = construct_society(question)
390
  answer, chat_history, token_count = run_society(society)
 
396
 
397
  ```python
398
  # Task with a local file (e.g., file path: `tmp/example.docx`)
399
+ task = "What is in the given DOCX file? Here is the file path: tmp/example.docx"
400
 
401
  society = construct_society(question)
402
  answer, chat_history, token_count = run_society(society)
README_zh.md CHANGED
@@ -377,7 +377,7 @@ python examples/run_ollama.py
377
 
378
  ```python
379
  # Define your own task
380
- question = "Task description here."
381
 
382
  society = construct_society(question)
383
  answer, chat_history, token_count = run_society(society)
@@ -389,7 +389,7 @@ print(f"\033[94mAnswer: {answer}\033[0m")
389
 
390
  ```python
391
  # 处理本地文件(例如,文件路径为 `tmp/example.docx`)
392
- question = "给定的 DOCX 文件中有什么内容?文件路径如下:tmp/example.docx"
393
 
394
  society = construct_society(question)
395
  answer, chat_history, token_count = run_society(society)
 
377
 
378
  ```python
379
  # Define your own task
380
+ task = "Task description here."
381
 
382
  society = construct_society(question)
383
  answer, chat_history, token_count = run_society(society)
 
389
 
390
  ```python
391
  # 处理本地文件(例如,文件路径为 `tmp/example.docx`)
392
+ task = "给定的 DOCX 文件中有什么内容?文件路径如下:tmp/example.docx"
393
 
394
  society = construct_society(question)
395
  answer, chat_history, token_count = run_society(society)
examples/run.py CHANGED
@@ -11,6 +11,8 @@
11
  # See the License for the specific language governing permissions and
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
 
 
14
  from dotenv import load_dotenv
15
  from camel.models import ModelFactory
16
  from camel.toolkits import (
@@ -29,8 +31,6 @@ from camel.societies import RolePlaying
29
 
30
  from owl.utils import run_society, DocumentProcessingToolkit
31
 
32
- import pathlib
33
-
34
  base_dir = pathlib.Path(__file__).parent.parent
35
  env_path = base_dir / "owl" / ".env"
36
  load_dotenv(dotenv_path=str(env_path))
@@ -60,7 +60,7 @@ def construct_society(question: str) -> RolePlaying:
60
  model_type=ModelType.GPT_4O,
61
  model_config_dict={"temperature": 0},
62
  ),
63
- "web": ModelFactory.create(
64
  model_platform=ModelPlatformType.OPENAI,
65
  model_type=ModelType.GPT_4O,
66
  model_config_dict={"temperature": 0},
@@ -130,11 +130,14 @@ def construct_society(question: str) -> RolePlaying:
130
 
131
  def main():
132
  r"""Main function to run the OWL system with an example question."""
133
- # Example research question
134
- question = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
 
 
 
135
 
136
  # Construct and run the society
137
- society = construct_society(question)
138
  answer, chat_history, token_count = run_society(society)
139
 
140
  # Output the result
 
11
  # See the License for the specific language governing permissions and
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
+ import sys
15
+ import pathlib
16
  from dotenv import load_dotenv
17
  from camel.models import ModelFactory
18
  from camel.toolkits import (
 
31
 
32
  from owl.utils import run_society, DocumentProcessingToolkit
33
 
 
 
34
  base_dir = pathlib.Path(__file__).parent.parent
35
  env_path = base_dir / "owl" / ".env"
36
  load_dotenv(dotenv_path=str(env_path))
 
60
  model_type=ModelType.GPT_4O,
61
  model_config_dict={"temperature": 0},
62
  ),
63
+ "browsing": ModelFactory.create(
64
  model_platform=ModelPlatformType.OPENAI,
65
  model_type=ModelType.GPT_4O,
66
  model_config_dict={"temperature": 0},
 
130
 
131
  def main():
132
  r"""Main function to run the OWL system with an example question."""
133
+ # Default research question
134
+ default_task = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
135
+
136
+ # Override default task if command line argument is provided
137
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
138
 
139
  # Construct and run the society
140
+ society = construct_society(task)
141
  answer, chat_history, token_count = run_society(society)
142
 
143
  # Output the result
examples/run_azure_openai.py CHANGED
@@ -12,6 +12,7 @@
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  import os
 
15
  from dotenv import load_dotenv
16
  from camel.configs import ChatGPTConfig
17
  from camel.models import ModelFactory
@@ -58,7 +59,7 @@ def construct_society(question: str) -> OwlRolePlaying:
58
  models = {
59
  "user": ModelFactory.create(**base_model_config),
60
  "assistant": ModelFactory.create(**base_model_config),
61
- "web": ModelFactory.create(**base_model_config),
62
  "planning": ModelFactory.create(**base_model_config),
63
  "image": ModelFactory.create(**base_model_config),
64
  }
@@ -104,10 +105,14 @@ def construct_society(question: str) -> OwlRolePlaying:
104
  def main():
105
  r"""Main function to run the OWL system with Azure OpenAI."""
106
  # Example question
107
- question = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
 
 
 
108
 
109
  # Construct and run the society
110
- society = construct_society(question)
 
111
  answer, chat_history, token_count = run_society(society)
112
 
113
  # Output the result
 
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  import os
15
+ import sys
16
  from dotenv import load_dotenv
17
  from camel.configs import ChatGPTConfig
18
  from camel.models import ModelFactory
 
59
  models = {
60
  "user": ModelFactory.create(**base_model_config),
61
  "assistant": ModelFactory.create(**base_model_config),
62
+ "browsing": ModelFactory.create(**base_model_config),
63
  "planning": ModelFactory.create(**base_model_config),
64
  "image": ModelFactory.create(**base_model_config),
65
  }
 
105
  def main():
106
  r"""Main function to run the OWL system with Azure OpenAI."""
107
  # Example question
108
+ default_task = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
109
+
110
+ # Override default task if command line argument is provided
111
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
112
 
113
  # Construct and run the society
114
+ society = construct_society(task)
115
+
116
  answer, chat_history, token_count = run_society(society)
117
 
118
  # Output the result
examples/run_cli.py CHANGED
@@ -110,7 +110,7 @@ def construct_society() -> RolePlaying:
110
  model_type=selected_model_type,
111
  model_config_dict={"temperature": 0},
112
  ),
113
- "web": ModelFactory.create(
114
  model_platform=selected_model_platform,
115
  model_type=selected_model_type,
116
  model_config_dict={"temperature": 0},
@@ -143,7 +143,6 @@ def construct_society() -> RolePlaying:
143
  headless=False,
144
  web_agent_model=models["web"],
145
  planning_agent_model=models["planning"],
146
- output_language="Chinese",
147
  ).get_tools(),
148
  *VideoAnalysisToolkit(model=models["video"]).get_tools(),
149
  *CodeExecutionToolkit(sandbox="subprocess", verbose=True).get_tools(),
 
110
  model_type=selected_model_type,
111
  model_config_dict={"temperature": 0},
112
  ),
113
+ "browsing": ModelFactory.create(
114
  model_platform=selected_model_platform,
115
  model_type=selected_model_type,
116
  model_config_dict={"temperature": 0},
 
143
  headless=False,
144
  web_agent_model=models["web"],
145
  planning_agent_model=models["planning"],
 
146
  ).get_tools(),
147
  *VideoAnalysisToolkit(model=models["video"]).get_tools(),
148
  *CodeExecutionToolkit(sandbox="subprocess", verbose=True).get_tools(),
examples/run_deepseek_zh.py CHANGED
@@ -17,7 +17,7 @@
17
  # You can obtain your API key from DeepSeek platform: https://platform.deepseek.com/api_keys
18
  # Set it as DEEPSEEK_API_KEY="your-api-key" in your .env file or add it to your environment variables
19
 
20
-
21
  from dotenv import load_dotenv
22
 
23
  from camel.models import ModelFactory
@@ -102,10 +102,14 @@ def construct_society(question: str) -> RolePlaying:
102
  def main():
103
  r"""Main function to run the OWL system with an example question."""
104
  # Example research question
105
- question = "搜索OWL项目最近的新闻并生成一篇报告,最后保存到本地。"
 
 
 
106
 
107
  # Construct and run the society
108
- society = construct_society(question)
 
109
  answer, chat_history, token_count = run_society(society)
110
 
111
  # Output the result
 
17
  # You can obtain your API key from DeepSeek platform: https://platform.deepseek.com/api_keys
18
  # Set it as DEEPSEEK_API_KEY="your-api-key" in your .env file or add it to your environment variables
19
 
20
+ import sys
21
  from dotenv import load_dotenv
22
 
23
  from camel.models import ModelFactory
 
102
  def main():
103
  r"""Main function to run the OWL system with an example question."""
104
  # Example research question
105
+ default_task = "搜索OWL项目最近的新闻并生成一篇报告,最后保存到本地。"
106
+
107
+ # Override default task if command line argument is provided
108
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
109
 
110
  # Construct and run the society
111
+ society = construct_society(task)
112
+
113
  answer, chat_history, token_count = run_society(society)
114
 
115
  # Output the result
examples/run_gaia_roleplaying.py CHANGED
@@ -71,7 +71,7 @@ def main():
71
  model_type=ModelType.GPT_4O,
72
  model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(),
73
  ),
74
- "web": ModelFactory.create(
75
  model_platform=ModelPlatformType.OPENAI,
76
  model_type=ModelType.GPT_4O,
77
  model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(),
 
71
  model_type=ModelType.GPT_4O,
72
  model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(),
73
  ),
74
+ "browsing": ModelFactory.create(
75
  model_platform=ModelPlatformType.OPENAI,
76
  model_type=ModelType.GPT_4O,
77
  model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(),
examples/run_groq.py CHANGED
@@ -26,6 +26,7 @@ To use this module:
26
  3. Run with: python -m examples.run_groq
27
  """
28
 
 
29
  from dotenv import load_dotenv
30
  from camel.models import ModelFactory
31
  from camel.toolkits import (
@@ -70,7 +71,7 @@ def construct_society(question: str) -> OwlRolePlaying:
70
  model_type=ModelType.GROQ_LLAMA_3_3_70B, # Main assistant needs tool capability
71
  model_config_dict={"temperature": 0},
72
  ),
73
- "web": ModelFactory.create(
74
  model_platform=ModelPlatformType.GROQ,
75
  model_type=ModelType.GROQ_LLAMA_3_3_70B, # Web browsing requires tool usage
76
  model_config_dict={"temperature": 0},
@@ -141,13 +142,18 @@ def construct_society(question: str) -> OwlRolePlaying:
141
  def main():
142
  r"""Main function to run the OWL system with an example question."""
143
  # Example research question
144
- question = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
145
 
146
  # Construct and run the society
147
  # Note: This configuration uses GROQ_LLAMA_3_3_70B for tool-intensive roles (assistant, web, planning, video, image)
148
  # and GROQ_MIXTRAL_8_7B for document processing. GROQ_LLAMA_3_1_8B is used only for the user role
149
  # which doesn't require tool usage capabilities.
150
- society = construct_society(question)
 
 
 
 
 
151
  answer, chat_history, token_count = run_society(society)
152
 
153
  # Output the result
 
26
  3. Run with: python -m examples.run_groq
27
  """
28
 
29
+ import sys
30
  from dotenv import load_dotenv
31
  from camel.models import ModelFactory
32
  from camel.toolkits import (
 
71
  model_type=ModelType.GROQ_LLAMA_3_3_70B, # Main assistant needs tool capability
72
  model_config_dict={"temperature": 0},
73
  ),
74
+ "browsing": ModelFactory.create(
75
  model_platform=ModelPlatformType.GROQ,
76
  model_type=ModelType.GROQ_LLAMA_3_3_70B, # Web browsing requires tool usage
77
  model_config_dict={"temperature": 0},
 
142
  def main():
143
  r"""Main function to run the OWL system with an example question."""
144
  # Example research question
145
+ default_task = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
146
 
147
  # Construct and run the society
148
  # Note: This configuration uses GROQ_LLAMA_3_3_70B for tool-intensive roles (assistant, web, planning, video, image)
149
  # and GROQ_MIXTRAL_8_7B for document processing. GROQ_LLAMA_3_1_8B is used only for the user role
150
  # which doesn't require tool usage capabilities.
151
+
152
+ # Override default task if command line argument is provided
153
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
154
+
155
+ # Construct and run the society
156
+ society = construct_society(task)
157
  answer, chat_history, token_count = run_society(society)
158
 
159
  # Output the result
examples/run_mcp.py CHANGED
@@ -73,6 +73,7 @@ Note:
73
  """
74
 
75
  import asyncio
 
76
  from pathlib import Path
77
  from typing import List
78
 
@@ -146,15 +147,19 @@ async def main():
146
  try:
147
  await mcp_toolkit.connect()
148
 
149
- question = (
 
150
  "I'd like a academic report about Andrew Ng, including "
151
  "his research direction, published papers (At least 3),"
152
  " institutions, etc. "
153
  )
154
 
 
 
 
155
  # Connect to all MCP toolkits
156
  tools = [*mcp_toolkit.get_tools()]
157
- society = await construct_society(question, tools)
158
  answer, chat_history, token_count = await arun_society(society)
159
  print(f"\033[94mAnswer: {answer}\033[0m")
160
 
 
73
  """
74
 
75
  import asyncio
76
+ import sys
77
  from pathlib import Path
78
  from typing import List
79
 
 
147
  try:
148
  await mcp_toolkit.connect()
149
 
150
+ # Default task
151
+ default_task = (
152
  "I'd like a academic report about Andrew Ng, including "
153
  "his research direction, published papers (At least 3),"
154
  " institutions, etc. "
155
  )
156
 
157
+ # Override default task if command line argument is provided
158
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
159
+
160
  # Connect to all MCP toolkits
161
  tools = [*mcp_toolkit.get_tools()]
162
+ society = await construct_society(task, tools)
163
  answer, chat_history, token_count = await arun_society(society)
164
  print(f"\033[94mAnswer: {answer}\033[0m")
165
 
examples/run_mini.py CHANGED
@@ -11,6 +11,7 @@
11
  # See the License for the specific language governing permissions and
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
 
14
  from dotenv import load_dotenv
15
 
16
  from camel.models import ModelFactory
@@ -58,7 +59,7 @@ def construct_society(question: str) -> RolePlaying:
58
  model_type=ModelType.GPT_4O,
59
  model_config_dict={"temperature": 0},
60
  ),
61
- "web": ModelFactory.create(
62
  model_platform=ModelPlatformType.OPENAI,
63
  model_type=ModelType.GPT_4O,
64
  model_config_dict={"temperature": 0},
@@ -106,11 +107,14 @@ def construct_society(question: str) -> RolePlaying:
106
 
107
  def main():
108
  r"""Main function to run the OWL system with an example question."""
109
- # Example research question
110
- question = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
 
 
 
111
 
112
  # Construct and run the society
113
- society = construct_society(question)
114
  answer, chat_history, token_count = run_society(society)
115
 
116
  # Output the result
 
11
  # See the License for the specific language governing permissions and
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
+ import sys
15
  from dotenv import load_dotenv
16
 
17
  from camel.models import ModelFactory
 
59
  model_type=ModelType.GPT_4O,
60
  model_config_dict={"temperature": 0},
61
  ),
62
+ "browsing": ModelFactory.create(
63
  model_platform=ModelPlatformType.OPENAI,
64
  model_type=ModelType.GPT_4O,
65
  model_config_dict={"temperature": 0},
 
107
 
108
  def main():
109
  r"""Main function to run the OWL system with an example question."""
110
+ # Default research question
111
+ default_task = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
112
+
113
+ # Override default task if command line argument is provided
114
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
115
 
116
  # Construct and run the society
117
+ society = construct_society(task)
118
  answer, chat_history, token_count = run_society(society)
119
 
120
  # Output the result
examples/run_ollama.py CHANGED
@@ -13,6 +13,7 @@
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  # run_ollama.py by tj-scripts(https://github.com/tj-scripts)
15
 
 
16
  from dotenv import load_dotenv
17
  from camel.models import ModelFactory
18
  from camel.toolkits import (
@@ -64,7 +65,7 @@ def construct_society(question: str) -> RolePlaying:
64
  url="http://localhost:11434/v1",
65
  model_config_dict={"temperature": 0.2, "max_tokens": 1000000},
66
  ),
67
- "web": ModelFactory.create(
68
  model_platform=ModelPlatformType.OLLAMA,
69
  model_type="llava:latest",
70
  url="http://localhost:11434/v1",
@@ -124,11 +125,14 @@ def construct_society(question: str) -> RolePlaying:
124
 
125
  def main():
126
  r"""Main function to run the OWL system with an example question."""
127
- # Example research question
128
- question = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
 
 
 
129
 
130
  # Construct and run the society
131
- society = construct_society(question)
132
  answer, chat_history, token_count = run_society(society)
133
 
134
  # Output the result
 
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  # run_ollama.py by tj-scripts(https://github.com/tj-scripts)
15
 
16
+ import sys
17
  from dotenv import load_dotenv
18
  from camel.models import ModelFactory
19
  from camel.toolkits import (
 
65
  url="http://localhost:11434/v1",
66
  model_config_dict={"temperature": 0.2, "max_tokens": 1000000},
67
  ),
68
+ "browsing": ModelFactory.create(
69
  model_platform=ModelPlatformType.OLLAMA,
70
  model_type="llava:latest",
71
  url="http://localhost:11434/v1",
 
125
 
126
  def main():
127
  r"""Main function to run the OWL system with an example question."""
128
+ # Default research question
129
+ default_task = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
130
+
131
+ # Override default task if command line argument is provided
132
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
133
 
134
  # Construct and run the society
135
+ society = construct_society(task)
136
  answer, chat_history, token_count = run_society(society)
137
 
138
  # Output the result
examples/run_openai_compatiable_model.py CHANGED
@@ -12,6 +12,7 @@
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  import os
 
15
 
16
  from dotenv import load_dotenv
17
  from camel.models import ModelFactory
@@ -64,7 +65,7 @@ def construct_society(question: str) -> RolePlaying:
64
  url="https://dashscope.aliyuncs.com/compatible-mode/v1",
65
  model_config_dict={"temperature": 0.4, "max_tokens": 4096},
66
  ),
67
- "web": ModelFactory.create(
68
  model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
69
  model_type="qwen-vl-max",
70
  api_key=os.getenv("QWEN_API_KEY"),
@@ -128,10 +129,14 @@ def construct_society(question: str) -> RolePlaying:
128
  def main():
129
  r"""Main function to run the OWL system with an example question."""
130
  # Example research question
131
- question = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
 
 
 
132
 
133
  # Construct and run the society
134
- society = construct_society(question)
 
135
  answer, chat_history, token_count = run_society(society)
136
 
137
  # Output the result
 
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  import os
15
+ import sys
16
 
17
  from dotenv import load_dotenv
18
  from camel.models import ModelFactory
 
65
  url="https://dashscope.aliyuncs.com/compatible-mode/v1",
66
  model_config_dict={"temperature": 0.4, "max_tokens": 4096},
67
  ),
68
+ "browsing": ModelFactory.create(
69
  model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL,
70
  model_type="qwen-vl-max",
71
  api_key=os.getenv("QWEN_API_KEY"),
 
129
  def main():
130
  r"""Main function to run the OWL system with an example question."""
131
  # Example research question
132
+ default_task = "Navigate to Amazon.com and identify one product that is attractive to coders. Please provide me with the product name and price. No need to verify your answer."
133
+
134
+ # Override default task if command line argument is provided
135
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
136
 
137
  # Construct and run the society
138
+ society = construct_society(task)
139
+
140
  answer, chat_history, token_count = run_society(society)
141
 
142
  # Output the result
examples/run_qwen_mini_zh.py CHANGED
@@ -17,7 +17,7 @@
17
  # Set it as QWEN_API_KEY="your-api-key" in your .env file or add it to your environment variables
18
 
19
  from dotenv import load_dotenv
20
-
21
  from camel.models import ModelFactory
22
  from camel.toolkits import BrowserToolkit, SearchToolkit, FileWriteToolkit
23
  from camel.types import ModelPlatformType, ModelType
@@ -101,9 +101,14 @@ def construct_society(question: str) -> RolePlaying:
101
 
102
 
103
  # Example case
104
- question = "浏览亚马逊并找出一款对程序员有吸引力的产品。请提供产品名称和价格"
 
 
 
 
 
 
105
 
106
- society = construct_society(question)
107
  answer, chat_history, token_count = run_society(society)
108
 
109
  print(f"\033[94mAnswer: {answer}\033[0m")
 
17
  # Set it as QWEN_API_KEY="your-api-key" in your .env file or add it to your environment variables
18
 
19
  from dotenv import load_dotenv
20
+ import sys
21
  from camel.models import ModelFactory
22
  from camel.toolkits import BrowserToolkit, SearchToolkit, FileWriteToolkit
23
  from camel.types import ModelPlatformType, ModelType
 
101
 
102
 
103
  # Example case
104
+ default_task = "浏览亚马逊并找出一款对程序员有吸引力的产品。请提供产品名称和价格"
105
+
106
+ # Override default task if command line argument is provided
107
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
108
+
109
+ # Construct and run the society
110
+ society = construct_society(task)
111
 
 
112
  answer, chat_history, token_count = run_society(society)
113
 
114
  print(f"\033[94mAnswer: {answer}\033[0m")
examples/run_qwen_zh.py CHANGED
@@ -16,6 +16,7 @@
16
  # You can obtain your API key from Bailian platform: bailian.console.aliyun.com
17
  # Set it as QWEN_API_KEY="your-api-key" in your .env file or add it to your environment variables
18
 
 
19
  from dotenv import load_dotenv
20
  from camel.models import ModelFactory
21
  from camel.toolkits import (
@@ -67,7 +68,7 @@ def construct_society(question: str) -> RolePlaying:
67
  model_type=ModelType.QWEN_MAX,
68
  model_config_dict={"temperature": 0},
69
  ),
70
- "web": ModelFactory.create(
71
  model_platform=ModelPlatformType.QWEN,
72
  model_type=ModelType.QWEN_VL_MAX,
73
  model_config_dict={"temperature": 0},
@@ -140,10 +141,13 @@ def construct_society(question: str) -> RolePlaying:
140
  def main():
141
  r"""Main function to run the OWL system with an example question."""
142
  # Example research question
143
- question = "浏览亚马逊并找出一款对程序员有吸引力的产品。请提供产品名称和价格"
 
 
 
144
 
145
  # Construct and run the society
146
- society = construct_society(question)
147
  answer, chat_history, token_count = run_society(society)
148
 
149
  # Output the result
 
16
  # You can obtain your API key from Bailian platform: bailian.console.aliyun.com
17
  # Set it as QWEN_API_KEY="your-api-key" in your .env file or add it to your environment variables
18
 
19
+ import sys
20
  from dotenv import load_dotenv
21
  from camel.models import ModelFactory
22
  from camel.toolkits import (
 
68
  model_type=ModelType.QWEN_MAX,
69
  model_config_dict={"temperature": 0},
70
  ),
71
+ "browsing": ModelFactory.create(
72
  model_platform=ModelPlatformType.QWEN,
73
  model_type=ModelType.QWEN_VL_MAX,
74
  model_config_dict={"temperature": 0},
 
141
  def main():
142
  r"""Main function to run the OWL system with an example question."""
143
  # Example research question
144
+ default_task = "浏览亚马逊并找出一款对程序员有吸引力的产品。请提供产品名称和价格"
145
+
146
+ # Override default task if command line argument is provided
147
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
148
 
149
  # Construct and run the society
150
+ society = construct_society(task)
151
  answer, chat_history, token_count = run_society(society)
152
 
153
  # Output the result
examples/run_terminal.py CHANGED
@@ -12,6 +12,7 @@
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  from dotenv import load_dotenv
 
15
  import os
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
@@ -58,7 +59,7 @@ def construct_society(question: str) -> RolePlaying:
58
  model_type=ModelType.GPT_4O,
59
  model_config_dict={"temperature": 0},
60
  ),
61
- "web": ModelFactory.create(
62
  model_platform=ModelPlatformType.OPENAI,
63
  model_type=ModelType.GPT_4O,
64
  model_config_dict={"temperature": 0},
@@ -108,13 +109,16 @@ def construct_society(question: str) -> RolePlaying:
108
  def main():
109
  r"""Main function to run the OWL system with an example question."""
110
  # Example research question
111
- question = f"""Open Google Search, summarize the number of GitHub stars, forks, etc., of the camel framework of camel-ai,
112
  and write the numbers into a Python file using the plot package,
113
  save it to "+{os.path.join(base_dir, 'final_output')}+",
114
  and execute the Python file with the local terminal to display the graph for me."""
115
 
 
 
 
116
  # Construct and run the society
117
- society = construct_society(question)
118
  answer, chat_history, token_count = run_society(society)
119
 
120
  # Output the result
 
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  from dotenv import load_dotenv
15
+ import sys
16
  import os
17
  from camel.models import ModelFactory
18
  from camel.toolkits import (
 
59
  model_type=ModelType.GPT_4O,
60
  model_config_dict={"temperature": 0},
61
  ),
62
+ "browsing": ModelFactory.create(
63
  model_platform=ModelPlatformType.OPENAI,
64
  model_type=ModelType.GPT_4O,
65
  model_config_dict={"temperature": 0},
 
109
  def main():
110
  r"""Main function to run the OWL system with an example question."""
111
  # Example research question
112
+ default_task = f"""Open Google Search, summarize the number of GitHub stars, forks, etc., of the camel framework of camel-ai,
113
  and write the numbers into a Python file using the plot package,
114
  save it to "+{os.path.join(base_dir, 'final_output')}+",
115
  and execute the Python file with the local terminal to display the graph for me."""
116
 
117
+ # Override default task if command line argument is provided
118
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
119
+
120
  # Construct and run the society
121
+ society = construct_society(task)
122
  answer, chat_history, token_count = run_society(society)
123
 
124
  # Output the result
examples/run_terminal_zh.py CHANGED
@@ -12,6 +12,7 @@
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  from dotenv import load_dotenv
 
15
  import os
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
@@ -58,7 +59,7 @@ def construct_society(question: str) -> RolePlaying:
58
  model_type=ModelType.GPT_4O,
59
  model_config_dict={"temperature": 0},
60
  ),
61
- "web": ModelFactory.create(
62
  model_platform=ModelPlatformType.OPENAI,
63
  model_type=ModelType.GPT_4O,
64
  model_config_dict={"temperature": 0},
@@ -108,11 +109,14 @@ def construct_society(question: str) -> RolePlaying:
108
  def main():
109
  r"""Main function to run the OWL system with an example question."""
110
  # Example research question
111
- question = f"""打开百度搜索,总结一下camel-ai的camel框架的github star、fork数目等,并把数字用plot包写成python文件保存到"+{os.path.join
112
  (base_dir, 'final_output')}+",用本地终端执行python文件显示图出来给我"""
113
 
 
 
 
114
  # Construct and run the society
115
- society = construct_society(question)
116
  answer, chat_history, token_count = run_society(society)
117
 
118
  # Output the result
 
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  from dotenv import load_dotenv
15
+ import sys
16
  import os
17
  from camel.models import ModelFactory
18
  from camel.toolkits import (
 
59
  model_type=ModelType.GPT_4O,
60
  model_config_dict={"temperature": 0},
61
  ),
62
+ "browsing": ModelFactory.create(
63
  model_platform=ModelPlatformType.OPENAI,
64
  model_type=ModelType.GPT_4O,
65
  model_config_dict={"temperature": 0},
 
109
  def main():
110
  r"""Main function to run the OWL system with an example question."""
111
  # Example research question
112
+ default_task = f"""打开百度搜索,总结一下camel-ai的camel框架的github star、fork数目等,并把数字用plot包写成python文件保存到"+{os.path.join
113
  (base_dir, 'final_output')}+",用本地终端执行python文件显示图出来给我"""
114
 
115
+ # Override default task if command line argument is provided
116
+ task = sys.argv[1] if len(sys.argv) > 1 else default_task
117
+
118
  # Construct and run the society
119
+ society = construct_society(task)
120
  answer, chat_history, token_count = run_society(society)
121
 
122
  # Output the result