File size: 339 Bytes
b4a8aea
e03f966
 
82863a2
 
 
e03f966
 
 
7846d6e
82863a2
 
b4a8aea
1
2
3
4
5
6
7
8
9
10
11
12
13
from transformers import AutoTokenizer
from transformers import Tool

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

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