manual update for mistralai tokens
Browse files
app.py
CHANGED
@@ -21,7 +21,11 @@ class MistralTokens:
|
|
21 |
"""
|
22 |
def __init__(self, llm_name):
|
23 |
from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
|
26 |
def __call__(self, input):
|
27 |
"""This returns all the tokens indices in a list since LlamaIndex seems to count by calling `len()` on the tokenizer function."""
|
@@ -71,7 +75,7 @@ def main():
|
|
71 |
elif provider == 'huggingface':
|
72 |
llm_list = []
|
73 |
elif provider == 'mistralai':
|
74 |
-
llm_list = ["mistral-small-latest", "mistral-
|
75 |
elif provider == 'openai':
|
76 |
llm_list = ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo', 'gpt-4o', 'gpt-4o-mini']
|
77 |
else:
|
|
|
21 |
"""
|
22 |
def __init__(self, llm_name):
|
23 |
from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
|
24 |
+
if 'open-mistral-nemo' in llm_name:
|
25 |
+
self.tokenizer = MistralTokenizer.v3(is_tekken=True)
|
26 |
+
else:
|
27 |
+
# This might work for all models, but their documentation is unclear.
|
28 |
+
self.tokenizer = MistralTokenizer.from_model(llm_name)
|
29 |
|
30 |
def __call__(self, input):
|
31 |
"""This returns all the tokens indices in a list since LlamaIndex seems to count by calling `len()` on the tokenizer function."""
|
|
|
75 |
elif provider == 'huggingface':
|
76 |
llm_list = []
|
77 |
elif provider == 'mistralai':
|
78 |
+
llm_list = ["mistral-small-latest", "mistral-large-latest", "open-mistral-nemo-latest"]
|
79 |
elif provider == 'openai':
|
80 |
llm_list = ['gpt-3.5-turbo', 'gpt-4', 'gpt-4-turbo', 'gpt-4o', 'gpt-4o-mini']
|
81 |
else:
|