| |
| from smolagents import ToolCallingAgent, ToolCollection, LiteLLMModel |
| from mcp import StdioServerParameters |
|
|
| |
| model = LiteLLMModel( |
| model_id="ollama_chat/qwen2.5:14b", |
| num_ctx=8192 |
| ) |
|
|
| |
| server_parameters = StdioServerParameters( |
| command="uv", |
| args=["run", "server.py"], |
| env=None, |
| ) |
|
|
| |
| with ToolCollection.from_mcp(server_parameters, trust_remote_code=True) as tool_collection: |
| agent = ToolCallingAgent( |
| tools=[*tool_collection.tools], |
| model=model, |
| system_prompt="You are an agricultural AI assistant specialized in crop optimization." |
| ) |
| |
| |
| agent.run("What are the optimal growing conditions for cabbage?") |
| agent.run("Predict green pepper yield in KZN region") |
| agent.run("What pests commonly affect tomato crops?") |
| agent.run("Recommend crops suitable for clay soil in tropical climates") |