Skip to content

Commit

Permalink
Merge pull request #379 from NVIDIA/bugfix/378-missing-prompt-verbose…
Browse files Browse the repository at this point in the history
…-chat-models

Fix #378 - missing prompt in verbose mode for chat models
  • Loading branch information
drazvan authored Mar 6, 2024
2 parents 53abc16 + 026f184 commit 398ede9
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions nemoguardrails/logging/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,25 @@ async def on_chat_model_start(
llm_call_info = LLMCallInfo()
llm_call_info_var.set(llm_call_info)

prompt = "\n" + "\n".join(
[
Styles.CYAN
+ (
"User"
if msg.type == "human"
else "Bot"
if msg.type == "ai"
else "System"
)
+ Styles.PROMPT
+ "\n"
+ msg.content
for msg in messages[0] + Styles.RESET_ALL
]
prompt = (
"\n"
+ "\n".join(
[
Styles.CYAN
+ (
"User"
if msg.type == "human"
else "Bot"
if msg.type == "ai"
else "System"
)
+ Styles.PROMPT
+ "\n"
+ msg.content
for msg in messages[0]
]
)
+ Styles.RESET_ALL
)

log.info("Invocation Params :: %s", kwargs.get("invocation_params", {}))
Expand Down

0 comments on commit 398ede9

Please sign in to comment.