SPB Git

Repository Public

meeting-minutes.md 22.1 KB 719 lines markdown

1# Meeting minutes23> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.45In this tutorial, you'll build an automated meeting minutes generator. The application transcribes a meeting recording, summarizes the discussion, extracts key points and action items, analyzes sentiment, and saves the result as a Word document.67## Getting started89This tutorial assumes familiarity with one of the supported languages and an [OpenAI API key](https://platform.openai.com/settings/organization/api-keys). You can use the short smoke-test audio file or your own recording of up to 25 MB.1011Install the [OpenAI SDK](https://developers.openai.com/api/docs/libraries) and a DOCX library for your language:1213- JavaScript: [`docx`](https://docx.js.org/)14- Python: [`python-docx`](https://python-docx.readthedocs.io/en/latest/)15- Go: [`godocx`](https://github.com/gomutex/godocx)16- Java: [Apache POI XWPF](https://poi.apache.org/components/document/quick-guide-xwpf.html)17- Ruby: [`caracal`](https://github.com/urvin-compliance/caracal)1819## Transcribing audio20212223  2425    The first step is to pass the meeting recording to the 26      [/v1/audio API](https://developers.openai.com/api/reference/resources/audio). The current27      file transcription model converts spoken language into written text. To28      start, omit the optional 29      [prompt](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create#audio/createTranscription-prompt) 30      and 31      [temperature](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create#audio/createTranscription-temperature-4) 32      parameters and use their default values.33    3435    3637      3839Download sample audio404142    4344  4546474849505152Save the downloaded file as `meeting.wav` in the directory from which you run the example, or replace `meeting.wav` with the path to your recording. The short downloadable clip verifies the workflow; use an actual meeting recording of up to 25 MB to generate useful summaries and action items.5354Define a helper that opens the recording and sends the file contents to [`gpt-transcribe`](https://developers.openai.com/api/docs/models/gpt-transcribe):5556```javascript57import fs from "node:fs";5859import { Document, HeadingLevel, Packer, Paragraph, TextRun } from "docx";60import OpenAI from "openai";6162const openai = new OpenAI();6364async function transcribeAudio(audioFilePath) {65  const transcription = await openai.audio.transcriptions.create({66    file: fs.createReadStream(audioFilePath),67    model: "gpt-transcribe",68  });69  return transcription.text;70}71```7273```python74from pathlib import Path7576from docx import Document77from openai import OpenAI7879client = OpenAI()808182def transcribe_audio(audio_file_path: str | Path) -> str:83    with Path(audio_file_path).open("rb") as audio_file:84        transcription = client.audio.transcriptions.create(85            file=audio_file,86            model="gpt-transcribe",87        )88    return transcription.text89```9091```go92package main9394import (95	"context"96	"fmt"97	"os"98	"strings"99100	"github.com/gomutex/godocx"101	"github.com/openai/openai-go/v3"102)103104type meetingMinutes struct {105	AbstractSummary string106	KeyPoints       string107	ActionItems     string108	Sentiment       string109}110111var client = openai.NewClient()112113func transcribeAudio(ctx context.Context, audioFilePath string) (string, error) {114	audioFile, err := os.Open(audioFilePath)115	if err != nil {116		return "", err117	}118	defer audioFile.Close()119120	transcription, err := client.Audio.Transcriptions.New(ctx, openai.AudioTranscriptionNewParams{121		File:  audioFile,122		Model: "gpt-transcribe",123	})124	if err != nil {125		return "", err126	}127	return transcription.Text, nil128}129```130131```java132import com.openai.client.OpenAIClient;133import com.openai.client.okhttp.OpenAIOkHttpClient;134import com.openai.models.audio.transcriptions.TranscriptionCreateParams;135import com.openai.models.chat.completions.ChatCompletionCreateParams;136import java.io.IOException;137import java.io.OutputStream;138import java.math.BigInteger;139import java.nio.file.Files;140import java.nio.file.Path;141import org.apache.poi.xwpf.usermodel.XWPFDocument;142import org.apache.poi.xwpf.usermodel.XWPFStyle;143import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;144import org.openxmlformats.schemas.wordprocessingml.x2006.main.STStyleType;145146public final class TutorialMeetingMinutesExample {147  private TutorialMeetingMinutesExample() {}148149  record MeetingMinutes(150      String abstractSummary, String keyPoints, String actionItems, String sentiment) {}151152  private static final class ClientHolder {153    private static final OpenAIClient INSTANCE = OpenAIOkHttpClient.fromEnv();154  }155156  private static OpenAIClient client() {157    return ClientHolder.INSTANCE;158  }159160  static String transcribeAudio(Path audioFilePath) {161    var transcription =162        client()163            .audio()164            .transcriptions()165            .create(166                TranscriptionCreateParams.builder()167                    .file(audioFilePath)168                    .model("gpt-transcribe")169                    .build());170    return transcription.asTranscription().text();171  }172```173174```ruby175require "caracal"176require "openai"177require "pathname"178179client = OpenAI::Client.new180181def transcribe_audio(client, audio_file_path)182  transcription = client.audio.transcriptions.create(183    file: Pathname(audio_file_path),184    model: "gpt-transcribe"185  )186  transcription.text187end188```189190191The helper accepts a local audio path, opens the file with the language's standard file API, and passes the file contents to the transcription model. The transcription endpoint needs the audio bytes, not a local path or remote URL. If your server stores recordings elsewhere, download or stream the recording into the request before creating the transcription.192193## Summarizing and analyzing the transcript with a GPT model194195Pass the transcript to a GPT model through the [Chat Completions API](https://developers.openai.com/api/reference/resources/chat). This tutorial demonstrates the still-supported Chat Completions path for existing integrations. For new projects, use the [Responses API](https://developers.openai.com/api/docs/guides/migrate-to-responses) and start with [`gpt-6-astra`](https://developers.openai.com/api/docs/models/gpt-6-astra). The snippets below use a tested model to generate a summary, extract key points and action items, and analyze sentiment.196197This tutorial uses a separate model call for each task. You can combine the instructions into one request to reduce calls, but separate prompts make each result easier to tune.198199Define the shared helper that sends the transcript and task-specific instructions to the model:200201```javascript202async function complete(transcription, instructions) {203  const response = await openai.chat.completions.create({204    model: "gpt-5.5",205    messages: [206      { role: "system", content: instructions },207      { role: "user", content: transcription },208    ],209  });210  return response.choices[0].message.content ?? "";211}212```213214```python215def complete(transcription: str, instructions: str) -> str:216    response = client.chat.completions.create(217        model="gpt-5.5",218        messages=[219            {"role": "system", "content": instructions},220            {"role": "user", "content": transcription},221        ],222    )223    return response.choices[0].message.content or ""224```225226```go227func complete(ctx context.Context, transcription, instructions string) (string, error) {228	response, err := client.Chat.Completions.New(ctx, openai.ChatCompletionNewParams{229		Model: "gpt-5.5",230		Messages: []openai.ChatCompletionMessageParamUnion{231			openai.SystemMessage(instructions),232			openai.UserMessage(transcription),233		},234	})235	if err != nil {236		return "", err237	}238	return response.Choices[0].Message.Content, nil239}240```241242```java243private static String complete(String transcription, String instructions) {244  var response =245      client()246          .chat()247          .completions()248          .create(249              ChatCompletionCreateParams.builder()250                  .model("gpt-5.5")251                  .addSystemMessage(instructions)252                  .addUserMessage(transcription)253                  .build());254  return response.choices().get(0).message().content().orElse("");255}256```257258```ruby259def complete(client, transcription, instructions)260  response = client.chat.completions.create(261    model: "gpt-5.5",262    messages: [263      {264        role: :system,265        content: instructions266      },267      {268        role: :user,269        content: transcription270      }271    ]272  )273  response.choices.first.message.content || ""274end275```276277278Define an orchestration helper that returns the four sections of the meeting minutes:279280```javascript281async function buildMeetingMinutes(transcription) {282  return {283    "Abstract summary": await extractAbstractSummary(transcription),284    "Key points": await extractKeyPoints(transcription),285    "Action items": await extractActionItems(transcription),286    Sentiment: await analyzeSentiment(transcription),287  };288}289```290291```python292def meeting_minutes(transcription: str) -> dict[str, str]:293    return {294        "Abstract summary": abstract_summary_extraction(transcription),295        "Key points": key_points_extraction(transcription),296        "Action items": action_item_extraction(transcription),297        "Sentiment": sentiment_analysis(transcription),298    }299```300301```go302func buildMeetingMinutes(ctx context.Context, transcription string) (meetingMinutes, error) {303	summary, err := extractAbstractSummary(ctx, transcription)304	if err != nil {305		return meetingMinutes{}, err306	}307	keyPoints, err := extractKeyPoints(ctx, transcription)308	if err != nil {309		return meetingMinutes{}, err310	}311	actionItems, err := extractActionItems(ctx, transcription)312	if err != nil {313		return meetingMinutes{}, err314	}315	sentiment, err := analyzeSentiment(ctx, transcription)316	if err != nil {317		return meetingMinutes{}, err318	}319	return meetingMinutes{summary, keyPoints, actionItems, sentiment}, nil320}321```322323```java324static MeetingMinutes buildMeetingMinutes(String transcription) {325  return new MeetingMinutes(326      extractAbstractSummary(transcription),327      extractKeyPoints(transcription),328      extractActionItems(transcription),329      analyzeSentiment(transcription));330}331```332333```ruby334def build_meeting_minutes(client, transcription)335  {336    "Abstract summary" => extract_abstract_summary(client, transcription),337    "Key points" => extract_key_points(client, transcription),338    "Action items" => extract_action_items(client, transcription),339    "Sentiment" => analyze_sentiment(client, transcription)340  }341end342```343344345The helper passes the transcript to four focused helpers: one each for the summary, key points, action items, and sentiment. Add another helper and output section if your application needs more analysis.346347Here is how each of these functions works:348349### Summary extraction350351The summary helper asks the model for one concise paragraph that preserves important decisions and context while omitting tangents. The system message controls this behavior. For more ways to shape the result, see the [prompt engineering guide](https://developers.openai.com/api/docs/guides/prompt-engineering).352353```javascript354async function extractAbstractSummary(transcription) {355  return complete(356    transcription,357    "Summarize the meeting transcript in one concise paragraph. Keep the most important decisions and context, and omit tangents."358  );359}360```361362```python363def abstract_summary_extraction(transcription: str) -> str:364    return complete(365        transcription,366        "Summarize the meeting transcript in one concise paragraph. "367        "Keep the most important decisions and context, and omit tangents.",368    )369```370371```go372func extractAbstractSummary(ctx context.Context, transcription string) (string, error) {373	return complete(ctx, transcription, "Summarize the meeting transcript in one concise paragraph. Keep the most important decisions and context, and omit tangents.")374}375```376377```java378static String extractAbstractSummary(String transcription) {379  return complete(380      transcription,381      "Summarize the meeting transcript in one concise paragraph. "382          + "Keep the most important decisions and context, and omit tangents.");383}384```385386```ruby387def extract_abstract_summary(client, transcription)388  complete(389    client,390    transcription,391    "Summarize the meeting transcript in one concise paragraph. Keep the most important decisions and context, and omit tangents."392  )393end394```395396397### Key points extraction398399The key-points helper lists the important ideas, findings, and topics discussed in the meeting. Add relevant project or company context to the system message when it helps the model identify what matters to your audience.400401```javascript402async function extractKeyPoints(transcription) {403  return complete(404    transcription,405    "List the most important ideas, findings, and topics from the meeting. Use concise bullet points."406  );407}408```409410```python411def key_points_extraction(transcription: str) -> str:412    return complete(413        transcription,414        "List the most important ideas, findings, and topics from the meeting. "415        "Use concise bullet points.",416    )417```418419```go420func extractKeyPoints(ctx context.Context, transcription string) (string, error) {421	return complete(ctx, transcription, "List the most important ideas, findings, and topics from the meeting. Use concise bullet points.")422}423```424425```java426static String extractKeyPoints(String transcription) {427  return complete(428      transcription,429      "List the most important ideas, findings, and topics from the meeting. "430          + "Use concise bullet points.");431}432```433434```ruby435def extract_key_points(client, transcription)436  complete(437    client,438    transcription,439    "List the most important ideas, findings, and topics from the meeting. Use concise bullet points."440  )441end442```443444445### Action item extraction446447The action-items helper identifies tasks and follow-ups, including owners and deadlines when the transcript provides them. To create and assign tasks in another system, connect this step to [function calling](https://developers.openai.com/api/docs/guides/function-calling).448449```javascript450async function extractActionItems(transcription) {451  return complete(452    transcription,453    "List every task or follow-up agreed to in the meeting. Include the owner and deadline when the transcript provides them."454  );455}456```457458```python459def action_item_extraction(transcription: str) -> str:460    return complete(461        transcription,462        "List every task or follow-up agreed to in the meeting. "463        "Include the owner and deadline when the transcript provides them.",464    )465```466467```go468func extractActionItems(ctx context.Context, transcription string) (string, error) {469	return complete(ctx, transcription, "List every task or follow-up agreed to in the meeting. Include the owner and deadline when the transcript provides them.")470}471```472473```java474static String extractActionItems(String transcription) {475  return complete(476      transcription,477      "List every task or follow-up agreed to in the meeting. "478          + "Include the owner and deadline when the transcript provides them.");479}480```481482```ruby483def extract_action_items(client, transcription)484  complete(485    client,486    transcription,487    "List every task or follow-up agreed to in the meeting. Include the owner and deadline when the transcript provides them."488  )489end490```491492493### Sentiment analysis494495The sentiment helper classifies the discussion as positive, negative, or neutral and explains the assessment. For simpler tasks, try [`gpt-5.6-terra`](https://developers.openai.com/api/docs/models/gpt-5.6-terra) to see whether it meets your quality target with lower cost and latency.496497```javascript498async function analyzeSentiment(transcription) {499  return complete(500    transcription,501    "Describe the meeting's overall sentiment as positive, negative, or neutral, and briefly explain the assessment."502  );503}504```505506```python507def sentiment_analysis(transcription: str) -> str:508    return complete(509        transcription,510        "Describe the meeting's overall sentiment as positive, negative, or "511        "neutral, and briefly explain the assessment.",512    )513```514515```go516func analyzeSentiment(ctx context.Context, transcription string) (string, error) {517	return complete(ctx, transcription, "Describe the meeting's overall sentiment as positive, negative, or neutral, and briefly explain the assessment.")518}519```520521```java522static String analyzeSentiment(String transcription) {523  return complete(524      transcription,525      "Describe the meeting's overall sentiment as positive, negative, or neutral, "526          + "and briefly explain the assessment.");527}528```529530```ruby531def analyze_sentiment(client, transcription)532  complete(533    client,534    transcription,535    "Describe the meeting's overall sentiment as positive, negative, or neutral, and briefly explain the assessment."536  )537end538```539540541## Exporting meeting minutes542543544545  546547    Save the meeting minutes in a readable format that you can distribute.548      Microsoft Word is a common choice for this kind of report. The examples549      use a DOCX library suited to each language. In an end-to-end application,550      you could send the result in an email or write it to another system551      instead.552    553554  555556557558559560</br>561562Define a helper that writes each result section to a Word document:563564```javascript565async function saveAsDocx(minutes, filename) {566  const children = Object.entries(minutes).flatMap(([heading, content]) => [567    new Paragraph({ text: heading, heading: HeadingLevel.HEADING_1 }),568    new Paragraph({569      children: content570        .split(/\r\n?|\n/)571        .flatMap((line, index) => [572          ...(index > 0 ? [new TextRun({ break: 1 })] : []),573          new TextRun(line),574        ]),575    }),576  ]);577  const document = new Document({ sections: [{ children }] });578  await fs.promises.writeFile(filename, await Packer.toBuffer(document));579}580```581582```python583def save_as_docx(minutes: dict[str, str], filename: Path) -> None:584    document = Document()585    for heading, content in minutes.items():586        document.add_heading(heading, level=1)587        document.add_paragraph(content)588    document.save(filename)589```590591```go592func saveAsDocx(minutes meetingMinutes, filename string) error {593	document, err := godocx.NewDocument()594	if err != nil {595		return err596	}597	for _, section := range []struct{ heading, content string }{598		{"Abstract summary", minutes.AbstractSummary},599		{"Key points", minutes.KeyPoints},600		{"Action items", minutes.ActionItems},601		{"Sentiment", minutes.Sentiment},602	} {603		document.AddHeading(section.heading, 1)604		for _, line := range strings.Split(strings.ReplaceAll(section.content, "\r\n", "\n"), "\n") {605			document.AddParagraph(line)606		}607	}608	return document.SaveTo(filename)609}610```611612```java613static void saveAsDocx(MeetingMinutes minutes, Path filename) throws IOException {614  try (var document = new XWPFDocument();615      OutputStream output = Files.newOutputStream(filename)) {616    addHeadingStyle(document);617    addSection(document, "Abstract summary", minutes.abstractSummary());618    addSection(document, "Key points", minutes.keyPoints());619    addSection(document, "Action items", minutes.actionItems());620    addSection(document, "Sentiment", minutes.sentiment());621    document.write(output);622  }623}624625private static void addHeadingStyle(XWPFDocument document) {626  var headingStyle = CTStyle.Factory.newInstance();627  headingStyle.setStyleId("Heading1");628  headingStyle.addNewName().setVal("Heading 1");629  headingStyle.setType(STStyleType.PARAGRAPH);630  headingStyle.addNewPPr().addNewOutlineLvl().setVal(BigInteger.ZERO);631  document.createStyles().addStyle(new XWPFStyle(headingStyle));632}633634private static void addSection(XWPFDocument document, String heading, String content) {635  var headingParagraph = document.createParagraph();636  headingParagraph.setStyle("Heading1");637  var headingRun = headingParagraph.createRun();638  headingRun.setBold(true);639  headingRun.setFontSize(16);640  headingRun.setText(heading);641  var contentRun = document.createParagraph().createRun();642  String[] lines = content.split("\\R", -1);643  for (int index = 0; index < lines.length; index += 1) {644    if (index > 0) contentRun.addBreak();645    contentRun.setText(lines[index]);646  }647}648```649650```ruby651def save_as_docx(minutes, filename)652  Caracal::Document.save(filename) do |document|653    minutes.each do |heading, content|654      document.h1(heading)655      content.split(/\r\n?|\n/, -1).each { |line| document.p(line) }656    end657  end658end659```660661662The helper receives the generated sections and an output filename, adds a heading and paragraph for each section, and saves the document to the current working directory.663664Finally, combine the steps to generate meeting minutes from an audio file:665666```javascript667const transcription = await transcribeAudio("meeting.wav");668const minutes = await buildMeetingMinutes(transcription);669console.log(minutes);670await saveAsDocx(minutes, "meeting_minutes.docx");671```672673```python674audio_file_path = Path("meeting.wav")675transcription = transcribe_audio(audio_file_path)676minutes = meeting_minutes(transcription)677print(minutes)678save_as_docx(minutes, Path("meeting_minutes.docx"))679```680681```go682func main() {683	ctx := context.Background()684	transcription, err := transcribeAudio(ctx, "meeting.wav")685	if err != nil {686		panic(err)687	}688	minutes, err := buildMeetingMinutes(ctx, transcription)689	if err != nil {690		panic(err)691	}692	fmt.Printf("%+v\n", minutes)693	if err := saveAsDocx(minutes, "meeting_minutes.docx"); err != nil {694		panic(err)695	}696}697```698699```java700public static void main(String[] args) throws IOException {701    String transcription = transcribeAudio(Path.of("meeting.wav"));702    MeetingMinutes minutes = buildMeetingMinutes(transcription);703    System.out.println(minutes);704    saveAsDocx(minutes, Path.of("meeting_minutes.docx"));705  }706}707```708709```ruby710transcription = transcribe_audio(client, "meeting.wav")711minutes = build_meeting_minutes(client, transcription)712puts minutes713save_as_docx(minutes, "meeting_minutes.docx")714```715716717This code resolves `meeting.wav` from the process working directory, generates and prints the meeting minutes, and saves them as `meeting_minutes.docx`.718719Now that you have a basic meeting minutes workflow, tune the prompts with [prompt engineering](https://developers.openai.com/api/docs/guides/prompt-engineering) or build an end-to-end system with [function calling](https://developers.openai.com/api/docs/guides/function-calling).
Files main
Menu

Theme