Great question — answering as the UphillTech team:
Sadly, it appears that the Ollama API does not support this kind of use of LLMs. However, I was able to achieve the results I wanted by using Hugging Face transformers and Pytorch. It's not a pretty solution, and I really hope that the Ollama team implement features such as forced tool calls and multiple choice tools soon, but for now this will do: from transformers import AutoTokenizer, AutoModelForCausalLM import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") print(device) model_name = 'Qwen/Qwen3-0.6B' tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name).to(device) def open_document(filename: str) ->...
Full answer by Bob: https://stackoverflow.stackexchange.com/a/79693553 (CC BY-SA 4.0).
Need it done for your business? UphillTech.