Skip to content

Commit 1c80f12

Browse files
authored
refactor!: Removed ai21-tokenizer dependency (#294)
* refactor: Removed ai21-tokenizer dependency * fix: Removed unused test
1 parent fd422a5 commit 1c80f12

File tree

13 files changed

+13
-755
lines changed

13 files changed

+13
-755
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ repos:
88
rev: v4.4.0
99
hooks:
1010
- id: check-added-large-files
11-
exclude: (ai21_tokenizer/resources|tests/resources)
1211
- id: check-case-conflict
1312
- id: check-executables-have-shebangs
1413
- id: check-shebang-scripts-are-executable

README.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
- [Older Models Support Usage](#Older-Models-Support-Usage)
3030
- [More Models](#More-Models)
3131
- [Streaming](#Streaming)
32-
- [Token Counting](#Token-Counting)
3332
- [Environment Variables](#Environment-Variables)
3433
- [Error Handling](#Error-Handling)
3534
- [Cloud Providers](#Cloud-Providers) ☁️
@@ -323,39 +322,6 @@ file_id = client.library.files.create(
323322
uploaded_file = client.library.files.get(file_id)
324323
```
325324

326-
## Token Counting
327-
328-
---
329-
330-
By using the `count_tokens` method, you can estimate the billing for a given request.
331-
332-
```python
333-
from ai21.tokenizers import get_tokenizer
334-
335-
tokenizer = get_tokenizer(name="jamba-tokenizer")
336-
total_tokens = tokenizer.count_tokens(text="some text") # returns int
337-
print(total_tokens)
338-
```
339-
340-
### Async Usage
341-
342-
```python
343-
from ai21.tokenizers import get_async_tokenizer
344-
345-
## Your async function code
346-
#...
347-
tokenizer = await get_async_tokenizer(name="jamba-tokenizer")
348-
total_tokens = await tokenizer.count_tokens(text="some text") # returns int
349-
print(total_tokens)
350-
```
351-
352-
Available tokenizers are:
353-
354-
- `jamba-tokenizer`
355-
- `j2-tokenizer`
356-
357-
For more information on AI21 Tokenizers, see the [documentation](https://github.com/AI21Labs/ai21-tokenizer).
358-
359325
## Environment Variables
360326

361327
---

ai21/clients/studio/ai21_client.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
from ai21.clients.studio.resources.studio_chat import StudioChat
88
from ai21.clients.studio.resources.studio_library import StudioLibrary
99
from ai21.http_client.http_client import AI21HTTPClient
10-
from ai21.tokenizers.ai21_tokenizer import AI21Tokenizer
1110

1211

1312
class AI21Client(AI21HTTPClient):
1413
"""
1514
This class would be sending requests to our REST API using http requests
1615
"""
1716

18-
_tokenizer: Optional[AI21Tokenizer]
19-
2017
def __init__(
2118
self,
2219
api_key: Optional[str] = None,

ai21/tokenizers/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

ai21/tokenizers/ai21_tokenizer.py

Lines changed: 0 additions & 51 deletions
This file was deleted.

ai21/tokenizers/factory.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

examples/studio/async_tokenization.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

examples/studio/tokenization.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)