File size: 833 Bytes
32844c7
6aef72f
32844c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6aef72f
 
32844c7
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import pandas as pd
from smolagents import CodeAgent, Model, tool, SpeechToTextTool

from config import authorized_libraries


@tool
def reverse_string(string: str) -> str:
    """
    Given a string and return it reversed.
    For example, given "siht dnatsrednu uoy fI" will return "If you understand this"

    Args:
        string (str): String to reverse
    """
    return string[::-1]


def create_utils(model: Model) -> CodeAgent:
    return CodeAgent(
        model=model,
        tools=[
            reverse_string,
            SpeechToTextTool(),
        ],
        add_base_tools=True,
        additional_authorized_imports=authorized_libraries,
        name="utils_manager",
        description="Have a bunch of useful utilities, like functions to reverse string.",
        verbosity_level=0,
        max_steps=8,
    )