Skip to content

Commit

Permalink
update backend model name&price
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkwee committed May 7, 2024
1 parent bbb1450 commit 38efd45
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions camel/model_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ def run(self, *args, **kwargs):
"gpt-4": 8192,
"gpt-4-0613": 8192,
"gpt-4-32k": 32768,
"gpt-4-1106-preview": 4096,
"gpt-4-1106-vision-preview": 4096,
"gpt-4-turbo": 100000,
}
num_max_token = num_max_token_map[self.model_type.value]
num_max_completion_tokens = num_max_token - num_prompt_tokens
Expand Down Expand Up @@ -122,6 +121,7 @@ def run(self, *args, **kwargs):
"gpt-4": 8192,
"gpt-4-0613": 8192,
"gpt-4-32k": 32768,
"gpt-4-turbo": 100000,
}
num_max_token = num_max_token_map[self.model_type.value]
num_max_completion_tokens = num_max_token - num_prompt_tokens
Expand Down
4 changes: 2 additions & 2 deletions camel/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class ModelType(Enum):
GPT_3_5_TURBO_NEW = "gpt-3.5-turbo-16k"
GPT_4 = "gpt-4"
GPT_4_32k = "gpt-4-32k"
GPT_4_TURBO = "gpt-4-1106-preview"
GPT_4_TURBO_V = "gpt-4-1106-vision-preview"
GPT_4_TURBO = "gpt-4-turbo"
GPT_4_TURBO_V = "gpt-4-turbo"

STUB = "stub"

Expand Down
12 changes: 5 additions & 7 deletions chatdev/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,25 @@

def prompt_cost(model_type: str, num_prompt_tokens: float, num_completion_tokens: float):
input_cost_map = {
"gpt-3.5-turbo": 0.0015,
"gpt-3.5-turbo": 0.0005,
"gpt-3.5-turbo-16k": 0.003,
"gpt-3.5-turbo-0613": 0.0015,
"gpt-3.5-turbo-16k-0613": 0.003,
"gpt-4": 0.03,
"gpt-4-0613": 0.03,
"gpt-4-32k": 0.06,
"gpt-4-1106-preview": 0.01,
"gpt-4-1106-vision-preview": 0.01,
"gpt-4-turbo": 0.01,
}

output_cost_map = {
"gpt-3.5-turbo": 0.002,
"gpt-3.5-turbo": 0.0015,
"gpt-3.5-turbo-16k": 0.004,
"gpt-3.5-turbo-0613": 0.002,
"gpt-3.5-turbo-16k-0613": 0.004,
"gpt-4": 0.06,
"gpt-4-0613": 0.06,
"gpt-4-32k": 0.12,
"gpt-4-1106-preview": 0.03,
"gpt-4-1106-vision-preview": 0.03,
"gpt-4-turbo": 0.03,
}

if model_type not in input_cost_map or model_type not in output_cost_map:
Expand Down Expand Up @@ -112,7 +110,7 @@ def get_info(dir, log_filepath):
elif model_type == "GPT_4_32k":
model_type = "gpt-4-32k"
elif model_type == "GPT_4_TURBO":
model_type = "gpt-4-1106-preview"
model_type = "gpt-4-turbo"
# print("model_type:", model_type)

lines = open(log_filepath, "r", encoding="utf8").read().split("\n")
Expand Down
6 changes: 3 additions & 3 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_config(company):
parser.add_argument('--name', type=str, default="Gomoku",
help="Name of software, your software will be generated in WareHouse/name_org_timestamp")
parser.add_argument('--model', type=str, default="GPT_3_5_TURBO",
help="GPT Model, choose from {'GPT_3_5_TURBO','GPT_4','GPT_4_32K', 'GPT_4_TURBO'}")
help="GPT Model, choose from {'GPT_3_5_TURBO', 'GPT_4', 'GPT_4_TURBO'}")
parser.add_argument('--path', type=str, default="",
help="Your file directory, ChatDev will build upon your software in the Incremental mode")
args = parser.parse_args()
Expand All @@ -92,9 +92,9 @@ def get_config(company):
config_path, config_phase_path, config_role_path = get_config(args.config)
args2type = {'GPT_3_5_TURBO': ModelType.GPT_3_5_TURBO,
'GPT_4': ModelType.GPT_4,
'GPT_4_32K': ModelType.GPT_4_32k,
# 'GPT_4_32K': ModelType.GPT_4_32k,
'GPT_4_TURBO': ModelType.GPT_4_TURBO,
'GPT_4_TURBO_V': ModelType.GPT_4_TURBO_V
# 'GPT_4_TURBO_V': ModelType.GPT_4_TURBO_V
}
if openai_new_api:
args2type['GPT_3_5_TURBO'] = ModelType.GPT_3_5_TURBO_NEW
Expand Down

0 comments on commit 38efd45

Please sign in to comment.