From cf63e330a2d208d65e3ae82b595831751eaf1af1 Mon Sep 17 00:00:00 2001 From: prezakhani <13303554+Pouyanpi@users.noreply.github.com> Date: Thu, 10 Oct 2024 12:53:47 +0200 Subject: [PATCH] feat: add colang history to generation logs --- nemoguardrails/rails/llm/llmrails.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nemoguardrails/rails/llm/llmrails.py b/nemoguardrails/rails/llm/llmrails.py index 9d00ddc5b..760b54da4 100644 --- a/nemoguardrails/rails/llm/llmrails.py +++ b/nemoguardrails/rails/llm/llmrails.py @@ -888,6 +888,11 @@ async def generate_async( res.log = GenerationLog() res.log.internal_events = new_events + # TODO: figure out what is the issue here + if options.log.colang_history: + if res.log is None: + res.log = GenerationLog() + res.log.colang_history = get_colang_history(events=events) if options.llm_output: # Currently, we include the output from the generation LLM calls. for activated_rail in _log.activated_rails: