diff --git a/src/chatdbg/chatdbg_utils.py b/src/chatdbg/chatdbg_utils.py index 45b52ac..acdcf81 100644 --- a/src/chatdbg/chatdbg_utils.py +++ b/src/chatdbg/chatdbg_utils.py @@ -83,16 +83,10 @@ def explain(source_code: str, traceback: str, exception: str, really_run=True) - text = completion.choices[0].message.content input_tokens = completion.usage.prompt_tokens output_tokens = completion.usage.completion_tokens - context_window = ( - "8K" if model == "gpt-4" else "4K" - ) # FIXME: true as of Oct 3, 2023 - cost = llm_utils.calculate_cost( - input_tokens, output_tokens, model, context_window - ) + cost = llm_utils.calculate_cost(input_tokens, output_tokens, model) text += f"\n(Total cost: approximately ${cost:.2f} USD.)" print(llm_utils.word_wrap_except_code_blocks(text)) except openai.error.AuthenticationError: - print( - "You need a valid OpenAI key to use ChatDBG. You can get a key here: https://openai.com/api/" - ) + print("You need a valid OpenAI key to use ChatDBG.") + print("You can get a key here: https://platform.openai.com/api-keys") print("Set the environment variable OPENAI_API_KEY to your key value.")