Ollama Integration Custom Function Calling

Hey all,

I have been playing around with the ollama integration and locally hosted llm’s to control my house, make internet queries etc. I have this setup using custom sentences, but I was hoping to add some custom function calls in the mix so I can do things using more natural speech. Looking at the logs of the ollama integration I can see that tools are used, but is there a way to add custom tools?

I have a question. How do the custom tools that Home Assistant sends to Ollama look like? I have never managed to capture that traffic and figure out what the hill is going on.

I have read the ollama code and I can tell you there is no easy way to add custom tools to the payload that Home Assistant sends to ollama.

If you enable debugging in the ollama integration and send a request “tune on the kitchen lights” (be sure to toggle off local processing in the voice assistant), then toggle it off your browser will download a log file and you can see the tools payload HA sends (search for “Tools:” and you’ll find it).

Best solution I can think of that allows for retaining the same features of the Ollama integration and adding custom tools/function is to just copy the integration’s code, add your custom tools, and install your modified integration via HACS

1 Like