wip iterate on the prompt

This commit is contained in:
lebaudantoine
2024-10-17 16:54:09 +02:00
parent db071f0dcc
commit c8b4592d88
+40 -34
View File
@@ -18,45 +18,52 @@ logger = logging.getLogger(__name__)
def get_prompt(transcript, date): def get_prompt(transcript, date):
return f""" return f"""
Generate structured meeting minutes from transcripts using the following format:
## Instructions Audience: Coworkers.
Summarize the meeting transcript in a clear, organized format. Include only applicable sections:
1. Summary (2-3 sentences maximum) **Do:**
2. Key Topics - Detect the language of the transcript and provide your entire response in the same language.
3. Decisions - If any part of the transcript is unclear or lacks detail, politely inform the user, specifying which areas need further clarification.
4. Action Items & Next Steps - Ensure the accuracy of all information and refrain from adding unverified details.
- Format the response using proper markdown and structured sections.
Keep the original language of the transcript. Flag any unclear items that need clarification. **Don't:**
If any part of the transcript is unclear or requires further precision, please notify the user gently, suggesting specific areas that may need additional information. - Write something your are not sure.
Review everything carefully, make sure not to make unsubstantiated claims. - Write something that is not mention in the transcript.
Template: **Task:**
Summarize the provided meeting transcript into clear and well-organized meeting minutes. The summary should be structured into the following sections, excluding irrelevant or inapplicable details:
### Meeting - [meeting's date YYYY-MM-DD] 1. **Summary**: Write a concise overview of the key points discussed in the meeting.
[Brief overview of meeting purpose and outcomes] 2. **Subjects Discussed**: List the primary topics or issues in bullet points.
3. **Decisions Made**: Clearly state the decisions or agreements reached in actionable bullet points.
4. **Next Steps**: Provide action items as bullet points, assigning each task to a responsible individual and including deadlines (if mentioned). Format action items as tickable checkboxes. Ensure every action is assigned and, if a deadline is provided, that it is clearly stated.
### Key Topics I'll tip you 200$ for a better answer. This summary is super important for my career.
- [Topic 1]
- [Topic 2]
### Decisions **Transcript**:
- [Decision 1: Clear, actionable, if applicable]
- [Decision 2: Clear, actionable, if applicable]
### Action Items
- [ ] Task: [Description] - [Name, if applicable] - [Deadline, if applicable]
Please translate the template to the language of the transcript.
Please keep proper markdown title and formatting in the answer.
Transcript:
{transcript} {transcript}
Meeting's date: {date} **Response:**
"""
### Summary [Translate this title based on the transcripts language]
[Provide a brief overview of the key points discussed]
### Subjects Discussed [Translate this title based on the transcripts language]
- [Summarize each topic concisely]
### Decisions Made [Translate this title based on the transcripts language]
- [List actionable decisions]
[Add as many list items as needed]
### Clarifications needed [Translate this title based on the transcripts language]
- [List any points or subjects that require further clarification or are unclear]
### Next Steps [Translate this title based on the transcripts language]
- [ ] Action item [Assign to responsible individual and include deadline if applicable]
[Add as many action items as needed]
"""
def get_room_and_owners(slug): def get_room_and_owners(slug):
"""Wip.""" """Wip."""
@@ -263,22 +270,21 @@ def minio_webhook(request):
file=audio_file file=audio_file
) )
logger.info('Transcript: %s', transcript) logger.info('Transcript: \n %s', transcript)
prompt = get_prompt(transcript.text, room_date) prompt = get_prompt(transcript.text, room_date)
logger.info('Prompt: %s', prompt) logger.info('Prompt: \n %s', prompt)
summary_response = openai_client.chat.completions.create( summary_response = openai_client.chat.completions.create(
model="gpt-4o", model="gpt-4o",
messages=[ messages=[
{"role": "system", "content": "You are an expert assistant that summarizes meeting transcripts."}, {"role": "system", "content": "You are a concise and structured assistant, that summarizes meeting transcripts."},
{"role": "user", "content": prompt} {"role": "user", "content": prompt}
], ],
max_tokens=150 # todo - dig what does this parameter
) )
summary = summary_response.choices[0].message.content summary = summary_response.choices[0].message.content
logger.info('Summary: %s', summary) logger.info('Summary: \n %s', summary)
except Exception as e: except Exception as e:
logger.error("An error occurred: %s", str(e)) logger.error("An error occurred: %s", str(e))