John O'Reilly
10/04/2025, 9:19 AMstrategy = functionalStrategy { input ->
var responses = requestLLMMultiple(input)
while (responses.containsToolCalls()) {
val pendingCalls = extractToolCalls(responses)
val results = executeMultipleTools(pendingCalls)
responses = sendMultipleToolResults(results)
}
responses.single().asAssistantMessage().content
},John O'Reilly
10/04/2025, 9:37 AMGetCountryTool calls could be run in parallel and likewise GetPopulationTool ones.
[GetCountryTool {"countryName":"Spain"}]
[GetCountryTool {"countryName":"France"}]
[GetCountryTool {"countryName":"Germany"}]
[GetCountryTool {"countryName":"Italy"}]
[GetPopulationTool {"countryCode":"ESP"}]
[GetPopulationTool {"countryCode":"FRA"}]
[GetPopulationTool {"countryCode":"DEU"}]
[GetPopulationTool {"countryCode":"ITA"}]
[GetEmissionsTool {"countryCodeList":["ESP","FRA","DEU","ITA"],"year":"2024"}]Didier Villevalois
10/04/2025, 10:03 AMexecuteMultipleCalls is a Boolean named parallelToolCalls (or something like it).John O'Reilly
10/04/2025, 10:07 AMpendingCalls always returns just 1 toolDidier Villevalois
10/04/2025, 10:08 AMJohn O'Reilly
10/04/2025, 10:16 AMpendingCalls containing list of those first 4 tool callsJohn O'Reilly
10/04/2025, 10:18 AMJohn O'Reilly
10/04/2025, 10:18 AMPending Calls
[GetCountryTool {"countryName":"Spain"}, GetCountryTool {"countryName":"France"}, GetCountryTool {"countryName":"Germany"}, GetCountryTool {"countryName":"Italy"}]
Pending Calls
[GetPopulationTool {"countryCode":"ESP"}, GetPopulationTool {"countryCode":"FRA"}, GetPopulationTool {"countryCode":"DEU"}, GetPopulationTool {"countryCode":"ITA"}, GetEmissionsTool {"year":"2024","countryCodeList":["ESP","FRA","DEU","ITA"]}]Didier Villevalois
10/04/2025, 10:23 AMJohn O'Reilly
10/04/2025, 10:25 AMDidier Villevalois
10/04/2025, 10:26 AMJohn O'Reilly
10/04/2025, 11:02 AM