Raise an error if an LLM doesnt return a response

This commit is contained in:
Brandon Hancock
2024-11-01 11:13:07 -04:00
parent 66698503b8
commit 6df541962f
2 changed files with 14 additions and 5 deletions

View File

@@ -117,6 +117,15 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
callbacks=self.callbacks,
)
if answer is None or answer == "":
self._printer.print(
content="Received None or empty response from LLM call.",
color="red",
)
raise ValueError(
"Invalid response from LLM call - None or empty."
)
if not self.use_stop_words:
try:
self._format_answer(answer)