From 4b2d01b967b960c332c14525f00963178b12fce3 Mon Sep 17 00:00:00 2001 From: angjustinl <96008766+ANGJustinl@users.noreply.github.com> Date: Fri, 7 Mar 2025 13:10:54 +0800 Subject: [PATCH 1/2] feat: Temporary support for multiple model access point configurations --- owl/.env_template | 4 ++++ owl/run.py | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/owl/.env_template b/owl/.env_template index 2d06fc7..5c711e4 100644 --- a/owl/.env_template +++ b/owl/.env_template @@ -1,3 +1,7 @@ +# MODEL & API (See https://github.com/camel-ai/camel/blob/master/camel/types/enums.py) +DEFAULT_MODEL_PLATFORM_TYPE = "OPENAI" +DEFAULT_MODEL_TYPE = "gpt-4o" +OPENAI_API_BASE_URL = "" # OPENAI API OPENAI_API_KEY = "" diff --git a/owl/run.py b/owl/run.py index 39e74ae..701c885 100644 --- a/owl/run.py +++ b/owl/run.py @@ -22,14 +22,14 @@ def construct_society(question: str) -> OwlRolePlaying: assistant_role_name = "assistant" user_model = ModelFactory.create( - model_platform=ModelPlatformType.OPENAI, - model_type=ModelType.GPT_4O, + model_platform=ModelPlatformType.DEFAULT, + model_type=ModelType.DEFAULT, model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model ) assistant_model = ModelFactory.create( - model_platform=ModelPlatformType.OPENAI, - model_type=ModelType.GPT_4O, + model_platform=ModelPlatformType.DEFAULT, + model_type=ModelType.DEFAULT, model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model ) From 184908f62c5a07f76cdc0b1c7d36c4527a8de51a Mon Sep 17 00:00:00 2001 From: angjustinl <96008766+ANGJustinl@users.noreply.github.com> Date: Fri, 7 Mar 2025 13:26:49 +0800 Subject: [PATCH 2/2] fix: Load .env file before import. --- owl/run.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/owl/run.py b/owl/run.py index 701c885..9b17a1f 100644 --- a/owl/run.py +++ b/owl/run.py @@ -1,10 +1,13 @@ +from dotenv import load_dotenv +load_dotenv() + from camel.models import ModelFactory from camel.toolkits import * from camel.types import ModelPlatformType, ModelType from camel.configs import ChatGPTConfig from typing import List, Dict -from dotenv import load_dotenv + from retry import retry from loguru import logger @@ -12,7 +15,6 @@ from utils import OwlRolePlaying, process_tools, run_society import os -load_dotenv() def construct_society(question: str) -> OwlRolePlaying: