noumanjavaid commited on
Commit
2f4c18b
Β·
verified Β·
1 Parent(s): bf21cca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -47
app.py CHANGED
@@ -76,7 +76,8 @@ def initialize_groq_client(api_key: str) -> Optional[Groq]:
76
  elif "403" in error_msg:
77
  st.error("❌ API key doesn't have permission to access Groq API")
78
  else:
79
- st.error(f"❌ Failed to initialize Groq client: {error_msg}")
 
80
  return None
81
 
82
  # Define custom exception for Groq API errors
@@ -315,78 +316,79 @@ def process_transcript(transcript):
315
  # Enhanced structure for better organization
316
  structure = {
317
  "Executive Summary": "",
 
 
318
  "Key Insights": "",
319
- "Action Items": "",
320
  "Questions & Considerations": "",
321
  "Detailed Analysis": {
322
  "Context & Background": "",
323
- "Main Discussion Points": "",
324
  "Supporting Evidence": "",
325
- "Conclusions & Recommendations": ""
326
- }
327
  }
328
 
329
  prompt = f"""
330
- You are an expert note organizer with exceptional skills in creating structured, clear, and comprehensive notes.
331
- Please analyze the following transcript and transform it into highly organized notes:
332
 
333
  ```
334
-
335
  {transcript}
336
-
337
-
338
-
339
  ```
340
- Create a well-structured document with the following sections:
341
 
342
- # Executive Summary
343
- - Provide a concise 3-5 sentence overview of the main topic and key takeaways
344
- - Use clear, direct language
345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  # Key Insights
347
  - Extract 5-7 critical insights as bullet points
348
- - Each insight should be bolded and followed by 1-2 supporting sentences
349
  - Organize these insights in order of importance
350
-
351
- # Action Items
352
- - Create a table with these columns: Action | Owner/Responsible Party | Timeline | Priority
353
- - List all tasks, assignments, or follow-up items mentioned
354
- - If information is not explicitly stated, indicate with "Not specified"
355
-
356
  # Questions & Considerations
357
  - List all questions raised during the discussion
358
  - Include concerns or areas needing further exploration
359
  - For each question, provide brief context explaining why it matters
360
-
361
  # Detailed Analysis
362
 
363
  ## Context & Background
364
- - Summarize relevant background information
365
- - Explain the context in which the discussion took place
366
- - Include references to prior work or decisions if mentioned
367
-
368
- ## Main Discussion Points
369
- - Create subsections for each major topic discussed
370
- - Use appropriate formatting (bullet points, numbered lists) to organize information
371
- - Include direct quotes when particularly significant, marked with ">"
372
 
373
  ## Supporting Evidence
374
  - Create a table summarizing any data, evidence, or examples mentioned
375
  - Include source information when available
 
376
 
377
- ## Conclusions & Recommendations
378
- - Summarize the conclusions reached
379
- - List any recommendations or next steps discussed
380
- - Note any decisions that were made
 
 
381
 
382
  Make extensive use of markdown formatting:
383
  - Use tables for structured information
384
- - Use bold for emphasis on important points
385
  - Use bullet points and numbered lists for clarity
386
  - Use headings and subheadings to organize content
387
- - Include blockquotes for direct citations
388
 
389
- Your notes should be comprehensive but concise, focusing on extracting the maximum value from the transcript.
390
  """
391
 
392
  try:
