## The problem
Issue huggingface/smolagents#36 (closed, 10 comments): I tweaked example code using my external Ollama server URL (on LightningAI) and llama3.2:latest. model = LiteLLMModel(model_id="ollama_chat/llama3.2:latest", api_base=os.getenv("OLLAMA_BASE_URL"), api_key value [redacted]). The tool_calling_agent_ollama.py example errors out.

## The fix
If the smolagents Ollama tool-calling example errors out, raise Ollama's context window: it defaults to 2048 tokens, which breaks the tool-calling prompts. Pass num_ctx to the LiteLLMModel, e.g. LiteLLMModel(model_id='ollama_chat/llama3.2:latest', api_base=..., num_ctx=32768). The reporter confirmed this fixed it. You can pass other Ollama request options the same way; see the Ollama API docs for the list.

## Notes
Thread: https://github.com/huggingface/smolagents/issues/36. Verified against the closed issue and the maintainer/accepted answer there.