Skip to content

Commit

Permalink
Synchronizing OpenAi models
Browse files Browse the repository at this point in the history
  • Loading branch information
yorevs committed Dec 9, 2024
1 parent 5e0d97a commit 6860405
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/main/askai/core/engine/openai/openai_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
# -*- coding: utf-8 -*-

"""
@project: HsPyLib-AskAI
@package: askai.core.engine.openai
@file: openai_model.py
@created: Fri, 12 Jan 2024
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior
@site: https://github.com/yorevs/askai
@license: MIT - Please refer to <https://opensource.org/licenses/MIT>
Copyright (c) 2024, AskAI
@project: HsPyLib-AskAI
@package: askai.core.engine.openai
@file: openai_model.py
@created: Fri, 12 Jan 2024
@author: <B>H</B>ugo <B>S</B>aporetti <B>J</B>unior
@site: https://github.com/yorevs/askai
@license: MIT - Please refer to <https://opensource.org/licenses/MIT>
Copyright (c) 2024, AskAI
"""

from typing import List

from askai.core.engine.ai_model import AIModel
from hspylib.core.enums.enumeration import Enumeration
from hspylib.core.preconditions import check_not_none
from typing import List


class OpenAIModel(Enumeration):
Expand All @@ -27,7 +28,6 @@ class OpenAIModel(Enumeration):

# fmt: off

GPT_3_5_TURBO = "gpt-3.5-turbo", 4096
GPT_4 = "gpt-4", 8192
GPT_4_TURBO = "gpt-4-turbo", 128000
GPT_4_O = "gpt-4o", 128000
Expand Down Expand Up @@ -58,12 +58,11 @@ def of_name(model_name: str) -> "AIModel":
),
None,
)
check_not_none(
found,
'"{}" name does not correspond to a valid "{}" enum',
model_name,
OpenAIModel.__name__,
)
if found is None:
raise ValueError(
f'"{model_name}" name does not correspond to a valid "{OpenAIModel.__name__}" enum'
)

return found

def __init__(self, model_name: str, token_limit: int):
Expand Down

0 comments on commit 6860405

Please sign in to comment.