incrementLlmCallCount method
void
incrementLlmCallCount()
Increments the LLM call counter and enforces RunConfig.maxLlmCalls.
Throws an LlmCallsLimitExceededError when the limit is exceeded.
Implementation
void incrementLlmCallCount() {
_numberOfLlmCalls += 1;
final RunConfig? config = runConfig;
if (config != null &&
config.maxLlmCalls > 0 &&
_numberOfLlmCalls > config.maxLlmCalls) {
throw LlmCallsLimitExceededError(
'Max number of llm calls `${config.maxLlmCalls}` exceeded',
);
}
}