Skip to content

Docs

Cookbook: Function Calling

Turn natural language into typed function calls: closed-set arguments become Choice questions, optional ones become Noul questions, and 54 questions ship in one request for a trading assistant.
Format
Docs
Reading time
3 min
Published by
TypeSafe AI
Last verified
Sep 2026

Highlights

  • 10 trading functions with 28 fillable closed-set arguments; each command sends 54 questions in one request.
  • A stated Noul marks an argument optional, so a no leaves the function's default in place.
  • The sample command maps at 0.82 confidence, with the benchmark argument the weakest at 0.78.

Quickstart

python
from dispatch import Dispatcher

assistant = Dispatcher(SPEC, TOOLS, client)  # 10 tools -> 54 questions per command
call = assistant("plot rolling correlation between nvda and spy for the past month")
# rolling_correlation(symbol='NVDA', benchmark='SPY', window='1mo')

print(call.tool.probability)  # P(this is the right function)
print(call.confidence)        # 0.91: the weakest judgement in the call
print(call.arguments["resolution"].omitted)  # unstated arg -> function default stands

Watch out

Free text, numbers, and dates never get a question and keep the function default, so wire your own parsers for those arguments.

Questions about this entry

Short answers drawn from the linked project or page.

Reactions & coverage

Posts, threads, and videos about this entry from around the web.

X: Tool calling as classify plus action, back to twelve-factor agents

X: A chat bot with no LLM

From the Jev guides

Original write-ups on what this entry is for.

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai