add gpt-4-0125-preview pricing; capture OpenAIError (#52)
This commit is contained in:
@@ -5,8 +5,10 @@ from pydantic import BaseModel
|
||||
openai_model_to_price_lambdas = {
|
||||
"gpt-4-vision-preview": (0.01, 0.03),
|
||||
"gpt-4-1106-preview": (0.01, 0.03),
|
||||
"gpt-4-0125-preview": (0.01, 0.03),
|
||||
"gpt-3.5-turbo": (0.001, 0.002),
|
||||
"gpt-3.5-turbo-1106": (0.001, 0.002),
|
||||
"gpt-3.5-turbo-0125": (0.0005, 0.0015),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -171,6 +171,13 @@ class OpenAIClientManager:
|
||||
screenshots=screenshots,
|
||||
prompt=prompt,
|
||||
)
|
||||
except openai.OpenAIError as e:
|
||||
LOG.error("OpenAI error", exc_info=True)
|
||||
raise e
|
||||
except Exception as e:
|
||||
LOG.error("Unknown error for chat completion", error_message=str(e), error_type=type(e))
|
||||
raise e
|
||||
|
||||
# TODO: https://platform.openai.com/docs/guides/rate-limits/rate-limits-in-headers
|
||||
# use other headers, x-ratelimit-limit-requests, x-ratelimit-limit-tokens, x-ratelimit-remaining-tokens
|
||||
# x-ratelimit-reset-requests, x-ratelimit-reset-tokens to write a more accurate algorithm for managing api keys
|
||||
|
||||
Reference in New Issue
Block a user