Skip to content

Commit

Permalink
consistent logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tabergma committed Oct 13, 2023
1 parent 5602e3a commit 34fb174
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,12 @@ def _generate_action_list_using_llm(self, prompt: str) -> Optional[str]:
end = time.time()

structlogger.info(
"rasa.llm_command_generator.llm_api_call.llm_output",
"rasa.llm_api_call.llm_command_generator.llm_output",
llm_output=llm_result.llm_output,
)
structlogger.info(
"rasa.llm_command_generator.llm_api_call.duration", duration=end - start
"rasa.llm_api_call.llm_command_generator.latency",
latency=end - start,
)

return llm_result.generations[0][0].text
Expand Down
10 changes: 5 additions & 5 deletions rasa/shared/core/flows/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,10 +1120,10 @@ def generate(self, tracker: DialogueStateTracker) -> Optional[Text]:
llm_result = llm.generate([prompt])
end = time.time()

logger.info(
f"rasa.flow.llm_api_call.llm_output: llm_output = {llm_result.llm_output}"
structlogger.info(
f"rasa.llm_api_call.flow.llm_output", llm_output=llm_result.llm_output
)
logger.info(f"rasa.flow.llm_api_call.duration: duration = {end - start}")
structlogger.info(f"rasa.llm_api_call.flow.latency", latency=end - start)

return llm_result.generations[0][0].text
except Exception as e:
Expand Down Expand Up @@ -1201,9 +1201,9 @@ def _generate_using_llm(self, prompt: str) -> Optional[str]:
end = time.time()

structlogger.info(
"rasa.flow.llm_api_call.llm_output", llm_output=llm_result.llm_output
"rasa.llm_api_call.flow.llm_output", llm_output=llm_result.llm_output
)
structlogger.info("rasa.flow.llm_api_call.duration", duration=end - start)
structlogger.info("rasa.llm_api_call.flow.latency", latency=end - start)

return llm_result.generations[0][0].text
except Exception as e:
Expand Down

0 comments on commit 34fb174

Please sign in to comment.