mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-02 02:30:07 +00:00
add gpt-4-0125-preview pricing; capture OpenAIError (#52)
This commit is contained in:
parent
7de072aa11
commit
ad6de7faf0
3 changed files with 10 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -5,7 +5,6 @@ from typing import Any, Union
|
|||
|
||||
from jose import jwt
|
||||
|
||||
from skyvern.config import settings
|
||||
from skyvern.forge.sdk.settings_manager import SettingsManager
|
||||
|
||||
|
||||
|
@ -23,7 +22,7 @@ def create_access_token(
|
|||
encoded_jwt = jwt.encode(
|
||||
to_encode,
|
||||
SettingsManager.get_settings().SECRET_KEY,
|
||||
algorithm=settings.SIGNATURE_ALGORITHM,
|
||||
algorithm=SettingsManager.get_settings().SIGNATURE_ALGORITHM,
|
||||
)
|
||||
return encoded_jwt
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue