From c1fc18efc6e31a3c11f5068b0a710371249dadfe Mon Sep 17 00:00:00 2001 From: hzm <> Date: Thu, 13 Mar 2025 17:30:01 +0800 Subject: [PATCH] update the naming from WebToolkit to BrowserToolkit in new version and add Azure OpenAI configuration to the app_en.py. --- owl/.env_template | 8 ++++---- owl/app_en.py | 30 ++++++++++++++++++++++++++++++ owl/run_azure_openai.py | 4 ++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/owl/.env_template b/owl/.env_template index e0e20c5..48a4e4e 100644 --- a/owl/.env_template +++ b/owl/.env_template @@ -5,10 +5,10 @@ # OPENAI_API_BASE_URL="" # Azure OpenAI API -AZURE_OPENAI_BASE_URL="" -AZURE_API_VERSION="" -AZURE_OPENAI_API_KEY="" -AZURE_DEPLOYMENT_NAME="" +# AZURE_OPENAI_BASE_URL="" +# AZURE_API_VERSION="" +# AZURE_OPENAI_API_KEY="" +# AZURE_DEPLOYMENT_NAME="" # Qwen API (https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key) diff --git a/owl/app_en.py b/owl/app_en.py index 094c1f5..b955ef6 100644 --- a/owl/app_en.py +++ b/owl/app_en.py @@ -40,6 +40,7 @@ SCRIPTS = { "Default": "run.py", "GAIA Roleplaying": "run_gaia_roleplaying.py", "OpenAI Compatible": "run_openai_compatiable_model.py", + "Azure OpenAI": "run_azure_openai.py", "Ollama": "run_ollama.py", "Terminal": "run_terminal.py", } @@ -53,6 +54,7 @@ SCRIPT_DESCRIPTIONS = { "Default": "Default OWL implementation, uses OpenAI GPT-4o model and full set of tools", "GAIA Roleplaying": "GAIA benchmark implementation, used to evaluate model capabilities", "OpenAI Compatible": "Uses third-party models compatible with OpenAI API, supports custom API endpoints", + "Azure OpenAI": "Uses Azure OpenAI API", "Ollama": "Uses Ollama API", "Terminal": "Uses local terminal to execute python files", } @@ -74,6 +76,34 @@ ENV_GROUPS = { "required": False, "help": "Base URL for OpenAI API, optional. Set this if using a proxy or custom endpoint.", }, + { + "name": "AZURE_OPENAI_KEY", + "label": "Azure OpenAI API Key", + "type": "password", + "required": False, + "help": "Azure OpenAI API key for accessing Azure deployed GPT models. Get it from: https://portal.azure.com/", + }, + { + "name": "AZURE_OPENAI_ENDPOINT", + "label": "Azure OpenAI Endpoint", + "type": "text", + "required": False, + "help": "Azure OpenAI service endpoint URL", + }, + { + "name": "AZURE_DEPLOYMENT_NAME", + "label": "Azure OpenAI Deployment Name", + "type": "text", + "required": False, + "help": "Azure OpenAI service deployment name", + }, + { + "name": "AZURE_OPENAI_VERSION", + "label": "Azure OpenAI API Version", + "type": "text", + "required": False, + "help": "Azure OpenAI API version, e.g. 2023-12-01-preview", + }, { "name": "QWEN_API_KEY", "label": "Alibaba Cloud Qwen API Key", diff --git a/owl/run_azure_openai.py b/owl/run_azure_openai.py index 4442a20..edbe27f 100644 --- a/owl/run_azure_openai.py +++ b/owl/run_azure_openai.py @@ -20,7 +20,7 @@ from camel.toolkits import ( ExcelToolkit, ImageAnalysisToolkit, SearchToolkit, - WebToolkit, + BrowserToolkit, FileWriteToolkit, ) from camel.types import ModelPlatformType @@ -61,7 +61,7 @@ def construct_society(question: str) -> OwlRolePlaying: # Configure toolkits tools = [ - *WebToolkit( + *BrowserToolkit( headless=False, # Set to True for headless mode (e.g., on remote servers) web_agent_model=models["web"], planning_agent_model=models["planning"],