more powerful run_terminal_demo (#243)

This commit is contained in:
Yifeng Wang(正经人王同学)
2025-03-12 22:14:15 +08:00
committed by GitHub
2 changed files with 15 additions and 6 deletions

View File

@@ -12,7 +12,7 @@
# limitations under the License.
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
from dotenv import load_dotenv
import os
from camel.models import ModelFactory
from camel.toolkits import (
SearchToolkit,
@@ -27,7 +27,8 @@ from utils import OwlRolePlaying, run_society
load_dotenv()
set_log_level(level="DEBUG")
# Get current script directory
base_dir = os.path.dirname(os.path.abspath(__file__))
def construct_society(question: str) -> OwlRolePlaying:
r"""Construct a society of agents based on the given question.
@@ -102,7 +103,10 @@ def construct_society(question: str) -> OwlRolePlaying:
def main():
r"""Main function to run the OWL system with an example question."""
# Example research question
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."
question = f"""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 to "+{os.path.join(base_dir, 'final_output')}+",
and execute the Python file with the local terminal to display the graph for me."""
# Construct and run the society
society = construct_society(question)

View File

@@ -27,7 +27,9 @@ from utils import OwlRolePlaying, run_society
load_dotenv()
set_log_level(level="DEBUG")
import os
# Get current script directory
base_dir = os.path.dirname(os.path.abspath(__file__))
def construct_society(question: str) -> OwlRolePlaying:
r"""Construct a society of agents based on the given question.
@@ -102,8 +104,11 @@ def construct_society(question: str) -> OwlRolePlaying:
def main():
r"""Main function to run the OWL system with an example question."""
# Example research question
question = "打开谷歌搜索总结一下camel-ai的camel框架的github star、fork数目等并把数字用plot包写成python文件保存到本地用本地终端执行python文件显示图出来给我"
question = f"""打开百度搜索总结一下camel-ai的camel框架的github star、fork数目等并把数字用plot包写成python文件保存到"+{os.path.join
(base_dir, 'final_output')}+"用本地终端执行python文件显示图出来给我"""
# question=f"""Create 'app.log' in the logs directory at '{os.path.join
# (base_dir, 'logs')}' with content: 'INFO: Application started successfully at
# 2024-03-10'"""
# Construct and run the society
society = construct_society(question)
answer, chat_history, token_count = run_society(society)