How it works
The context is JSON with the user’srequest. The keys are yours to choose.
One single decision, tool, has one outcome per tool, named after it.
Each outcome’s description is the tool’s own description, which is how the model learns what each
tool does. A none outcome covers requests no tool can do.
One decision can list up to 255 outcomes, none included. Its
policy has abstain_below at 0.5: if no outcome reaches a probability of
0.5, the action is abstain.
Try it
Open this recipe in the playground to run it without an account. The request there is a table for four at Dishoom King’s Cross this Friday at 7pm, under Priya. The tools are search, book, directions and send a message. To run it from your code, setSQWISH_API_KEY as in the quickstart, then send this request:
Act on the answer
Adapt it to your data
- Your tools. Add one outcome per tool, with the tool’s name as the outcome and its description as the outcome’s description. Say what each tool does and where it ends, as you would for a person. The descriptions are all the model knows about your tools.
- Keep
none. Without it, the model has to name a tool even when none fits. - Earlier turns. If the request refers back to the conversation, send that under its own key,
such as
conversation, next torequest. - Many requests. Send one request per user request.
What to watch
- Requests that need two tools, such as “find a place and book it”. The decision picks one.
- Tools whose descriptions overlap. Rewrite them so each one says where it ends.
- Requests no tool fits. In testing, it often named a tool for these. If a wrong call is costly,
check
probabilities.noneagainst a threshold of your own, tested on your own requests.
How well it works
Measured withkettei-core on 1,000 examples from a public dataset, it chose the right answer 78.9% of the time. Always picking the most common answer scores 41.4%. Your own data will differ, so measure it on examples of yours before you rely on it (improve a decision).
Full results
Full results
- Dataset: BFCL live (multiple functions and irrelevance) (Apache-2.0).
- Sample: 1,000 rows, 1,000 measured decisions.
- Decisions measured:
tool. - Wording: hand-written.
Always picking the most common answer has an accuracy of 0.414, and guessing by how common each answer is has a log loss of 2.9656.These are past results on one dataset, not a promise of accuracy on yours.
Next steps
- Check a tool call before it runs: run, ask about or refuse the call your agent makes.
- Improve a decision: measure it on your own requests and make it more accurate.
- API reference: every field in the request and the answer.
