🔥 refactor(run.py): remove NotEnoughElementsException import and exception handling

Chroma implemented a fix for this so this exception won't be thrown anymore.
This commit is contained in:
Gabriel Almeida 2023-05-23 12:02:55 -03:00
commit ddf75d7eb9

View file

@ -2,7 +2,6 @@ import contextlib
import io
from typing import Any, Dict, List, Tuple
from chromadb.errors import NotEnoughElementsException # type: ignore
from langchain.schema import AgentAction
from langflow.api.callback import AsyncStreamingLLMCallbackHandler, StreamingLLMCallbackHandler # type: ignore
@ -195,10 +194,6 @@ async def get_result_and_steps(langchain_object, message: str, **kwargs):
else output
)
thought = format_actions(intermediate_steps) if intermediate_steps else ""
except NotEnoughElementsException as exc:
raise ValueError(
"Error: Not enough documents for ChromaDB to index. Try reducing chunk size in TextSplitter."
) from exc
except Exception as exc:
raise ValueError(f"Error: {str(exc)}") from exc
return result, thought