-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from TransformerOptimus/gpt4-32k
Gpt4 32k
- Loading branch information
Showing
4 changed files
with
38 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
|
||
from typing import List | ||
from superagi.helper.token_counter import TokenCounter | ||
from superagi.types.common import BaseMessage | ||
from unittest.mock import MagicMock | ||
|
||
|
||
def test_token_limit(): | ||
assert TokenCounter.token_limit("gpt-3.5-turbo-0301") == 4032 | ||
assert TokenCounter.token_limit("gpt-4-0314") == 8092 | ||
assert TokenCounter.token_limit("gpt-3.5-turbo") == 4032 | ||
assert TokenCounter.token_limit("gpt-4") == 8092 | ||
assert TokenCounter.token_limit("gpt-3.5-turbo-16k") == 16184 | ||
assert TokenCounter.token_limit("gpt-4-32k") == 32768 | ||
assert TokenCounter.token_limit("gpt-4-32k-0314") == 32768 | ||
assert TokenCounter.token_limit("non_existing_model") == 8092 | ||
|
||
|
||
def test_count_text_tokens(): | ||
# You might need to adjust the hardcoded values in the TokenCounter.count_text_tokens function | ||
# and update the expected tokens accordingly if the function logic is changed. | ||
|
||
text = "You are a helpful assistant." | ||
assert TokenCounter.count_text_tokens(text) == 10 | ||
|
||
text = "What is your name?" | ||
assert TokenCounter.count_text_tokens(text) == 9 |