Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Miras Ayed authored and mjrowsky committed Jan 9, 2025
1 parent ba6d5c6 commit d08e9d9
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,20 @@ def _parse_nodes(

return all_nodes


async def _aparse_nodes(
self,
nodes: Sequence[BaseNode],
show_progress: bool = False,
**kwargs: Any,
self,
nodes: Sequence[BaseNode],
show_progress: bool = False,
**kwargs: Any,
) -> List[BaseNode]:
"""Asynchronously parse document into nodes."""
all_nodes: List[BaseNode] = []
nodes_with_progress = get_tqdm_iterable(nodes, show_progress, "Parsing nodes")

for node in nodes_with_progress:
nodes = await self.abuild_semantic_nodes_from_documents([node], show_progress)
nodes = await self.abuild_semantic_nodes_from_documents(
[node], show_progress
)
all_nodes.extend(nodes)

return all_nodes
Expand Down Expand Up @@ -189,9 +190,9 @@ def build_semantic_nodes_from_documents(
return all_nodes

async def abuild_semantic_nodes_from_documents(
self,
documents: Sequence[Document],
show_progress: bool = False,
self,
documents: Sequence[Document],
show_progress: bool = False,
) -> List[BaseNode]:
"""Asynchronously build window nodes from documents."""
all_nodes: List[BaseNode] = []
Expand All @@ -201,9 +202,11 @@ async def abuild_semantic_nodes_from_documents(

sentences = self._build_sentence_groups(text_splits)

combined_sentence_embeddings = await self.embed_model.aget_text_embedding_batch(
[s["combined_sentence"] for s in sentences],
show_progress=show_progress,
combined_sentence_embeddings = (
await self.embed_model.aget_text_embedding_batch(
[s["combined_sentence"] for s in sentences],
show_progress=show_progress,
)
)

for i, embedding in enumerate(combined_sentence_embeddings):
Expand Down

0 comments on commit d08e9d9

Please sign in to comment.