An easy extension of ollama(-python)
See Ollama, https://github.com/ollama/ollama-python
Also see https://github.com/Freakwill/chat-tools
- install ollama and its SDK
- save API Key in path
ollama_ez/.env
- OllamaChat: gpt-oss:120b by default (set api key)
- LocalOllamaChat: use local model, gemma3 by default (download the model by ollama)
Main attributes of OllamaChat
- description="......"
- history=[]
- name='Assistant'
- model='gpt-oss:120b'
- api_key=
<your api key>
from ollama_ez import OllamaChat # or LocalOllamaChat
with OllamaChat() as chat:
chat.run()In chat looping:
.attr value: set the attributeattrto be the value (e.g..model deepseek-r1to shift the llm):arg value: set the argumentargin chat method (i.e.chat_params) to be the value!cmd *args: run commandcmd(obj, *args)(registered in Commands)