Skip to content

Commit

Permalink
Fix asyncio loop issue in combination with enable_input event
Browse files Browse the repository at this point in the history
  • Loading branch information
schuellc-nvidia committed Nov 19, 2024
1 parent 11294d9 commit 01fceb2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nemoguardrails/cli/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from nemoguardrails.logging import verbose
from nemoguardrails.logging.verbose import console
from nemoguardrails.streaming import StreamingHandler
from nemoguardrails.utils import new_event_dict, new_uuid
from nemoguardrails.utils import get_or_create_event_loop, new_event_dict, new_uuid

os.environ["TOKENIZERS_PARALLELISM"] = "false"

Expand Down Expand Up @@ -662,6 +662,7 @@ def run_chat(
)
elif rails_config.colang_version == "2.x":
rails_app = LLMRails(rails_config, verbose=verbose)
asyncio.run(_run_chat_v2_x(rails_app))
loop = get_or_create_event_loop()
loop.run_until_complete(_run_chat_v2_x(rails_app))
else:
raise Exception(f"Invalid colang version: {rails_config.colang_version}")

0 comments on commit 01fceb2

Please sign in to comment.