🔧 fix(types.py): fix indentation issue in the repr method of DocumentLoaderVertex and TextSplitterVertex classes
🔧 fix(types.py): calculate average document length in the repr method of DocumentLoaderVertex and TextSplitterVertex classes
This commit is contained in:
parent
7e712b1be8
commit
fbdde257e0
1 changed files with 9 additions and 0 deletions
|
|
@ -93,7 +93,11 @@ class DocumentLoaderVertex(Vertex):
|
|||
# show how many documents are in the list?
|
||||
|
||||
if self._built_object:
|
||||
avg_length = sum(len(doc.page_content) for doc in self._built_object) / len(
|
||||
self._built_object
|
||||
)
|
||||
return f"""{self.vertex_type}({len(self._built_object)} documents)
|
||||
\nAvg. Document Length (characters): {avg_length}
|
||||
Documents: {self._built_object[:3]}..."""
|
||||
return f"{self.vertex_type}()"
|
||||
|
||||
|
|
@ -125,8 +129,13 @@ class TextSplitterVertex(Vertex):
|
|||
def _built_object_repr(self):
|
||||
# This built_object is a list of documents. Maybe we should
|
||||
# show how many documents are in the list?
|
||||
|
||||
if self._built_object:
|
||||
avg_length = sum(len(doc.page_content) for doc in self._built_object) / len(
|
||||
self._built_object
|
||||
)
|
||||
return f"""{self.vertex_type}({len(self._built_object)} documents)
|
||||
\nAvg. Document Length (characters): {avg_length}
|
||||
\nDocuments: {self._built_object[:3]}..."""
|
||||
return f"{self.vertex_type}()"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue