Skip to content

Commit 6d04d4e

Browse files
committed
🔧 Simplify tiktoken_model_name property
Replace complex logic with a single return statement that works for both OpenAI and Anthropic models. This change improves code readability and maintainability.
1 parent d5a8c2d commit 6d04d4e

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

aicodebot/lm.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,8 @@ def read_model_config(self):
133133

134134
@property
135135
def tiktoken_model_name(self):
136-
if "/" in self.model_name:
137-
if self.model_name.startswith("openai/"):
138-
# For OpenAI models, this is as simple as stripping the prefix "openai/" from the model name
139-
return self.model_name.replace("openai/", "")
140-
else:
141-
# For non-OpenAI models, we set the model name to "gpt-4" for now. Seems to work.
142-
# Tested with anthropic/claude2
143-
return self.DEFAULT_MODEL
144-
else:
145-
return self.model_name
136+
# This seems to work for both OpenAI and Anthropic
137+
return "gpt-4o"
146138

147139
def use_appropriate_sized_model(self, chain, token_size):
148140
current_model = self.model_name

0 commit comments

Comments
 (0)