Skip to content

Commit

Permalink
Add nomic logging and deleting back to /ingest
Browse files Browse the repository at this point in the history
  • Loading branch information
KastanDay committed Mar 6, 2024
1 parent 9460933 commit 44e9c11
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ai_ta_backend/beam/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
from qdrant_client import QdrantClient, models
from qdrant_client.models import PointStruct

from ai_ta_backend.beam.nomic_logging import (
delete_from_document_map,
log_to_document_map,
)

# from langchain.schema.output_parser import StrOutputParser
# from langchain.chat_models import AzureChatOpenAI

Expand Down Expand Up @@ -957,10 +962,8 @@ def split_and_upload(self, texts: List[str], metadatas: List[Dict[str, Any]]):

# add to Nomic document map
if len(response.data) > 0:
pass
# TODO: reimplement nomic
# inserted_data = response.data[0]
# res = log_to_document_map(inserted_data)
inserted_data = response.data[0]
log_to_document_map(inserted_data)

self.posthog.capture('distinct_id_of_the_user',
event='split_and_upload_succeeded',
Expand Down Expand Up @@ -1092,7 +1095,7 @@ def delete_data(self, course_name: str, s3_path: str, source_url: str):
nomic_ids_to_delete.append(str(data['id']) + "_" + str(i))

# delete from Nomic
# res = delete_from_document_map(course_name, nomic_ids_to_delete)
delete_from_document_map(course_name, nomic_ids_to_delete)
except Exception as e:
print("Error in deleting file from Nomic:", e)
sentry_sdk.capture_exception(e)
Expand Down Expand Up @@ -1137,8 +1140,7 @@ def delete_data(self, course_name: str, s3_path: str, source_url: str):
nomic_ids_to_delete.append(str(data['id']) + "_" + str(i))

# delete from Nomic
# TODO: reimplement...
# res = delete_from_document_map(course_name, nomic_ids_to_delete)
delete_from_document_map(course_name, nomic_ids_to_delete)
except Exception as e:
print("Error in deleting file from Nomic:", e)
sentry_sdk.capture_exception(e)
Expand Down

0 comments on commit 44e9c11

Please sign in to comment.