Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update amazon_bedrock_tokenizer.py #1654

Merged
merged 10 commits into from
Feb 10, 2025
40 changes: 32 additions & 8 deletions griptape/tokenizers/amazon_bedrock_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,51 @@ class AmazonBedrockTokenizer(BaseTokenizer):
MODEL_PREFIXES_TO_MAX_INPUT_TOKENS = {
"anthropic.claude-3": 200000,
"anthropic.claude-v2:1": 200000,
"anthropic.claude": 100000,
"anthropic.claude-v2": 100000,
"anthropic.claude-instant": 100000,
ennio1991 marked this conversation as resolved.
Show resolved Hide resolved
"cohere.command-r": 128000,
"cohere.embed": 512,
"cohere.command": 4000,
"cohere": 1024,
"ai21": 8192,
"meta.llama3": 8000,
"meta.llama2": 4096,
"mistral": 32000,
"amazon": 4096,
"meta.llama3-8b-instruct": 8000,
"meta.llama3-70b-instruct": 8000,
"meta.llama3-1-8b-instruct": 128000,
"meta.llama3-1-70b-instruct": 128000,
"meta.llama3-1-405b-instruct": 128000,
ennio1991 marked this conversation as resolved.
Show resolved Hide resolved
"meta.llama3-2-1b-instruct": 131000,
"meta.llama3-2-3b-instruct": 131000,
"meta.llama3-2-11b-instruct": 128000,
"meta.llama3-2-90b-instruct": 128000,
"meta.llama3-3-70b-instruct": 128000,
ennio1991 marked this conversation as resolved.
Show resolved Hide resolved
"mistral.mistral-7b-instruct": 32000,
"mistral.mistral-large-2402": 32000,
"mistral.mistral-large-2407": 128000,
"mistral.mistral-small-2402": 32000,
ennio1991 marked this conversation as resolved.
Show resolved Hide resolved
"mistral.mixtral-8x7b-instruct": 32000,
ennio1991 marked this conversation as resolved.
Show resolved Hide resolved
"amazon.nova-pro-v1": 300000,
"amazon.nova-lite-v1": 300000,
"amazon.nova-micro-v1": 128000,
ennio1991 marked this conversation as resolved.
Show resolved Hide resolved
"amazon.titan-text-express-v1": 8000,
"amazon.titan-text-lite-v1": 4000,
"amazon.titan-text-premier-v1": 32000,
}
MODEL_PREFIXES_TO_MAX_OUTPUT_TOKENS = {
"anthropic.claude": 4096,
"anthropic.claude-3-5": 8192,
"anthropic.claude-3-haiku": 4096,
"anthropic.claude-3-opus": 4096,
"anthropic.claude-3-sonnet": 4096,
"anthropic.claude-v2": 4096,
"anthropic.claude-instant": 4096,
ennio1991 marked this conversation as resolved.
Show resolved Hide resolved
"cohere": 4096,
"ai21.j2": 8191,
"meta": 2048,
"amazon.titan-text-lite": 4096,
"amazon.titan-text-express": 8192,
"amazon.titan-text-premier": 3072,
"amazon": 4096,
"mistral": 8192,
"amazon.nova": 5000,
"mistral.mistral": 8192,
"mistral.mixtral": 4096,
}

model: str = field(kw_only=True)
Expand Down