cognee/cognee/infrastructure/llm/tokenizer/tokenizer_interface.py
Igor Ilic 0a9f1349f2 refactor: Change variable and function names based on PR comments
Change variable and function names based on PR comments
2025-01-28 10:10:29 +01:00

18 lines
460 B
Python

from typing import List, Protocol, Any
from abc import abstractmethod
class TokenizerInterface(Protocol):
"""Tokenizer interface"""
@abstractmethod
def extract_tokens(self, text: str) -> List[Any]:
raise NotImplementedError
@abstractmethod
def count_tokens(self, text: str) -> int:
raise NotImplementedError
@abstractmethod
def trim_text_to_max_tokens(self, text: str) -> str:
raise NotImplementedError