Skip to content

Commit

Permalink
Merge pull request #173 from topoteretes/fix_chunk_naive_llm_classifier
Browse files Browse the repository at this point in the history
fix: Fix chunk naive llm classifier
  • Loading branch information
dexters1 authored Oct 31, 2024
2 parents 50f5712 + 3567e0d commit b03850a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ async def batch_search(
async def delete_data_points(self, collection_name: str, data_point_ids: list[str]):
connection = await self.get_connection()
collection = await connection.open_table(collection_name)
results = await collection.delete(f"id IN {tuple(data_point_ids)}")
if len(data_point_ids) == 1:
results = await collection.delete(f"id = '{data_point_ids[0]}'")
else:
results = await collection.delete(f"id IN {tuple(data_point_ids)}")
return results

async def prune(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ async def chunk_naive_llm_classifier(data_chunks: list[DocumentChunk], classific
for chunk_index, chunk in enumerate(data_chunks):
chunk_classification = chunk_classifications[chunk_index]
classification_data_points.append(uuid5(NAMESPACE_OID, chunk_classification.label.type))
classification_data_points.append(uuid5(NAMESPACE_OID, chunk_classification.label.type))

for classification_subclass in chunk_classification.label.subclass:
classification_data_points.append(uuid5(NAMESPACE_OID, classification_subclass.value))
Expand All @@ -39,7 +38,7 @@ class Keyword(BaseModel):
if await vector_engine.has_collection(collection_name):
existing_data_points = await vector_engine.retrieve(
collection_name,
list(set(classification_data_points)),
[str(classification_data) for classification_data in list(set(classification_data_points))],
) if len(classification_data_points) > 0 else []

existing_points_map = {point.id: True for point in existing_data_points}
Expand Down

0 comments on commit b03850a

Please sign in to comment.