diff --git a/mindflow/cli/commands/config.py b/mindflow/cli/commands/config.py index 6cf25f4..89a351c 100644 --- a/mindflow/cli/commands/config.py +++ b/mindflow/cli/commands/config.py @@ -48,6 +48,7 @@ def configure_query_model(): model_ids = [ ModelID.GPT_3_5_TURBO.value, ModelID.GPT_4.value, + ModelID.GPT_4_O.value ] model_options: List[Model] = [Model.load(model_id) for model_id in model_ids] model_descriptions: List[str] = [ diff --git a/mindflow/core/types/definitions/model.py b/mindflow/core/types/definitions/model.py index f7ad351..95e6a1b 100644 --- a/mindflow/core/types/definitions/model.py +++ b/mindflow/core/types/definitions/model.py @@ -32,6 +32,8 @@ class ModelID(Enum): GPT_4_32K = "gpt-4-32k" GPT_4_32K_0314 = "gpt-4-32k-0314" + GPT_4_O = "gpt-4o" + CLAUDE_V1 = "claude-v1" CLAUDE_V1_2 = "claude-v1.2" CLAUDE_INSTANT_V1 = "claude-instant-v1" @@ -52,7 +54,7 @@ class ModelID(Enum): ModelParameterKey.MAX_TOKENS_PER_MINUTE.value: 40_000, ModelParameterKey.TOKEN_COST.value: 0.002, ModelParameterKey.TOKEN_COST_UNIT.value: 1_000, - ModelParameterKey.CONFIG_DESCRIPTION.value: f"GPT 3.5 Turbo: OpenAI's Fast, cheap, and still powerful model. Token Limit: {4_000}.", + ModelParameterKey.CONFIG_DESCRIPTION.value: f"GPT 3.5 Turbo: OpenAI's Fast, cheap, and still powerful model. Token Limit: {4_000}.", }, ModelID.GPT_3_5_TURBO_0301.value: { ModelParameterKey.ID.value: ModelID.GPT_3_5_TURBO_0301.value, @@ -79,7 +81,7 @@ class ModelID(Enum): ModelParameterKey.MAX_TOKENS_PER_MINUTE.value: 40_000, ModelParameterKey.TOKEN_COST.value: 0.002, ModelParameterKey.TOKEN_COST_UNIT.value: 1_000, - ModelParameterKey.CONFIG_DESCRIPTION.value: f"GPT 4: OpenAI's most powerful model (slower + expensive). Token Limit: {str(8192)}. Get access -> https://openai.com/waitlist/gpt-4-api.", + ModelParameterKey.CONFIG_DESCRIPTION.value: f"GPT 4: OpenAI's previous high intelligence model (slower + expensive). Token Limit: {str(8192)}.", }, ModelID.GPT_4_0314.value: { ModelParameterKey.ID.value: ModelID.GPT_4_0314.value, @@ -120,6 +122,20 @@ class ModelID(Enum): ModelParameterKey.TOKEN_COST.value: 0.002, ModelParameterKey.TOKEN_COST_UNIT.value: 1_000, }, + ModelID.GPT_4_O.value: { + ModelParameterKey.ID.value: ModelID.GPT_4_O.value, + ModelParameterKey.NAME.value: "GPT 4o", + ModelParameterKey.SERVICE.value: "openai", + ModelParameterKey.MODEL_TYPE.value: ModelType.TEXT_COMPLETION.value, + ModelParameterKey.URL.value: "https://api.openai.com/v1/chat/completions", + ModelParameterKey.DEFAULT_SOFT_TOKEN_LIMIT.value: 5000, + ModelParameterKey.HARD_TOKEN_LIMIT.value: 128_000, + ModelParameterKey.MAX_REQUESTS_PER_MINUTE.value: 3_500, + ModelParameterKey.MAX_TOKENS_PER_MINUTE.value: 90_000, + ModelParameterKey.TOKEN_COST.value: 0.002, + ModelParameterKey.TOKEN_COST_UNIT.value: 1_000, + ModelParameterKey.CONFIG_DESCRIPTION.value: f"GPT 4o: OpenAI's fasted and most affordable flagship model. Token Limit: {str(128_000)}.", + }, ModelID.TEXT_EMBEDDING_ADA_002.value: { ModelParameterKey.ID.value: ModelID.TEXT_EMBEDDING_ADA_002.value, ModelParameterKey.NAME.value: "Text Embedding Ada 002", diff --git a/mindflow/core/types/mindflow_model.py b/mindflow/core/types/mindflow_model.py index 0edb2c0..240cea4 100644 --- a/mindflow/core/types/mindflow_model.py +++ b/mindflow/core/types/mindflow_model.py @@ -51,7 +51,7 @@ def index(self) -> ConfiguredTextCompletionModel: MindFlowModelID.INDEX.value, mindflow_model.defaults ) - if model_id in [ModelID.GPT_3_5_TURBO.value, ModelID.GPT_4.value]: + if model_id in [ModelID.GPT_3_5_TURBO.value, ModelID.GPT_4.value, ModelID.GPT_4_O.value]: return ConfiguredOpenAIChatCompletionModel(model_id) raise Exception("Unsupported model: " + model_id) @@ -69,7 +69,7 @@ def query(self) -> ConfiguredTextCompletionModel: MindFlowModelID.QUERY.value, mindflow_model.defaults ) - if model_id in [ModelID.GPT_3_5_TURBO.value, ModelID.GPT_4.value]: + if model_id in [ModelID.GPT_3_5_TURBO.value, ModelID.GPT_4.value, ModelID.GPT_4_O.value]: return ConfiguredOpenAIChatCompletionModel(model_id) raise Exception("Unsupported model: " + model_id) diff --git a/mindflow/core/types/model.py b/mindflow/core/types/model.py index 001866d..c49461b 100644 --- a/mindflow/core/types/model.py +++ b/mindflow/core/types/model.py @@ -209,7 +209,7 @@ def __init__(self, model_id: str): try: if self.model.service == ServiceID.OPENAI.value: - if self.model.id == ModelID.GPT_4.value: + if self.model.id in [ModelID.GPT_4.value, ModelID.GPT_4_O.value]: self.tokenizer = tiktoken.encoding_for_model( ModelID.GPT_3_5_TURBO.value ) @@ -425,6 +425,7 @@ async def call_api_stream( # type: ignore yield model_error return except Exception as e: + print(f'/n/nERROR OCCURRED') logging.warning(f"Request {payload} failed with exception {e}") await self.status_tracker.increment_error_count_other() yield Err(UncaughtModelException(str(e)))