Spaces:
Running
Running
Update dynamic_cheatsheet/language_model.py
Browse files
dynamic_cheatsheet/language_model.py
CHANGED
@@ -122,11 +122,11 @@ class LanguageModel:
|
|
122 |
# model=self.model_name
|
123 |
# )
|
124 |
try:
|
125 |
-
token_count = litellm.token_counter(
|
126 |
print(f"DEBUG: litellm token_counter for '{model_name}' estimates: {token_count} tokens")
|
127 |
except Exception as e:
|
128 |
print(f"DEBUG: Error using litellm.token_counter: {e}")
|
129 |
-
|
130 |
|
131 |
# The self.client is already a partial function with model, api_key, base_url, etc., pre-filled for SambaNova
|
132 |
response = self.client(
|
|
|
122 |
# model=self.model_name
|
123 |
# )
|
124 |
try:
|
125 |
+
token_count = litellm.token_counter(model_name=self.model_name, messages=history)
|
126 |
print(f"DEBUG: litellm token_counter for '{model_name}' estimates: {token_count} tokens")
|
127 |
except Exception as e:
|
128 |
print(f"DEBUG: Error using litellm.token_counter: {e}")
|
129 |
+
|
130 |
|
131 |
# The self.client is already a partial function with model, api_key, base_url, etc., pre-filled for SambaNova
|
132 |
response = self.client(
|