# utils/doc_ingest.py from .chat_rag import pdf_to_vec def ingest_document(file_location: str, user_id: str): """ Process and ingest a document into a user-specific vector database. :param file_location: The location of the uploaded file on the server. :param user_id: The ID of the user uploading the document. """ # Construct a unique collection name based on user_id collection_name = f"user_{user_id}_collection" try: vectordb = pdf_to_vec(file_location, collection_name) print("Document processed and ingested successfully into user-specific collection.") except Exception as e: print(f"Error processing document for user {user_id}: {e}") raise