Phi-4 with Tools

#28
by tahafatih - opened

Is it possible to use the Phi-4 model with Tools?

I've been using Phi-4 with json style and python tool calling (in smolagents) agents. I was loading it with llama.cpp, so I had to write my own "model" to support it, but phi-4 is my favorite 'smaller' tool calling model I've used so far.

@RecViking please elaborate on how you were able to use Phi-4 w/ tool-calling

@mayonesa - I created a new "model" within the system so I could manually manipulate the grammars passed to the model. With some of the recent updates, the openai compatibility has improved and allows for additional parameters. You should be able to self host using something like llama.cpp and set up grammars for tool calling using the openai "model" (wrapper for openai library).

@RecViking please elaborate on how you were able to use Phi-4 w/ tool-calling

with smolagents, phi-4 also works using a TGI server. just set up an endpoint with TGI, use the OpenAIServerModel from smolagents and you are pretty much good to go

Your need to confirm your account before you can post a new comment.

Sign up or log in to comment