Last active
April 17, 2025 20:11
-
-
Save manisnesan/5f03b65fd8f6ac1e20111e4b876648d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["####%pip install google-genai"]}, {"cell_type": "code", "metadata": {}, "source": ["from google import genai\n", "import os\n", "\n", "assert os.environ.get('GEMINI_API_KEY')\n", "client = genai.Client(api_key=os.environ.get('GEMINI_API_KEY'))\n", "\n", "response = client.models.generate_content(model=\"gemini-2.0-flash\", contents=\"Explain how AI works in a few words\")\n", "print(response.text)"], "outputs": [{"name": "stdout", "output_type": "stream", "text": ["AI learns patterns from data to make predictions or decisions.\n", "\n"]}], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["MODEL_ID = \"gemini-2.0-flash\"\n", "from google.genai import types\n", "from IPython.display import Markdown\n", "from pydantic import BaseModel\n", "\n", "class Recipe(BaseModel):\n", " recipe_name: str\n", " recipe_description: str\n", " recipe_ingredients: list[str]\n", "\n", "response = client.models.generate_content(\n", " model=MODEL_ID,\n", " contents=\"Provide a popular cookie recipe and its ingredients.\",\n", " config=types.GenerateContentConfig(\n", " response_mime_type=\"application/json\",\n", " response_schema=Recipe,\n", " ),\n", ")\n", "\n", "Markdown(response.text)"], "outputs": [{"name": "stderr", "output_type": "stream", "text": ["/usr/local/lib/python3.11/site-packages/jedi/inference/compiled/subprocess/functions.py:21: UserWarning: Module _tkinter not importable in path ['/app/data', '/app/solveit', '/usr/local/lib/python311.zip', '/usr/local/lib/python3.11', '/usr/local/lib/python3.11/lib-dynload', '/app/data/.local/lib/python3.11/site-packages', '/usr/local/lib/python3.11/site-packages'].\n", " return access.load_module(inference_state, **kwargs)\n"]}, {"data": {"text/plain": ["<IPython.core.display.Markdown object>"], "text/markdown": ["{\n", " \"recipe_name\": \"Chocolate Chip Cookies\",\n", " \"recipe_description\": \"Classic and delicious chocolate chip cookies, perfect for any occasion.\",\n", " \"recipe_ingredients\": [\n", " \"1 cup (2 sticks) unsalted butter, softened\",\n", " \"3/4 cup granulated sugar\",\n", " \"3/4 cup packed brown sugar\",\n", " \"2 large eggs\",\n", " \"1 teaspoon vanilla extract\",\n", " \"2 1/4 cups all-purpose flour\",\n", " \"1 teaspoon baking soda\",\n", " \"1 teaspoon salt\",\n", " \"2 cups chocolate chips\"\n", " ]\n", "}"]}, "metadata": {}, "output_type": "execute_result", "execution_count": null}], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["# Example meeting transcript\n", "example_transcript = \"\"\"\n", "Meeting Title: Q4 Product Roadmap Discussion\n", "Date: November 15, 2023\n", "Attendees: Sarah (Product Manager), Michael (Engineering Lead), Priya (UX Designer), Carlos (Marketing), Jennifer (Customer Success)\n", "\n", "Sarah: Good morning everyone. Today we need to finalize our Q4 roadmap and prioritize features for the next release.\n", "\n", "Michael: Before we dive in, I want to highlight that we're facing some technical debt issues that might slow down new feature development.\n", "\n", "Sarah: Thanks for bringing that up. How much time do you think we need to allocate to address those issues?\n", "\n", "Michael: I'd say about 30% of our sprint capacity for the next two sprints.\n", "\n", "Priya: From the UX perspective, we've completed user testing on the new dashboard design. Users loved the cleaner interface but struggled with finding the export functionality.\n", "\n", "Carlos: Marketing needs the new social sharing features by December 10th for our holiday campaign. Is that still feasible?\n", "\n", "Michael: If we prioritize it, yes, but we might need to push back the advanced reporting features.\n", "\n", "Jennifer: Customer Success team is getting a lot of requests for better notification controls. That should be high priority based on customer feedback.\n", "\n", "Sarah: Okay, so it sounds like we have four main items: technical debt, dashboard UX improvements, social sharing, and notification controls.\n", "\n", "Michael: That's correct. I suggest we tackle technical debt and notification controls in the first sprint of Q4, then move to dashboard improvements and social sharing in the second sprint.\n", "\n", "Priya: That works for me. I can have the final designs for notifications ready by next week.\n", "\n", "Carlos: As long as we have social sharing ready by December 10th, marketing is happy.\n", "\n", "Jennifer: Perfect. I'll communicate the notification improvements to our key accounts.\n", "\n", "Sarah: Great! Let's also schedule a mid-quarter review on November 30th to check our progress. I'll send out the detailed roadmap by end of day tomorrow.\n", "\n", "Michael: Sounds good. Any other concerns we should address today?\n", "\n", "Priya: Not from the UX team.\n", "\n", "Sarah: Alright then, thanks everyone for your input. Let's get to work on making Q4 our best quarter yet!\n", "\"\"\""], "outputs": [], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["# Define a function to summarize meeting transcripts\n", "def summarize_meeting(transcript):\n", " prompt = f\"\"\"\n", " Please summarize the following meeting transcript, highlighting:\n", " 1. Key discussion points\n", " 2. Decisions made\n", " 3. Action items and owners\n", " 4. Important deadlines mentioned\n", " \n", " Please format the summary in a clear, structured way.\n", " \n", " Transcript:\n", " {transcript}\n", " \"\"\"\n", " \n", " response = client.models.generate_content(\n", " model=\"gemini-2.0-flash\",\n", " contents=prompt,\n", " )\n", " \n", " return response.text\n", "\n", "# Get the summary\n", "meeting_summary = summarize_meeting(example_transcript)\n", "print(meeting_summary)"], "outputs": [{"name": "stdout", "output_type": "stream", "text": ["## Q4 Product Roadmap Discussion Summary\n", "\n", "**Date:** November 15, 2023\n", "\n", "**1. Key Discussion Points:**\n", "\n", "* **Technical Debt:** Engineering is facing technical debt issues that will impact feature development velocity.\n", "* **Dashboard UX:** User testing revealed a positive reaction to the new dashboard design but identified usability issues with the export functionality.\n", "* **Social Sharing:** Marketing needs social sharing features live by December 10th for the holiday campaign.\n", "* **Notification Controls:** Customer Success reports high demand for improved notification controls based on customer feedback.\n", "* **Feature Prioritization:** Balancing technical debt, UX improvements, marketing needs, and customer feedback to determine the Q4 feature roadmap.\n", "\n", "**2. Decisions Made:**\n", "\n", "* **Sprint Allocation:** Engineering will dedicate approximately 30% of their sprint capacity for the next two sprints to address technical debt.\n", "* **Feature Prioritization (Tentative):**\n", " * **Sprint 1:** Focus on Technical Debt and Notification Controls.\n", " * **Sprint 2:** Focus on Dashboard UX Improvements and Social Sharing.\n", "* **Mid-Quarter Review:** A mid-quarter review meeting will be held on November 30th to assess progress.\n", "\n", "**3. Action Items and Owners:**\n", "\n", "| Action Item | Owner |\n", "| ------------------------------------------ | ------------ |\n", "| Finalize designs for notification controls | Priya |\n", "| Communicate notification improvements to key accounts | Jennifer |\n", "| Send out detailed Q4 Roadmap | Sarah |\n", "| Prepare for Q4 Execution of roadmap tasks based on sprint priorities | Michael |\n", "\n", "**4. Important Deadlines Mentioned:**\n", "\n", "* **End of Day Tomorrow (November 16, 2023):** Sarah to send out detailed Q4 roadmap.\n", "* **Next Week (Implied November 22, 2023):** Priya to have final designs for notification controls ready.\n", "* **November 30, 2023:** Mid-Quarter Review meeting.\n", "* **December 10, 2023:** Social sharing features must be live for marketing campaign.\n", "\n"]}], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["from pydantic import BaseModel\n", "from typing import List\n", "from google.genai import types\n", "\n", "class ActionItem(BaseModel):\n", " description: str\n", " owner: str\n", " deadline: Optional[str] = None\n", "\n", "class MeetingSummary(BaseModel):\n", " key_points: List[str]\n", " decisions: List[str]\n", " action_items: List[ActionItem]\n", " next_meeting: Optional[str] = None"], "outputs": [], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["def get_structured_summary(transcript):\n", " prompt = f\"\"\"\n", " Analyze the following meeting transcript and extract:\n", " \n", " 1. Key discussion points\n", " 2. Decisions made during the meeting\n", " 3. Action items with their owners and deadlines (if mentioned)\n", " 4. The next scheduled meeting date/time (if mentioned)\n", " \n", " Format your response as a JSON object matching this structure:\n", " {{\n", " \"key_points\": [\"point 1\", \"point 2\", ...],\n", " \"decisions\": [\"decision 1\", \"decision 2\", ...],\n", " \"action_items\": [\n", " {{\"description\": \"task description\", \"owner\": \"person name\", \"deadline\": \"date or 'Not specified'\"}}\n", " ],\n", " \"next_meeting\": \"date/time or 'Not specified'\"\n", " }}\n", " \n", " Transcript:\n", " {transcript}\n", " \"\"\"\n", " \n", " try:\n", " response = client.models.generate_content(\n", " model=\"gemini-2.0-flash\",\n", " contents=prompt,\n", " config=types.GenerateContentConfig(\n", " response_mime_type=\"application/json\",\n", " response_schema=MeetingSummary,\n", " temperature=0.1,\n", " ),\n", " )\n", " \n", " # Parse the response into our Pydantic model\n", " import json\n", " summary_dict = json.loads(response.text)\n", " return MeetingSummary(**summary_dict)\n", " except Exception as e:\n", " print(f\"Error generating structured summary: {e}\")\n", " return None"], "outputs": [], "execution_count": null}, {"cell_type": "code", "metadata": {}, "source": ["# Get structured summary\n", "structured_summary = get_structured_summary(example_transcript)\n", "\n", "if structured_summary:\n", " print(f\"Key Points:\")\n", " for i, point in enumerate(structured_summary.key_points, 1):\n", " print(f\"{i}. {point}\")\n", " \n", " print(f\"\\nDecisions:\")\n", " for i, decision in enumerate(structured_summary.decisions, 1):\n", " print(f\"{i}. {decision}\")\n", " \n", " print(f\"\\nAction Items:\")\n", " for i, item in enumerate(structured_summary.action_items, 1):\n", " print(f\"{i}. {item.description}\")\n", " print(f\" Owner: {item.owner}\")\n", " print(f\" Deadline: {item.deadline}\")\n", " \n", " print(f\"\\nNext Meeting: {structured_summary.next_meeting}\")"], "outputs": [{"name": "stdout", "output_type": "stream", "text": ["Key Points:\n", "1. Technical debt issues need to be addressed.\n", "2. User testing on the new dashboard design revealed issues with export functionality.\n", "3. Marketing needs social sharing features by December 10th.\n", "4. Customer Success is receiving requests for better notification controls.\n", "5. Prioritization of technical debt, dashboard UX improvements, social sharing, and notification controls.\n", "\n", "Decisions:\n", "1. Tackle technical debt and notification controls in the first sprint of Q4.\n", "2. Move to dashboard improvements and social sharing in the second sprint.\n", "3. Sarah will send out the detailed roadmap by end of day tomorrow.\n", "\n", "Action Items:\n", "1. Final designs for notifications\n", " Owner: Priya\n", " Deadline: next week\n", "2. Send out detailed roadmap\n", " Owner: Sarah\n", " Deadline: tomorrow\n", "3. Communicate the notification improvements to key accounts\n", " Owner: Jennifer\n", " Deadline: Not specified\n", "\n", "Next Meeting: November 30th\n"]}], "execution_count": null}], "metadata": {"kernelspec": {"display_name": "python3", "language": "python", "name": "python3"}}, "nbformat": 4, "nbformat_minor": 4} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment