Skip to content

Commit

Permalink
Merge pull request #846 from PrefectHQ/fallback-encoding
Browse files Browse the repository at this point in the history
fallback model encoding
  • Loading branch information
zzstoatzz authored Feb 14, 2024
2 parents bb3afed + 5a437c8 commit b16a1fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/marvin/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ class ChatCompletionSettings(MarvinSettings):
def encoder(self):
import tiktoken

return tiktoken.encoding_for_model(self.model).encode
try:
encoding = tiktoken.encoding_for_model(self.model)
except KeyError:
encoding = tiktoken.encoding_for_model("gpt-3.5-turbo")

return encoding.encode


class ChatVisionSettings(MarvinSettings):
Expand Down

0 comments on commit b16a1fe

Please sign in to comment.