llm
llm copied to clipboard
Output Schema with Tool Usage
The --schema option when provided with tools is ignored:
llm --schema "library_name, version float, hour_24 int" -m gpt-4.1-nano -T llm_version -T llm_time 'Give me the current time and LLM version'
The current LLM version is 0.26. The current local time is 2025-05-28 04:31:52 EDT, and the UTC time is 2025-05-28 08:31:52.
Below is a counter example without tool calls:
% llm --schema "library_name, version float, hour_24 int" -m gpt-4.1-nano 'Make up a time and version'
{"library_name":"ExampleLib","version":2.5,"hour_24":14}
I believe the simplest solution is that the --schema options adds a call at the end to do as Simon suggested on Discord:
I asked Gemini 2.5 Pro about this problem and here are the details it came up with. It's a lot of slop, so I didn't want to paste it all in here: https://gist.github.com/imaurer/d6c033d436177b69ac0ceac8e6816df4