LangChain – Ollama Model Installation
How To Install Ollama Model In Local ?
(2) How To Test The Installation
https://ollama.com/
ollama – version
ollama pull smollm:135m
(3) Making Of Agentic AI
from langchain.agents import create_agent
def get_weather(city:'str')->str:
"Get The Weather Of The Given City"
return f"Its Sunny In {city}"
agent = create_agent(
model="ollama:smollm:135m",
tools=[get_weather]
system_prompt = "You are an helpful Assistant"
)
result = agent.invoke(
{"messages": [{"role": "user", "content": "What's the weather in San Francisco?"}]}
)
print(result.content)
(4) Install qwen3:0.6b Model Which Support Tool Calling
ollama pull qwen3:0.6b
from langchain.agents import create_agent
def get_weather(city:str)->str:
"""Get The Weather Of The Given City"""
return f"Its Always Sunny In {city}"
agent = create_agent(
model="ollama:qwen3:0.6b"
tools = [get_weather]
system_prompt = "You Are An Helpful AI Assistant"
)
response = agent.invoke({"message": ["role": "user", "content": "What Is The Weather Of Bhubaneswar"]})
print(response['message'][-1].content_block)
[{'type': 'text', 'text': 'The weather in Bhubaneswar is **Sunny**. Let me know if you need updates! 🌤️'}] 