`tokenizers` is designed for efficient and versatile tokenization in natural language processing. It supports both HuggingFace and SentencePiece models, offering a streamlined API for text encoding and decoding.
## Features
-**Support for HuggingFace and SentencePiece Tokenizers**: Easily integrate popular tokenization models into your NLP projects.
-**Hash Verification**: Ensures tokenization consistency and accuracy across different models.
-**Simple Encoding and Decoding**: Facilitates the conversion of text to token IDs and back.
-**Sequence Management**: Manage sequences of tokens for complex NLP tasks effectively.
/// Sample Message with `user` and `assistant`, no `system`
constTHREE_TURN_CHAT_MESSAGE:&str=r#"
[
{
"role": "user",
"content": "How do I reverse a string in Python?"
},
{
"role": "assistant",
"content": "You can reverse a string in Python using slicing:\n\n```python\nreversed_string = your_string[::-1]\n```\n\nAlternatively, you can use `reversed()` with `join()`:\n\n```python\nreversed_string = ''.join(reversed(your_string))\n```\n"
},
{
"role": "user",
"content": "What if I want to reverse each word in a sentence but keep their order?"
}
]"#;
/// Sample Message with `user` and `assistant`, no `system`
constTHREE_TURN_CHAT_MESSAGE_WITH_SYSTEM:&str=r#"
[
{
"role": "system",
"content": "You are a very helpful assistant!"
},
{
"role": "user",
"content": "How do I reverse a string in Python?"
},
{
"role": "assistant",
"content": "You can reverse a string in Python using slicing:\n\n```python\nreversed_string = your_string[::-1]\n```\n\nAlternatively, you can use `reversed()` with `join()`:\n\n```python\nreversed_string = ''.join(reversed(your_string))\n```\n"
},
{
"role": "user",
"content": "What if I want to reverse each word in a sentence but keep their order?"
}
]"#;
/// Sample Message with `user` and `assistant`, no `system`
constMULTI_TURN_WITH_CONTINUATION:&str=r#"
[
{
"role": "system",
"content": "You are a very helpful assistant!"
},
{
"role": "user",
"content": "How do I reverse a string in Python?"
},
{
"role": "assistant",
"content": "You can reverse a "
}
]"#;
constTOOLS:&str=r#"
[
{
"type": "function",
"function": {
"name": "get_current_temperature",
"description": "Get the current temperature for a specific location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g., San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["Celsius", "Fahrenheit"],
"description": "The temperature unit to use. Infer this from the user's location."
}
},
"required": ["location", "unit"]
}
}
},
{
"type": "function",
"function": {
"name": "get_rain_probability",
"description": "Get the probability of rain for a specific location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g., San Francisco, CA"