Live data from Hacker News

Ollama now supports tool calling with popular models in local LLM

ollama.com

21–27 of 27 posts

Re: Ollama now supports tool calling with popular models in local LLM

#21
post #12

The first I think of when anyone mentions agent-like “tool use” is: - Is the environment that the tools are run from sandboxed? I’m unclear on when/how/why you’d want an LLM executing code on your machine or in a non-sandboxed environment. Anyone care to enlighten?

> Is the environment that the tools are run from sandboxed?

It is up to the person who implements the tool to sandbox it as appropriate.

> I’m unclear on when/how/why you’d want an LLM executing code on your machine or in a non-sandboxed environment.

The LLM does not execute code on your computer. It returns the fact that the LLM would like to execute a tool with certain parameters. You should trust those parameters as much as you trust the prompt and the LLM itself. Which in practice probably ends up being "not much".

Good news is that in your tool implementation you can (and should) apply all the appropriate checks using regular coding practices. This is nothing new. We do this all the time with web requests. You can check if the prompt originates from an authenticated user, if they have the necessary permissions to do the action they are about to do. You can throttle the requests, you can check that the inputs are appropriate etc etc.

If the tool is side-effect free and there are no access restrictions you can just run it easy. For example imagine an LLM which can turn the household name of a plant to its latin name. You would have a "look_up_latin_name" tool which searches in a local database. You have to make sure to follow best practices to avoid an sql injection attack, but otherwise this should be easy.

Now imagine a more sensitive situation. A tool with difficult to undo side-effects, and strict access controls. For example launching an ICBM attack. You would create a "launch_nukes" tool, but the tool wouldn't just launch willy nilly. First of all it would check that the prompt arrived from directly the president. (how you do that is best discussed with your NSA rep in person) Then it would check that the parameter is one of the valid targets. But that is not enough yet. You want to make sure it is not the LLM hallucinating the action. So you would pop up a prompt directly on the UI to confirm the action. Something like "Looks like you want to destroy . Do you want to proceed? " And would only launch when the president clicks the yes.

Re: Ollama now supports tool calling with popular models in local LLM

#22
I see Command-R+ but not Command-R marked for tool use. The model is geared for it, much easier to fit on commodity hardware like 4090s, and Ollama's own description for it even includes tool use. I think it's just not labeled for some reason. It works really well with the provided ollama-python package and other tools that already brought function calling capabilities via Ollama's API.

https://ollama.com/library/command-r

Re: Ollama now supports tool calling with popular models in local LLM

#23
post #12

The first I think of when anyone mentions agent-like “tool use” is: - Is the environment that the tools are run from sandboxed? I’m unclear on when/how/why you’d want an LLM executing code on your machine or in a non-sandboxed environment. Anyone care to enlighten?

Well often the code at the end of the day just reads data from a database or processes it in some way that relies on moving bits around / operations that the LLM on its own cannot do. IMO Tool is a bad word for the majority of the use cases ("calculator", "weather API"). It's more like giving the LLM an old school calculator + a constrained data retriever. Because you or somebody you entrust knows every line of code…

It's "function calling" that's the even worst naming IMHO, as the point is that the LLM is not actually calling a function, but just proposes a function call... Who will out themselves as having come up with this confusion?

Re: Ollama now supports tool calling with popular models in local LLM

#24
post #10

Earlier quoted context omitted.

No, this is a bit different. When GPT 4.o came out OpenAI also added new features that allow the models to perform actions. This allows you to do that, but locally. The reason this is cool is because it allows you to integrate with things like Home Assistant, so you can ask your chat bot or whatever to actual take actions. "Hey bot, turn on the lights in the basement" as an example.

Nit pick, but function calling, which is essentially what Tools are(an earlier evolution), was released before GPT-4-o, in June 2023. https://openai.com/index/function-calling-and-other-api-upda...

No that's a good call out, I got my timing a bit off there.

Re: Ollama now supports tool calling with popular models in local LLM

#25
post #12

The first I think of when anyone mentions agent-like “tool use” is: - Is the environment that the tools are run from sandboxed? I’m unclear on when/how/why you’d want an LLM executing code on your machine or in a non-sandboxed environment. Anyone care to enlighten?

You can use it to feed extra context in, similar to RAG but allowing the LLM to "decide" what information it needs. I think it's mostly useful in situations where you want to add content that isn't semantically related, and wouldn't RAG well.

E.g. if I were making an AI that could suggest restaurants, I could just say "find a Mexican restaurant that makes Horchata", have it translate that to a tool call to get a list of restaurants and their menus, and then run inference on that list.

I also tinkered with a Magic: The Gathering AI that used tool calling to get the text and rulings for cards so that I could ask it rules questions (it worked poorly). It saves the user from having to remember some kind of markup to denote card names so I can pre-process the query.

Re: Ollama now supports tool calling with popular models in local LLM

#26

My guess since programmer blog post writing (plus autism?) assumes “Everyone already knows everything about my project because I do!” … Is this to the effect of running a local LLM, that reads your prompt and then decides which correct/specialized LLM to hand it off to? If that is the case, isn’t it going to be a lot of latency to switch models back and forth as most people usually run the single largest model that w…

Llms are not a niche target and tool use is a major component. It's fair to say, as an author, Im assuming the reader has some comprehension- whether thats frm a widespread base of that the topic is only interesting to those with prior knowledge.

You wouldn't make this complaint against a JS framework blogposting about their new MVC features.

As an aside its actually incredible that these days we idly accuse people of being actual autists just because they didn't condescend to our level first.

Re: Ollama now supports tool calling with popular models in local LLM

#27

Pretty sweet to get to run models locally and have more advanced usages like tool calling, excited to try it out

It's a great start but there's a little more work to do for full OpenAI API compatibility, namely streaming support and the tool_choice parameter. Making it fully compatible would allow it be swapped in directly to frameworks like langchain and magentic [1] that I am building).

[1] https://github.com/jackmpcollins/magentic/issues/207

Post reply on HN