runOnLLMDispatcher

fun <T> AIAgentConfig.runOnLLMDispatcher(executorService: ERROR CLASS: Symbol not found for ExecutorService?? = null, block: suspend () -> T): T(source)

Executes the given suspending block of code on the LLM dispatcher (suitable for IO / LLM communication) derived from the provided executorService, or falls back to Dispatchers.IO if none is supplied.

Return

The result of the executed suspending block.

Parameters

T

The type of the result produced by the suspending block.

executorService

The custom ExecutorService to adapt as a coroutine context. If null, uses the default LLM executor service.

block

The suspending block of code to execute within the resolved coroutine context.