Skip to content

Conversation

nitesh-osmosys
Copy link
Contributor

@nitesh-osmosys nitesh-osmosys commented May 15, 2024

API PR Checklist

Pre-requisites

  • I have gone through the Contributing guidelines for Submitting a Pull Request (PR) and ensured that this is not a duplicate PR.
  • I have performed preliminary unit testing.
  • I have updated the required api docs as applicable.
  • I have added/updated test cases to the test suite as applicable

PR Details

PR details have been updated as per the given format (see below)

  • PR title adheres to the format specified in guidelines (e.g., feat: add admin login endpoint)
  • Description has been added
  • Related changes have been added (optional)
  • Screenshots have been added (optional)
  • Query request and response examples have been added (as applicable, in case added or updated)
  • Documentation changes have been listed (as applicable)
  • Test suite output is added (as applicable)
  • Pending actions have been added (optional)
  • Any other additional notes have been added (optional)

Additional Information

  • Appropriate label(s) have been added (ready for review should be added if the PR is ready to be reviewed)
  • Assignee(s) and reviewer(s) have been added (optional)

Description:

Added openai implementation that works with chat gpt turbo engine. The implemented method create a formatted message from the input text file and get a summarized result from open ai.

Summary by CodeRabbit

  • New Features

    • Introduced a meeting summarization service using OpenAI API for generating effective meeting summaries.
  • Enhancements

    • Improved logging in job queue processing for better traceability.
    • Enhanced directory handling for file uploads to ensure directories are created if they do not exist.
  • Dependencies

    • Added new dependencies: fs-extra, openai, and openai-api.
    • Updated @types/jest to version ^29.5.12.

@nitesh-osmosys nitesh-osmosys added the Ready for review Ready for review label May 15, 2024
Copy link
Contributor

coderabbitai bot commented May 15, 2024

Warning

Rate Limit Exceeded

@xixas has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 45 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between de1fe00 and d2df79a.

Walkthrough

The recent updates to the apps/api project involve the addition of new dependencies like fs-extra, openai, and openai-api, along with an upgrade to @types/jest. Changes were made to improve file handling and logging in the SummaryConsumer and SummaryQueueProducer classes. A new MeetingSummaryService leveraging the OpenAI API for meeting transcript summaries was introduced, alongside enhancements in configuration handling and directory management.

Changes

File Path Change Summary
apps/api/package.json Added dependencies: fs-extra, openai, openai-api. Updated @types/jest to ^29.5.12.
apps/api/src/jobs/consumers/summary/summary.consumer.ts Enhanced SummaryConsumer to read files, generate summaries, and log messages.
apps/api/src/jobs/producers/summary/summary.producer.ts Improved logging in SummaryQueueProducer when adding jobs to the queue.
apps/api/src/main.ts Updated uploadDir logic to use join and ensure directory creation recursively.
apps/api/src/modules/summary/summarizer/summarizer.service.ts Introduced MeetingSummaryService for transcript parsing and summarization using OpenAI API.
apps/api/src/modules/summary/summary.module.ts Added MeetingSummaryService to the providers and exports arrays in SummaryModule.
apps/api/src/modules/summary/summary.service.ts Modified SummaryService to use configService.get for uploadPath configuration.

🐇✨
In code we trust, new paths we tread,
With OpenAI, our scripts are fed.
Logs now speak with clearer tone,
Summaries crafted, not alone.
Directories join, no file misled,
Progress made, our project sped.
Hopping forward, we forge ahead! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7521f8e and 7a00372.
Files ignored due to path filters (1)
  • apps/api/package-lock.json is excluded by !**/package-lock.json
Files selected for processing (7)
  • apps/api/package.json (2 hunks)
  • apps/api/src/jobs/consumers/summary/summary.consumer.ts (3 hunks)
  • apps/api/src/jobs/producers/summary/summary.producer.ts (1 hunks)
  • apps/api/src/main.ts (2 hunks)
  • apps/api/src/modules/summary/summarizer/summarizer.service.ts (1 hunks)
  • apps/api/src/modules/summary/summary.module.ts (1 hunks)
  • apps/api/src/modules/summary/summary.service.ts (1 hunks)
Additional comments not posted (19)
apps/api/src/modules/summary/summary.module.ts (3)

12-12: Ensure the import path for MeetingSummaryService is correct and consistent with the project structure.


23-23: Adding MeetingSummaryService to the providers array ensures it is available for dependency injection.


25-25: Adding MeetingSummaryService to the exports array makes it available for use in other modules.

apps/api/src/main.ts (3)

11-11: Importing join from 'path' is necessary for constructing the upload directory path.


23-25: Ensure the UPLOAD_FOLDER_PATH environment variable is correctly set and sanitized.


27-28: Creating the upload directory recursively ensures it exists before use.

apps/api/src/jobs/consumers/summary/summary.consumer.ts (4)

8-13: Ensure the import paths for MeetingSummaryService, path, fs/promises, and uploadDir are correct and consistent with the project structure.


23-23: Injecting MeetingSummaryService into the constructor ensures it is available for use in the class.


42-47: Ensure the file paths and content reading logic are correct and handle potential errors.


48-53: Generating the summary and updating the job status to SUCCESS is correctly handled.

apps/api/package.json (3)

50-50: Adding fs-extra provides additional file system methods that are useful for handling files.


58-59: Adding openai and openai-api dependencies is necessary for integrating OpenAI's API for generating summaries.


74-74: Updating @types/jest ensures compatibility with the latest version of Jest.

apps/api/src/modules/summary/summary.service.ts (1)

43-43: Ensure the UPLOAD_FOLDER_PATH environment variable is correctly set and sanitized.

apps/api/src/modules/summary/summarizer/summarizer.service.ts (5)

59-65: LGTM!

The calculateDuration method is simple and correctly calculates the duration based on the chunks.


134-157: LGTM!

The createBatches method correctly creates batches of chunks based on the maximum token limit.


159-164: LGTM!

The parallelSummarize method correctly generates summaries for each batch in parallel.


166-185: LGTM!

The recursiveCombineSummaries method correctly combines summaries recursively until only one summary remains.


188-205: LGTM!

The generateMeetingSummary method correctly orchestrates the entire process of generating a meeting summary, including error handling and logging.

xixas and others added 2 commits May 15, 2024 10:04
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7a00372 and 67308ee.
Files selected for processing (1)
  • apps/api/src/jobs/consumers/summary/summary.consumer.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/api/src/jobs/consumers/summary/summary.consumer.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 67308ee and de1fe00.
Files selected for processing (1)
  • apps/api/src/jobs/producers/summary/summary.producer.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/api/src/jobs/producers/summary/summary.producer.ts

xixas and others added 2 commits May 15, 2024 10:22
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@xixas xixas self-requested a review May 15, 2024 04:56
@osm-vishnukyatannawar osm-vishnukyatannawar changed the title feat: Add openai implementation for generating summaries feat: add openai implementation for generating summaries May 15, 2024
@xixas xixas merged commit 9709a41 into main May 15, 2024
@xixas xixas deleted the REST-544 branch May 15, 2024 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants