Skip to content

Commit

Permalink
Deprecate gpt-3.5 series and handle missing models in chatblock
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Aug 31, 2024
1 parent 6c764a7 commit 48ae523
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pydatalab/pydatalab/apps/chat/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit 48ae523

Please sign in to comment.