File size: 361 Bytes
ef73330
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from transformers import AutoTokenizer
from transformers import Tool

class SentenceCounterTool(Tool):
    name = "sentence_counter"
    description = "This is a tool for counting sentences of an input."
    inputs = ["text"]
    outputs = ["text"]

    def __call__(self, prompt: str):
        sentences = str.split(". ")
        return len(sentences)