欢迎来到财经新闻网

GPT-4助您轻松生成会议纪要!

编辑:佚名      来源:财经新闻网      函数   音频   会议   模型   文本

2023-09-03 22:01:18 

财经新闻网消息:xS3财经新闻网

大规模语言模型GPT-4发布已经有一段时间了,基于它开发的应用也层出不穷。 这些应用程序的强大功能在大量任务场景中帮助了许多用户。 我们在这里要分享的是一份官方文档,详细介绍了使用其语音识别模型和大语言模型 GPT-4 创建会议纪要生成器的整个过程。xS3财经新闻网

本教程将展示如何使用 GPT-4 模型开发自动会议纪要生成器。 该应用程序的功能是转录会议音频、总结讨论内容、提取要点和行动项目以及执行情绪分析。xS3财经新闻网

基本技能xS3财经新闻网

本教程假设读者对 API 密钥和 API 密钥有基本的了解。 您可以使用本教程提供的音频或您自己的音频。xS3财经新闻网

此外,您还需要安装 -docx 和库。 您可以使用以下命令创建新环境并安装所需的软件包:xS3财经新闻网

python -m venv envsource env/bin/activatepip install openaipip install python-docx
xS3财经新闻网

使用转录音频xS3财经新闻网

转录会议音频的第一步是将会议音频文件传递到 /v1/audio API。 是支持音频API的模型,它将口语转换为文本。 最初避免通过或温度参数(用于控制模型输出的可选参数),坚持默认值。xS3财经新闻网

自动生成会议纪要_会议纪要自动生成器_xS3财经新闻网

接下来,导入所需的包并定义一个读取音频文件并使用以下命令进行转录的函数xS3财经新闻网

import openaifrom docx import Documentdef transcribe_audio(audio_file_path):with open(audio_file_path, 'rb') as audio_file:transcription = openai.Audio.transcribe("whisper-1", audio_file)return transcription['text']
xS3财经新闻网

函数中,是要转录的音频文件的路径。 此函数打开文件并将其传递给 ASR 模型 (-1) 进行转录。 它以原始文本形式返回结果。 需要指出的是,.Audio。 函数需要传递一个实际的音频文件,而不仅仅是本地或远程服务器上文件的路径。 这意味着,如果您在可能未存储音频文件的服务器上运行代码,那么您可能需要先执行预处理步骤才能将音频文件下载到设备。xS3财经新闻网

使用 GPT-4 总结和分析转录本xS3财经新闻网

获得成绩单后,使用 API 将其传递给 GPT-4。 GPT-4是迄今为止推出的最好的大规模语言模型,将用于生成摘要、提取关键点和行动项以及执行情感分析。xS3财经新闻网

本教程针对我们希望 GPT-4 执行的每个不同任务使用不同的函数。 这不是完成此任务的最有效方法(您可以将这些指令放在函数中),但分离这些任务可以使摘要质量更高。xS3财经新闻网

自动生成会议纪要__会议纪要自动生成器xS3财经新闻网

要分离这些任务,请定义一个函数并将其作为应用程序的主要函数:xS3财经新闻网

def meeting_minutes(transcription):abstract_summary = abstract_summary_extraction(transcription)key_points = key_points_extraction(transcription)action_items = action_item_extraction(transcription)sentiment = sentiment_analysis(transcription)return {'abstract_summary': abstract_summary,'key_points': key_points,'action_items': action_items,'sentiment': sentiment}
xS3财经新闻网

在此函数中, 是从 获得的文本。 可以传递给其他四个函数,每个函数执行特定的任务:xS3财经新闻网

用于生成会议摘要、提取关键点、识别操作项以及执行情感分析。 如果您想添加其他功能,可以使用上面所示的相同框架。xS3财经新闻网

以下是每个函数的工作原理:xS3财经新闻网

摘要提取xS3财经新闻网

其功能是将转录的文本概括为简洁的摘要,旨在保留最重要的要点,同时避免不必要的细节或偏离主题的内容。 实现这个过程的主要机制是下面的系统消息。 通过所谓的工程设计,有许多不同的可能方法可以实现类似的结果。 如果您想知道如何最有效地做到这一点,请查看 GPT 最佳实践指南中提供的深入建议:xS3财经新闻网

def abstract_summary_extraction(transcription):response = openai.ChatCompletion.create(model="gpt-4",temperature=0,messages=[{"role": "system","content": "You are a highly skilled AI trained in language comprehension and summarization. I would like you to read the following text and summarize it into a concise abstract paragraph. Aim to retain the most important points, providing a coherent and readable summary that could help a person understand the main points of the discussion without needing to read the entire text. Please avoid unnecessary details or tangential points."},{"role": "user","content": transcription}])return response['choices'][0]['message']['content']
xS3财经新闻网

关键点提取xS3财经新闻网

n函数的作用是识别并列出会议讨论的要点。 这些要点应包括对会议讨论的实质至关重要的最重要的想法、发现或主题。 同样,控制这些点的识别的主要机制是系统消息。 在这里,您可能需要提供一些额外的信息来解释您的项目或公司的运作方式,例如:“我们是一家向消费者销售赛车的公司。我们做什么以及我们的目标是什么。” 这些附加信息可以大大提高模型提取相关信息的能力。xS3财经新闻网

def key_points_extraction(transcription):response = openai.ChatCompletion.create(model="gpt-4",temperature=0,messages=[{"role": "system","content": "You are a proficient AI with a specialty in distilling information into key points. Based on the following text, identify and list the main points that were discussed or brought up. These should be the most important ideas, findings, or topics that are crucial to the essence of the discussion. Your goal is to provide a list that someone could read to quickly understand what was talked about."},{"role": "user","content": transcription}])return response['choices'][0]['message']['content']
xS3财经新闻网

行动项提取xS3财经新闻网

on 功能的作用是识别会议期间商定或提到的任务、工作分配或行动。 具体细节可能包括分配给特定个人的任务或集体决定的行动。 虽然本教程不会详细解释,但 Chat API 提供了一个功能,可以让用户在任务管理软件中自动创建任务并将其分配给相关人员。xS3财经新闻网

def action_item_extraction(transcription):    response = openai.ChatCompletion.create(        model="gpt-4",        temperature=0,        messages=[            {                "role": "system",                "content": "You are an AI expert in analyzing conversations and extracting action items. Please review the text and identify any tasks, assignments, or actions that were agreed upon or mentioned as needing to be done. These could be tasks assigned to specific individuals, or general actions that the group has decided to take. Please list these action items clearly and concisely."            },            {                "role": "user",                "content": transcription            }        ]    )    return response['choices'][0]['message']['content']
xS3财经新闻网

情绪分析xS3财经新闻网

该功能的作用是分析会议讨论的整体情绪。 它考虑了语气、所用语言所传达的情绪以及使用单词和短语的上下文。 对于不太复杂的任务,除了 gpt-4 之外,gpt-3.5-turbo 也值得一试,看看是否可以获得类似的性能水平。 将函数的结果传递给其他函数以查看对话的情绪如何影响其他属性也可能很有用。xS3财经新闻网

def sentiment_analysis(transcription):    response = openai.ChatCompletion.create(        model="gpt-4",        temperature=0,        messages=[            {                "role": "system",                "content": "As an AI with expertise in language and emotion analysis, your task is to analyze the sentiment of the following text. Please consider the overall tone of the discussion, the emotion conveyed by the language used, and the context in which words and phrases are used. Indicate whether the sentiment is generally positive, negative, or neutral, and provide brief explanations for your analysis where possible."            },            {                "role": "user",                "content": transcription            }        ]    )    return response['choices'][0]['message']['content']
xS3财经新闻网

导出会议纪要xS3财经新闻网

会议纪要自动生成器__自动生成会议纪要xS3财经新闻网

生成会议纪要后,我们通常需要以人类可读且易于分发的格式保存它们。 此类报告的常见格式是 Word。 docx软件库是一个常用的用于创建Word文档的开源软件库。 如果您想构建端到端会议纪要应用程序,您可以考虑删除此导出步骤,而是在后续电子邮件中发送摘要。xS3财经新闻网

要实现此导出过程,您可以定义一个将原始文本转换为 Word 文档的函数。xS3财经新闻网

def save_as_docx(minutes, filename):    doc = Document()    for key, value in minutes.items():        # Replace underscores with spaces and capitalize each word for the heading        heading = ' '.join(word.capitalize() for word in key.split('_'))        doc.add_heading(heading, level=1)        doc.add_paragraph(value)        # Add a line break between sections        doc.add_paragraph()    doc.save(filename)
xS3财经新闻网

在这个函数中,是一个字典,包含会议的摘要、要点、行动项目和情绪分析。 是要创建的 Word 文档文件的名称。 此函数创建一个新的Word文档,为笔记的每个部分添加标题和内容,然后将文档保存到当前工作目录。xS3财经新闻网

最后,您可以将所有内容放在一起并从音频文件生成会议纪要:xS3财经新闻网

audio_file_path = "Earningscall.wav"transcription = transcribe_audio(audio_file_path)minutes = meeting_minutes(transcription)print(minutes)save_as_docx(minutes, 'meeting_minutes.docx')
xS3财经新闻网

该代码将首先转录音频文件.wav,然后生成并输出会议纪要,然后将会议纪要保存为Word文档并命名为.docx。xS3财经新闻网

这是基本的会议纪要处理步骤,请尝试通过工程设计优化其性能或通过原生函数调用构建端到端系统。xS3财经新闻网

参考链接:xS3财经新闻网

免责声明 ① 本网所刊登文章均来自网络转载;文章观点不代表本网立场,其真实性由作者或稿源方负责 ② 如果您对稿件和图片等有版权及其他争议,请及时与我们联系,我们将核实情况后进行相关删除 ③ 联系邮箱:215858170@qq.comxS3财经新闻网

发表我的评论 共有条评论
    名字:
全部评论
'); })(); /* 360自动推送代码 */