Small script, DT 4.0.2 on macOS 15.5
tell application id "DNtp"
set prompt to "Determine the amount of each invoice. It is close to the word \"Betrag\", \"Rechnungsbetrag\", \"Gesamtbetrag\" \"Gesamt-Restbetrag\" or \"Summe\". If none of these are found, use the highest amount. Return only the amounts found without currency and additional text as a array of numbers."
set result to get chat response for message prompt record (selected records) temperature 0
end tell
gives me error "…: Too many records specified." number -50
I think that I closely followed the example in the scripting dictionary. Except for the prompt, but changing that to “create a detailed summary for all selected documents.” doesn’t change anything.
JFR: The same thing happens with JXA. And everything works fine if I pass only one record. And nothing ever goes to the locally running AI (LM Studio with Gemma 2.9)
Am I doing something stupid?
No. The number of documents that can be processed at once is limited, especially in case of local models and tiny context windows.
I see. Four was the limit in my case. Is that a fixed number or does it depend on the size of the text, too?,
This depends on the context window.
Ok. And I noticed that with one model (google/gemma-3n-e4b), only the first record was processed. This model used a tool to retrieve only this one. gemma-2-9b-it handles all records and doesn’t use a tool.
I feel as if I’d time-traveled back to the flip-switched programming and mercury storage … But that’s probably because I haven’t found the surely wonderful and comprehensive documentation on all these AI thingies yet (yes, I haven’t read the DT manual on that only cursorily).
Gemma 2-9b doesn’t support tool calls and Gemma 3n-eb4 is a dumbed down version of Gemma 3:27b and not very reliable in my experience.
Note even commercial AI can have limitations. This is with Claude 4 Sonnet…
But YMMV, depending on the model, server responses, the data being handled, etc.
Thanks for the explanation. I’ll try Gemma 3:27b then.