Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
star-nox committed Mar 12, 2024
1 parent 7dc8236 commit f25d692
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ai_ta_backend/beam/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def ingest(**inputs: Dict[str, Any]):
print("Final success_fail_dict: ", success_fail_dict)

# rebuild nomic document map after all ingests are done
rebuild_status = rebuild_map(course_name, map_type='document', supabase_client)
rebuild_status = rebuild_map(course_name, map_type='document')
return success_fail_dict


Expand Down
21 changes: 4 additions & 17 deletions ai_ta_backend/beam/nomic_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,6 @@ def log_to_document_map(data: dict):
# append to existing map
project_name = "Document Map for " + course_name
result = append_to_map(embeddings, metadata, project_name)

# check if project is accepting new datums
if project.is_accepting_data:
with project.wait_for_project_lock():
project.rebuild_maps()

# with project.wait_for_project_lock():
# project.rebuild_maps()
return result

except Exception as e:
Expand Down Expand Up @@ -729,7 +721,7 @@ def data_prep_for_doc_map(df: pd.DataFrame):

return embeddings, metadata

def rebuild_map(course_name:str, map_type:str, supabase_client):
def rebuild_map(course_name:str, map_type:str):
"""
This function rebuilds a given map in Nomic.
"""
Expand All @@ -741,15 +733,10 @@ def rebuild_map(course_name:str, map_type:str, supabase_client):
NOMIC_MAP_NAME_PREFIX = 'Conversation Map for '

try:
# check if map exists
response = supabase_client.table("projects").select("doc_map_id").eq("course_name", course_name).execute()
if response.data:
project_id = response.data[0]['doc_map_id']
else:
return "No map found for this course"

# fetch project from Nomic
project = AtlasProject(project_id=project_id, add_datums_if_exists=True)
project_name = NOMIC_MAP_NAME_PREFIX + course_name
project = AtlasProject(name=project_name, add_datums_if_exists=True)

with project.wait_for_project_lock():
project.rebuild_maps()
return "Successfully rebuilt map"
Expand Down

0 comments on commit f25d692

Please sign in to comment.