Skip to content

Commit

Permalink
Add the new o1 OpenAI model
Browse files Browse the repository at this point in the history
  • Loading branch information
mahaloz committed Sep 13, 2024
1 parent b14764c commit 1071c2a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dailalib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.6.0"
__version__ = "3.7.0"

from .api import AIAPI, LiteLLMAIAPI
from libbs.api import DecompilerInterface
Expand Down
8 changes: 6 additions & 2 deletions dailalib/api/litellm/litellm_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
class LiteLLMAIAPI(AIAPI):
prompts_by_name = []
DEFAULT_MODEL = "gpt-4o"
OPENAI_MODELS = {"gpt-4", "gpt-4o", "gpt-4-turbo", "gpt-3.5-turbo", "o1-mini", "o1-preview"}
MODEL_TO_TOKENS = {
# TODO: update the token values for o1
"o1-mini": 8_000,
"o1-preview": 8_000,
"gpt-4-turbo": 128_000,
"gpt-4": 8_000,
"gpt-4o": 8_000,
Expand Down Expand Up @@ -115,7 +119,7 @@ def fit_decompilation_to_token_max(decompilation: str, delta_step=10, model=DEFA
def api_key(self):
if not self._api_key:
return None
elif "gpt" in self.model:
elif self.model in self.OPENAI_MODELS:
return os.getenv("OPENAI_API_KEY", None)
elif "claude" in self.model:
return os.getenv("ANTHROPIC_API_KEY", None)
Expand All @@ -130,7 +134,7 @@ def api_key(self):
def api_key(self, value):
self._api_key = value
if self._api_key:
if "gpt" in self.model:
if self.model in self.OPENAI_MODELS:
os.environ["OPENAI_API_KEY"] = self._api_key
elif "claude" in self.model:
os.environ["ANTHROPIC_API_KEY"] = self._api_key
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ long_description_content_type = text/markdown

[options]
install_requires =
litellm
litellm>=1.44.27
tiktoken
Jinja2
libbs>=1.22.0
Expand Down

0 comments on commit 1071c2a

Please sign in to comment.