@@ -396,7 +398,7 @@ def process_transcript(transcript):
396
  response = st.session_state.groq_client.chat.completions.create(
397
  messages=[{"role": "user", "content": prompt}],
398
  model=LLM_MODEL,
399
- temperature=0.3, # Lower temperature for more structured output
400
  max_tokens=4096,
401
  top_p=0.95,
402
  stream=True
@@ -413,22 +415,22 @@ def process_transcript(transcript):
413
  section_markers = {
414
  "# Executive Summary": "Executive Summary",
415
  "## Executive Summary": "Executive Summary",
 
 
 
 
416
  "# Key Insights": "Key Insights",
417
  "## Key Insights": "Key Insights",
418
- "# Action Items": "Action Items",
419
- "## Action Items": "Action Items",
420
  "# Questions & Considerations": "Questions & Considerations",
421
  "## Questions & Considerations": "Questions & Considerations",
422
  "# Detailed Analysis": "Detailed Analysis",
423
  "## Detailed Analysis": "Detailed Analysis",
424
  "## Context & Background": "Context & Background",
425
  "### Context & Background": "Context & Background",
426
- "## Main Discussion Points": "Main Discussion Points",
427
- "### Main Discussion Points": "Main Discussion Points",
428
  "## Supporting Evidence": "Supporting Evidence",
429
  "### Supporting Evidence": "Supporting Evidence",
430
- "## Conclusions & Recommendations": "Conclusions & Recommendations",
431
- "### Conclusions & Recommendations": "Conclusions & Recommendations"
432
  }
433
 
434
  for chunk in response:
@@ -439,8 +441,7 @@ def process_transcript(transcript):
439
  # Check for section markers in the accumulated content
440
  for marker, section in section_markers.items():
441
  if marker in notes_content:
442
- if section in ["Context & Background", "Main Discussion Points",
443
- "Supporting Evidence", "Conclusions & Recommendations"]:
444
  current_section = "Detailed Analysis"
445
  current_subsection = section
446
  else:
@@ -467,6 +468,7 @@ def process_transcript(transcript):
467
  st.error(f"Error processing transcript: {e}")
468
  return None
469
 
 
470
  def export_notes(notes, format="markdown"):
471
  """Export notes in the specified format"""
472
  if format == "markdown":
 
76
  elif "403" in error_msg:
77
  st.error("❌ API key doesn't have permission to access Groq API")
78
  else:
79
+ st.error(f"❌ Failed to initialize Groq client: {error_msg
80
+ }")
81
  return None
82
 
83
  # Define custom exception for Groq API errors
 
316
  # Enhanced structure for better organization
317
  structure = {
318
  "Executive Summary": "",
319
+ "Main Agenda": "",
320
+ "Points Discussed": "",
321
  "Key Insights": "",
 
322
  "Questions & Considerations": "",
323
  "Detailed Analysis": {
324
  "Context & Background": "",
 
325
  "Supporting Evidence": "",
326
+ },
327
+ "Next Steps": ""
328
  }
329
 
330
  prompt = f"""
331
+ You are an expert meeting notes organizer with exceptional skills in creating structured, clear, and comprehensive notes.
332
+ Please analyze the following transcript and transform it into highly organized meeting notes:
333
 
334
  ```
 
335
  {transcript}
 
 
 
336
  ```
 
337
 
338
+ Create a professional meeting notes document with the following specific sections:
 
 
339
 
340
+ # Executive Summary
341
+ - Provide a concise 3-5 sentence overview of the meeting purpose and key outcomes
342
+ - Use clear, direct language focused on the most important takeaways
343
+
344
+ # Main Agenda
345
+ - Extract and list the primary agenda items that were discussed in the meeting
346
+ - Format as a numbered or bulleted list
347
+ - Include time allocations or priority levels if mentioned in the transcript
348
+
349
+ # Points Discussed
350
+ - Provide a comprehensive breakdown of what was discussed for each agenda item
351
+ - Use subheadings for each major topic
352
+ - Include who raised specific points when identifiable
353
+ - Organize chronologically as they appeared in the discussion
354
+
355
  # Key Insights
356
  - Extract 5-7 critical insights as bullet points
357
+ - Each insight should be **bolded** and followed by 1-2 supporting sentences
358
  - Organize these insights in order of importance
359
+
 
 
 
 
 
360
  # Questions & Considerations
361
  - List all questions raised during the discussion
362
  - Include concerns or areas needing further exploration
363
  - For each question, provide brief context explaining why it matters
364
+
365
  # Detailed Analysis
366
 
367
  ## Context & Background
368
+ - Summarize relevant background information necessary to understand the discussion
369
+ - Explain the context in which the meeting took place
370
+ - Include references to prior meetings or decisions if mentioned
 
 
 
 
 
371
 
372
  ## Supporting Evidence
373
  - Create a table summarizing any data, evidence, or examples mentioned
374
  - Include source information when available
375
+ - Format data clearly using markdown tables when appropriate
376
 
377
+ # Next Steps
378
+ - Create a table with these columns: Action | Owner/Responsible Party | Timeline | Priority
379
+ - List all tasks, assignments, follow-up items, and decisions made
380
+ - If information is not explicitly stated, indicate with "Not specified"
381
+ - Include any deadlines or important dates mentioned
382
+ - This section should be comprehensive, capturing ALL action items from the meeting
383
 
384
  Make extensive use of markdown formatting:
385
  - Use tables for structured information
386
+ - Use **bold** for emphasis on important points
387
  - Use bullet points and numbered lists for clarity
388
  - Use headings and subheadings to organize content
389
+ - Include blockquotes for direct citations with > symbol
390
 
391
+ Your notes should be professional, comprehensive yet concise, focusing on extracting the maximum value from the transcript.
392
  """
393
 
394
  try:
 
398
  response = st.session_state.groq_client.chat.completions.create(
399
  messages=[{"role": "user", "content": prompt}],
400
  model=LLM_MODEL,
401
+ temperature=0.2, # Slightly lower temperature for more consistent structure
402
  max_tokens=4096,
403
  top_p=0.95,
404
  stream=True
 
415
  section_markers = {
416
  "# Executive Summary": "Executive Summary",
417
  "## Executive Summary": "Executive Summary",
418
+ "# Main Agenda": "Main Agenda",
419
+ "## Main Agenda": "Main Agenda",
420
+ "# Points Discussed": "Points Discussed",
421
+ "## Points Discussed": "Points Discussed",
422
  "# Key Insights": "Key Insights",
423
  "## Key Insights": "Key Insights",
 
 
424
  "# Questions & Considerations": "Questions & Considerations",
425
  "## Questions & Considerations": "Questions & Considerations",
426
  "# Detailed Analysis": "Detailed Analysis",
427
  "## Detailed Analysis": "Detailed Analysis",
428
  "## Context & Background": "Context & Background",
429
  "### Context & Background": "Context & Background",
 
 
430
  "## Supporting Evidence": "Supporting Evidence",
431
  "### Supporting Evidence": "Supporting Evidence",
432
+ "# Next Steps": "Next Steps",
433
+ "## Next Steps": "Next Steps"
434
  }
435
 
436
  for chunk in response:
 
441
  # Check for section markers in the accumulated content
442
  for marker, section in section_markers.items():
443
  if marker in notes_content:
444
+ if section in ["Context & Background", "Supporting Evidence"]:
 
445
  current_section = "Detailed Analysis"
446
  current_subsection = section
447
  else:
 
468
  st.error(f"Error processing transcript: {e}")
469
  return None
470
 
471
+
472
  def export_notes(notes, format="markdown"):
473
  """Export notes in the specified format"""
474
  if format == "markdown":