From 42b5c7125b05ba2f3dd9383bbd1d7017d16b2400 Mon Sep 17 00:00:00 2001 From: Matthew Evans <7916000+ml-evs@users.noreply.github.com> Date: Sat, 31 Aug 2024 21:06:10 +0100 Subject: [PATCH] Deprecate gpt-3.5 series and handle missing models in chatblock (#855) --- pydatalab/pydatalab/apps/chat/blocks.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pydatalab/pydatalab/apps/chat/blocks.py b/pydatalab/pydatalab/apps/chat/blocks.py index 4f7672152..e5a9563ea 100644 --- a/pydatalab/pydatalab/apps/chat/blocks.py +++ b/pydatalab/pydatalab/apps/chat/blocks.py @@ -79,11 +79,11 @@ class ChatBlock(DataBlock): "input_cost_usd_per_MTok": 5.00, "output_cost_usd_per_MTok": 15.00, }, - "gpt-3.5-turbo": { - "name": "gpt-3.5-turbo", - "context_window": 16385, - "input_cost_usd_per_MTok": 1.50, - "output_cost_usd_per_MTok": 2.00, + "gpt-4o-mini": { + "name": "gpt-4o-mini", + "context_window": 128_000, + "input_cost_usd_per_MTok": 0.15, + "output_cost_usd_per_MTok": 0.60, }, "gpt-4": { "name": "gpt-4", @@ -155,10 +155,11 @@ def render(self): return if self.data.get("model") not in self.data.get("available_models", {}): + bad_model = self.data.get("model") self.data["error_message"] = ( - f"Chatblock received an unknown model: {self.data.get('model')}" + f"Chatblock received an unknown or deprecated model: {bad_model}. Reverting to default model {self.defaults['model']}." ) - return + self.data["model"] = self.defaults["model"] try: model_name = self.data["model"]