diff --git a/src/main/askai/core/engine/openai/openai_model.py b/src/main/askai/core/engine/openai/openai_model.py index d1c83b8d..9b06e3a2 100644 --- a/src/main/askai/core/engine/openai/openai_model.py +++ b/src/main/askai/core/engine/openai/openai_model.py @@ -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: Hugo Saporetti Junior - @site: https://github.com/yorevs/askai - @license: MIT - Please refer to - - Copyright (c) 2024, AskAI +@project: HsPyLib-AskAI +@package: askai.core.engine.openai + @file: openai_model.py +@created: Fri, 12 Jan 2024 + @author: Hugo Saporetti Junior + @site: https://github.com/yorevs/askai +@license: MIT - Please refer to + +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): @@ -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 @@ -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):