Skip to content

Commit

Permalink
Merge pull request #1151 from gpt-engineer-org/ao/omni
Browse files Browse the repository at this point in the history
  • Loading branch information
captivus committed May 15, 2024
2 parents 151a51a + 63bd9e4 commit e23e02f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 55 deletions.
2 changes: 1 addition & 1 deletion gpt_engineer/applications/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def prompt_yesno() -> bool:
)
def main(
project_path: str = typer.Argument(".", help="path"),
model: str = typer.Argument("gpt-4-turbo", help="model id string"),
model: str = typer.Argument("gpt-4o", help="model id string"),
temperature: float = typer.Option(
0.1,
"--temperature",
Expand Down
22 changes: 13 additions & 9 deletions gpt_engineer/core/token_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,16 @@ def usage_cost(self) -> float | None:
if not self.is_openai_model():
return None

result = 0
for log in self.log():
result += get_openai_token_cost_for_model(
self.model_name, log.total_prompt_tokens, is_completion=False
)
result += get_openai_token_cost_for_model(
self.model_name, log.total_completion_tokens, is_completion=True
)
return result
try:
result = 0
for log in self.log():
result += get_openai_token_cost_for_model(
self.model_name, log.total_prompt_tokens, is_completion=False
)
result += get_openai_token_cost_for_model(
self.model_name, log.total_completion_tokens, is_completion=True
)
return result
except Exception as e:
print(f"Error calculating usage cost: {e}")
return None
93 changes: 48 additions & 45 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e23e02f

Please sign in to comment.