mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
Raise an error if an LLM doesnt return a response (#1548)
This commit is contained in:
committed by
GitHub
parent
57201fb856
commit
d70c542547
@@ -117,6 +117,15 @@ class CrewAgentExecutor(CrewAgentExecutorMixin):
|
|||||||
callbacks=self.callbacks,
|
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:
|
if not self.use_stop_words:
|
||||||
try:
|
try:
|
||||||
self._format_answer(answer)
|
self._format_answer(answer)
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
|
import io
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
import warnings
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from typing import Any, Dict, List, Optional, Union
|
from typing import Any, Dict, List, Optional, Union
|
||||||
import logging
|
|
||||||
import warnings
|
|
||||||
import litellm
|
import litellm
|
||||||
from litellm import get_supported_openai_params
|
from litellm import get_supported_openai_params
|
||||||
|
|
||||||
@@ -9,9 +12,6 @@ from crewai.utilities.exceptions.context_window_exceeding_exception import (
|
|||||||
LLMContextLengthExceededException,
|
LLMContextLengthExceededException,
|
||||||
)
|
)
|
||||||
|
|
||||||
import sys
|
|
||||||
import io
|
|
||||||
|
|
||||||
|
|
||||||
class FilteredStream(io.StringIO):
|
class FilteredStream(io.StringIO):
|
||||||
def write(self, s):
|
def write(self, s):
|
||||||
|
|||||||
Reference in New Issue
Block a user