Skip to content

feat: Integrate OpenAI for AI Summarization #4

@evildead23151

Description

@evildead23151

Description

To add a layer of intelligence to the app, we want to provide an AI-generated summary of each transcribed note. This issue involves creating a new service to communicate with the OpenAI API and integrating it into the note-creation flow.

Task

  1. Create a new file, lib/openai.ts.
  2. Inside this file, create a function summarizeText(text: string) that sends the transcribed text to the OpenAI API (GPT-3.5 or GPT-4). The prompt should instruct the model to create a concise title and a one-paragraph summary.
  3. Modify the handleTranscription flow in add.tsx. After receiving the transcript from AssemblyAI, it should be passed to the new summarizeText function.
  4. The final saved note object in AsyncStorage should now include title and summary fields returned by the OpenAI API.

Acceptance Criteria

  • The summarizeText function correctly calls the OpenAI API and handles the response.
  • The user's OPENAI_API_KEY must be loaded securely from the .env file.
  • The final saved note object contains title and summary properties generated by AI.
  • The function should have robust error handling in case the OpenAI API call fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions