| |
| from smolagents import CodeAgent, InferenceClientModel |
|
|
| from config import AUTHORIZED_IMPORTS, CUSTOM_ROLE_CONVERSIONS, MODEL_ID |
| from tools import build_tools |
|
|
|
|
| |
| model = InferenceClientModel( |
| model_id=MODEL_ID, |
| custom_role_conversions=CUSTOM_ROLE_CONVERSIONS, |
| ) |
|
|
| |
| _web_tools, _document_inspection_tool, _visualizer = build_tools(model) |
|
|
|
|
| def get_model(): |
| return model |
|
|
|
|
| def get_document_inspection_tool(): |
| return _document_inspection_tool |
|
|
|
|
| def create_agent(): |
| """Return a fresh CodeAgent for each new user session.""" |
| return CodeAgent( |
| model=model, |
| tools=[_visualizer] + _web_tools, |
| max_steps=10, |
| verbosity_level=1, |
| additional_authorized_imports=AUTHORIZED_IMPORTS, |
| planning_interval=4, |
| ) |