from smolagents import CodeAgent, DuckDuckGoSearchTool, tool # This is the corrected import from the debug logs! from smolagents.models import TransformersModel import gradio as gr @tool def check_migration_blockers(inventory_data: str) -> str: """ Analyzes server inventory data for common Azure VMware Solution (AVS) blockers. Args: inventory_data: A string description of the server hardware or a snippet from an RVTools export. """ data = inventory_data.lower() if "rdm" in data: return "⚠️ BLOCKER: Physical RDM identified. Suggest Pure Cloud Block Store (Everpure)." if "iscsi" in data: return "⚠️ ALERT: Guest iSCSI detected. Check network pathing." return "✅ No immediate architectural blockers identified for standard AVS migration." # This is the corrected model initialization! model = TransformersModel(model_id="Qwen/Qwen2-1.5B-Instruct") agent = CodeAgent( tools=[check_migration_blockers, DuckDuckGoSearchTool()], model=model, add_base_tools=True ) def respond(message, history): # The agent.run method returns the actual string response return agent.run(message) # Launching with a clean Gradio interface gr.ChatInterface(respond).launch()