zjrwtx commited on
Commit
e10a48c
·
1 Parent(s): 4cf8660

more powerful run_terminal_demo

Browse files
Files changed (2) hide show
  1. owl/run_terminal.py +7 -3
  2. owl/run_terminal_zh.py +8 -3
owl/run_terminal.py CHANGED
@@ -12,7 +12,7 @@
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
17
  from camel.toolkits import (
18
  SearchToolkit,
@@ -27,7 +27,8 @@ from utils import OwlRolePlaying, run_society
27
 
28
  load_dotenv()
29
  set_log_level(level="DEBUG")
30
-
 
31
 
32
  def construct_society(question: str) -> OwlRolePlaying:
33
  r"""Construct a society of agents based on the given question.
@@ -102,7 +103,10 @@ def construct_society(question: str) -> OwlRolePlaying:
102
  def main():
103
  r"""Main function to run the OWL system with an example question."""
104
  # Example research question
105
- question = "Open Google Search, summarize the number of GitHub stars, forks, etc., of the camel framework of camel-ai, and write the numbers into a Python file using the plot package, save it locally, and execute the Python file with the local terminal to display the graph for me."
 
 
 
106
 
107
  # Construct and run the society
108
  society = construct_society(question)
 
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 (
18
  SearchToolkit,
 
27
 
28
  load_dotenv()
29
  set_log_level(level="DEBUG")
30
+ # Get current script directory
31
+ base_dir = os.path.dirname(os.path.abspath(__file__))
32
 
33
  def construct_society(question: str) -> OwlRolePlaying:
34
  r"""Construct a society of agents based on the given question.
 
103
  def main():
104
  r"""Main function to run the OWL system with an example question."""
105
  # Example research question
106
+ question = f"""Open Google Search, summarize the number of GitHub stars, forks, etc., of the camel framework of camel-ai,
107
+ and write the numbers into a Python file using the plot package,
108
+ save it to "+{os.path.join(base_dir, 'final_output')}+",
109
+ and execute the Python file with the local terminal to display the graph for me."""
110
 
111
  # Construct and run the society
112
  society = construct_society(question)
owl/run_terminal_zh.py CHANGED
@@ -27,7 +27,9 @@ from utils import OwlRolePlaying, run_society
27
 
28
  load_dotenv()
29
  set_log_level(level="DEBUG")
30
-
 
 
31
 
32
  def construct_society(question: str) -> OwlRolePlaying:
33
  r"""Construct a society of agents based on the given question.
@@ -102,8 +104,11 @@ def construct_society(question: str) -> OwlRolePlaying:
102
  def main():
103
  r"""Main function to run the OWL system with an example question."""
104
  # Example research question
105
- question = "打开谷歌搜索,总结一下camel-ai的camel框架的github star、fork数目等,并把数字用plot包写成python文件保存到本地,用本地终端执行python文件显示图出来给我"
106
-
 
 
 
107
  # Construct and run the society
108
  society = construct_society(question)
109
  answer, chat_history, token_count = run_society(society)
 
27
 
28
  load_dotenv()
29
  set_log_level(level="DEBUG")
30
+ import os
31
+ # Get current script directory
32
+ base_dir = os.path.dirname(os.path.abspath(__file__))
33
 
34
  def construct_society(question: str) -> OwlRolePlaying:
35
  r"""Construct a society of agents based on the given question.
 
104
  def main():
105
  r"""Main function to run the OWL system with an example question."""
106
  # Example research question
107
+ question = f"""打开百度搜索,总结一下camel-ai的camel框架的github star、fork数目等,并把数字用plot包写成python文件保存到"+{os.path.join
108
+ (base_dir, 'final_output')}+",用本地终端执行python文件显示图出来给我"""
109
+ # question=f"""Create 'app.log' in the logs directory at '{os.path.join
110
+ # (base_dir, 'logs')}' with content: 'INFO: Application started successfully at
111
+ # 2024-03-10'"""
112
  # Construct and run the society
113
  society = construct_society(question)
114
  answer, chat_history, token_count = run_society(society)