Instructions to use persadian/Croptimize with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use persadian/Croptimize with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("persadian/Croptimize", dtype="auto") - Notebooks
- Google Colab
- Kaggle
| # Import smolagents | |
| from smolagents import ToolCallingAgent, ToolCollection, LiteLLMModel | |
| from mcp import StdioServerParameters | |
| # Specify agricultural-focused LLM | |
| model = LiteLLMModel( | |
| model_id="ollama_chat/qwen2.5:14b", | |
| num_ctx=8192 | |
| ) | |
| # Configure connection to crop optimization server | |
| server_parameters = StdioServerParameters( | |
| command="uv", | |
| args=["run", "server.py"], | |
| env=None, | |
| ) | |
| # Initialize agent with crop optimization tools | |
| 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." | |
| ) | |
| # Example agricultural queries | |
| 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") |