COSC481W-2024Winter / JARVIS

J.A.R.V.I.S
2 stars 3 forks source link

PBI 2: Sorter Results and ChatGPT summaries - BACKEND #39

Closed ghost closed 8 months ago

ghost commented 8 months ago

PBI 2: Sorter Results and ChatGPT Summaries - BACKEND

User Story: As Cathie, a project manager frequently overwhelmed with sorting through numerous emails daily, I want a system that automatically categorizes my emails and provides concise summaries for each category. This way, when I access my email dashboard, I can quickly grasp the essential content of each category without having to sift through every individual email, enabling me to focus on the most critical messages first and manage my time more efficiently.

Persona: Project managers or professionals who handle a high volume of daily emails and need a streamlined method to quickly identify and address the most crucial communications without getting bogged down by less important messages.

Feature: An automated system that categorizes incoming emails into distinct categories and provides a concise summary for each category, allowing users to quickly understand the key content of each group at a glance.

Business Value: Enhances productivity and time management for users by reducing the time and effort spent on email management. It allows users to prioritize their focus on emails that are critical to their work, thereby improving their efficiency and effectiveness in their roles.

- Collect categorized email outputs from the JARVIS-email-sorter, filter them to retain only the specified categories, and generate and store summaries using ChatGPT for each selected category so that the front end can quickly display this organized and summarized information to the user upon request.

Tasks:

Sorter Output Collection:

Category Filtering:

ChatGPT Integration and Summarization:

Data Storage and Retrieval (Optional):

Performance and Error Handling:

Testing and Optimization:

Decision on Processing Sequence:

Emily Note: I will move to this task after completing my first PBI. If the first PBI ends up needing significant work, I'll get started on this one, but then finish it in Sprint 3.

Acceptance Criteria:

These will be done via Mock and Integration Tests.

Timeline: By 03/08 (Friday):

By 03/10 (Sunday):

By 03/13 (Wednesday):

By 03/17 (Sunday):

By 03/20 (Wednesday):

ghost commented 8 months ago

I have basically finished this, but I want to ensure understanding of file creation. right now all the files are created as "mocks", but I will need to make a dummy class to see how it performs on a real phone. Right now we use a 'localstorage' package. Ideally the actual files will be created, e.g: storageService.saveData(categoryKey, {'emails': categoryList}), will save a real file, that can be accessed. (In the test environment, the storage is mocked in memory to avoid creating garbage.)

This goes a bit beyond the requirements, but will be helpful since I finished majority of the code early. Further tests to handle different loads should also be implemented. I will talk further will luna about connecting these two halves.

ghost commented 8 months ago

Results of full throttle integration test on 100 emails.

Error generating summary for EmailCategory.companyBusinessStrategy: Exception: Rate limiting error. Request too large for gpt-3.5-turbo in organization org-gDzFzIDbqthmTj1mVn6HTTxX on tokens per min (TPM): Limit 160000, Requested 1346993. The input or output tokens must be reduced in order to run successfully. Visit https://platform.openai.com/account/rate-limits to learn more. Summary for EmailCategory.purelyPersonal: The emails appear to be related to a discussion about flight tickets, specifically inquiring about Air France and Continental flights to various destinations such as Amsterdam, Rome, and Warsaw. Additionally, there are personal messages expressing love and a request for a phone call. The sender's name appears to be Wincenty J Kaminski. No emails found for category: EmailCategory.personalButProfessional Error generating summary for EmailCategory.logisticArrangements: Exception: Failed to generate completion. Status code: 400 No emails found for category: EmailCategory.employmentArrangements Error generating summary for EmailCategory.documentEditingCheckingCollaboration: Exception: Failed to generate completion. Status code: 400 No emails found for category: EmailCategory.emptyMessageDueToMissingAttachment No emails found for category: EmailCategory.emptyMessage Summary for EmailCategory.purelyPersonal: The emails appear to be related to a discussion about flight tickets, specifically inquiring about Air France and Continental flights to various destinations such as Amsterdam, Rome, and Warsaw. Additionally, there are personal messages expressing love and a request for a phone call. The sender's name appears to be Wincenty J Kaminski.

Need to implement some more methods to handle a large drop.

ghost commented 8 months ago

The tests need to be optimized to handle a larger flow. 100 might be out of the scope of the project, but 20-30 should be manageable in a single batch.

ghost commented 8 months ago

It can now handle 100 emails, and technically infinite emails. That would be a bad idea to do however. This has been merged with luna's into [30-etl-emails-to-sorter](https://github.com/COSC481W-2024Winter/JARVIS/tree/30-etl-emails-to-sorter). They needed to be pre-merged before going to main because they had some interesting conflicts. I also added a screen to see the two processes working in the app on the phone. Luna's calls the sorter on the user's email, mine calls the sorter on the test emails and sends them to chatgpt.

ghost commented 8 months ago

Issue has been completed