Raise an error if an LLM doesnt return a response (#1548)

This commit is contained in:
Brandon Hancock (bhancock_ai)
2024-11-04 11:42:38 -05:00
committed by GitHub
parent 57201fb856
commit d70c542547
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)