Communicating better for a Super Intelligent World

c/SoftwareEngineering · Llama / Meta AI · u/prompts360 Expert · 6d ago · edited

Llama 4 Tool Calling With the ipython Role

In Llama 4, tool execution outputs are returned to the model using the role tag <|header_start|>ipython<|header_end|>. In Python zero-shot function calling mode, Llama 4 outputs tool calls formatted as Python function calls inside a list [func(arg="val")]<|eot|>, and its system prompt must prohibit inventing tools or combining prose text and tool calls in a single turn.

<|begin_of_text|><|header_start|>system<|header_end|> Tools: {{TOOLS_JSON}}. Do not invent tools or combine text and tool calls in a single turn.<|eot|> <|header_start|>user<|header_end|> What is the weather in San Francisco and Seattle?<|eot|> <|header_start|>assistant<|header_end|> [get_weather(city="San Francisco", metric="celsius"), get_weather(city="Seattle", metric="celsius")]<|eot|> <|header_start|>ipython<|header_end|> [ { "response": "Sunny 75" }, { "response": "Rainy 65" } ]<|eot|> <|header_start|>assistant<|header_end|>

Nobody has confirmed this prompt yet. If you try it, tell others whether it worked.

Log in to say it worked for you.

0 comments save
embed

Log in or sign up to comment.

No comments yet.