|
11 | 11 | # See the License for the specific language governing permissions and |
12 | 12 | # limitations under the License. |
13 | 13 | # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. ========= |
| 14 | +import sys |
| 15 | +import pathlib |
14 | 16 | from dotenv import load_dotenv |
15 | 17 | from camel.models import ModelFactory |
16 | 18 | from camel.toolkits import ( |
|
29 | 31 |
|
30 | 32 | from owl.utils import run_society, DocumentProcessingToolkit |
31 | 33 |
|
32 | | -import pathlib |
33 | | - |
34 | 34 | base_dir = pathlib.Path(__file__).parent.parent |
35 | 35 | env_path = base_dir / "owl" / ".env" |
36 | 36 | load_dotenv(dotenv_path=str(env_path)) |
@@ -60,7 +60,7 @@ def construct_society(question: str) -> RolePlaying: |
60 | 60 | model_type=ModelType.GPT_4O, |
61 | 61 | model_config_dict={"temperature": 0}, |
62 | 62 | ), |
63 | | - "web": ModelFactory.create( |
| 63 | + "browsing": ModelFactory.create( |
64 | 64 | model_platform=ModelPlatformType.OPENAI, |
65 | 65 | model_type=ModelType.GPT_4O, |
66 | 66 | model_config_dict={"temperature": 0}, |
@@ -91,7 +91,7 @@ def construct_society(question: str) -> RolePlaying: |
91 | 91 | tools = [ |
92 | 92 | *BrowserToolkit( |
93 | 93 | headless=False, # Set to True for headless mode (e.g., on remote servers) |
94 | | - web_agent_model=models["web"], |
| 94 | + web_agent_model=models["browsing"], |
95 | 95 | planning_agent_model=models["planning"], |
96 | 96 | ).get_tools(), |
97 | 97 | *VideoAnalysisToolkit(model=models["video"]).get_tools(), |
@@ -130,11 +130,14 @@ def construct_society(question: str) -> RolePlaying: |
130 | 130 |
|
131 | 131 | def main(): |
132 | 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." |
| 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 |
135 | 138 |
|
136 | 139 | # Construct and run the society |
137 | | - society = construct_society(question) |
| 140 | + society = construct_society(task) |
138 | 141 | answer, chat_history, token_count = run_society(society) |
139 | 142 |
|
140 | 143 | # Output the result |
|
0 commit comments