NeMo-Guardrails icon indicating copy to clipboard operation
NeMo-Guardrails copied to clipboard

[BUG] Internal events keep on getting accumulated and reach the limit to 100 with less than 5 rails applied.

Open uvnikgupta opened this issue 1 year ago • 3 comments

The following code throws an exception when the number of internal events cross the hardcoded limit. nemoguardrails/colang/v1_0/runtime/runtime.py

  # As a safety measure, we stop the processing if we have too many events.
  if len(new_events) > 100:
      raise Exception("Too many events.")

My proposal is to either increase this limit or delete the older redundant events from the event's history to keep it short. Events like ContextUpdate, StartInternalSystemAction can be deleted from the history to trim it down

uvnikgupta avatar May 23 '24 17:05 uvnikgupta

Thanks for reporting this @uvnikgupta! Indeed, there are a couple of solutions here:

  1. Keep an explicit counter of the new events, and only increment it on certain types of events, e.g. starting a non-system action, bot saying something. (removing them would cause some other issues)
  2. Expose a way to control that limit as well (setting in config/environment variable).

If you want to contribute a solution, either would be fine.

Thanks!

drazvan avatar May 24 '24 08:05 drazvan

@drazvan, as a quick fix, I would propose adding a config parameter max_history_events with the default value of 100. If you agree, I can trying making this change and submit a PR

uvnikgupta avatar May 24 '24 11:05 uvnikgupta

Yes, let's call it max_new_events, as it captures better the meaning (i.e., the maximum number of new events that can be generated in a processing iteration). Thanks!

drazvan avatar May 27 '24 08:05 drazvan