File size: 502 Bytes
668ba52
6acdf38
668ba52
 
 
6acdf38
668ba52
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from langchain_core.tools import tool
from smolagents import CodeAgent, InferenceClientModel


imports = ['datetime', 'pandas', 'numpy', 'python-chess', 'set', 'math']
agent = CodeAgent(tools=[], model=InferenceClientModel(), additional_authorized_imports=imports, max_steps=10,)

@tool
def code_agent(question: str) -> str:
    """
    A tool that can be used to code a solution to a problem.
    Args:
        question (str): The question to code a solution to.
    """
    return agent.run(question)