Reach out
← Back to Cookbook

TranscriptToLinearTicketAgent

Details

File: mistral/agents/non_framework/transcript_linearticket_agent/TranscriptToLinearTicketAgent.ipynb

Type: Jupyter Notebook

Use Cases: Agents

Content

Notebook content (JSON format):

{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "HMUSJ0vRH_XL",
        "vscode": {
          "languageId": "plaintext"
        }
      },
      "source": [
        "# Call Transcript-to-PRD-to-Ticket Agent: Converting Meeting Transcripts to Linear Tickets using Mistral AI LLMs\n",
        "\n",
        "<a href=\"https://colab.research.google.com/github/mistralai/cookbook/blob/main/mistral/agents/non_framework/transcript_linearticket_agent/TranscriptToLinearTicketAgent.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n",
        "\n",
        "## Problem Statement\n",
        "In modern software development, a significant challenge is efficiently converting customer calls and meetings into actionable development tickets. This process typically involves:\n",
        "- Manual note-taking during calls\n",
        "- Converting notes into Product Requirements Documents (PRDs)\n",
        "- Breaking down PRDs into actionable tickets\n",
        "- Creating and managing tickets in project management tools (ex:- Linear)\n",
        "\n",
        "This manual process is:\n",
        "- Time-consuming\n",
        "- Prone to information loss\n",
        "- Subject to inconsistencies\n",
        "- Difficult to scale\n",
        "\n",
        "## Our Solution\n",
        "We've created an automated pipeline that leverages Mistral's LLM and OCR models to streamline this process:\n",
        "\n",
        "### Stage 1: PRD Generation\n",
        "- Takes raw call transcripts as input (parsed using Mistral OCR)\n",
        "- Uses Mistral AI LLM to generate structured PRD\n",
        "- Implements iterative refinement for accuracy\n",
        "- Ensures alignment with original discussion (from transcript)\n",
        "\n",
        "### Stage 2: Feature & Technical requirements Extraction\n",
        "- Analyzes PRD to identify distinct features\n",
        "- Extracts technical requirements\n",
        "- Captures constraints and success metrics\n",
        "- Maintains traceability to original content(call/ transcript)\n",
        "\n",
        "## Mistral LLM Integration\n",
        "\n",
        "The solution uses several Mistral AI LLM capabilities:\n",
        "\n",
        "1. **Chat Completion API**\n",
        "   - Used for PRD generation\n",
        "   - Handles iterative refinement\n",
        "   - Processes feedback and improvements\n",
        "\n",
        "2. **Structured Output**\n",
        "   - Formats PRD content\n",
        "   - Extracts feature lists\n",
        "   - Generates ticket descriptions\n",
        "\n",
        "3. **Context Management**\n",
        "   - Maintains consistency across iterations\n",
        "   - Preserves original transcript context\n",
        "   - Ensures accurate information flow\n",
        "\n",
        "This notebook walks through the implementation of this pipeline, demonstrating how to automate the journey from call transcripts to PRD creation to actionable development tickets on Linear."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "fbtDH_D7H_XN"
      },
      "source": [
        "![Solution Architecture](https://github.com/mistralai/cookbook/blob/main/mistral/agents/transcript_linearticket_agent/solution_architecture.png?raw=1)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "s_JiuIm_H_XN"
      },
      "source": [
        "### Installation"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "k7YoFWHlH_XN",
        "outputId": "cc42a5a5-9321-4f76-9e87-037aeadd5314"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Collecting mistralai==1.5.1\n",
            "  Downloading mistralai-1.5.1-py3-none-any.whl.metadata (29 kB)\n",
            "Collecting eval-type-backport>=0.2.0 (from mistralai==1.5.1)\n",
            "  Downloading eval_type_backport-0.2.2-py3-none-any.whl.metadata (2.2 kB)\n",
            "Requirement already satisfied: httpx>=0.27.0 in /usr/local/lib/python3.11/dist-packages (from mistralai==1.5.1) (0.28.1)\n",
            "Collecting jsonpath-python>=1.0.6 (from mistralai==1.5.1)\n",
            "  Downloading jsonpath_python-1.0.6-py3-none-any.whl.metadata (12 kB)\n",
            "Requirement already satisfied: pydantic>=2.9.0 in /usr/local/lib/python3.11/dist-packages (from mistralai==1.5.1) (2.10.6)\n",
            "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.11/dist-packages (from mistralai==1.5.1) (2.8.2)\n",
            "Collecting typing-inspect>=0.9.0 (from mistralai==1.5.1)\n",
            "  Downloading typing_inspect-0.9.0-py3-none-any.whl.metadata (1.5 kB)\n",
            "Requirement already satisfied: anyio in /usr/local/lib/python3.11/dist-packages (from httpx>=0.27.0->mistralai==1.5.1) (3.7.1)\n",
            "Requirement already satisfied: certifi in /usr/local/lib/python3.11/dist-packages (from httpx>=0.27.0->mistralai==1.5.1) (2025.1.31)\n",
            "Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.11/dist-packages (from httpx>=0.27.0->mistralai==1.5.1) (1.0.7)\n",
            "Requirement already satisfied: idna in /usr/local/lib/python3.11/dist-packages (from httpx>=0.27.0->mistralai==1.5.1) (3.10)\n",
            "Requirement already satisfied: h11<0.15,>=0.13 in /usr/local/lib/python3.11/dist-packages (from httpcore==1.*->httpx>=0.27.0->mistralai==1.5.1) (0.14.0)\n",
            "Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic>=2.9.0->mistralai==1.5.1) (0.7.0)\n",
            "Requirement already satisfied: pydantic-core==2.27.2 in /usr/local/lib/python3.11/dist-packages (from pydantic>=2.9.0->mistralai==1.5.1) (2.27.2)\n",
            "Requirement already satisfied: typing-extensions>=4.12.2 in /usr/local/lib/python3.11/dist-packages (from pydantic>=2.9.0->mistralai==1.5.1) (4.12.2)\n",
            "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.8.2->mistralai==1.5.1) (1.17.0)\n",
            "Collecting mypy-extensions>=0.3.0 (from typing-inspect>=0.9.0->mistralai==1.5.1)\n",
            "  Downloading mypy_extensions-1.0.0-py3-none-any.whl.metadata (1.1 kB)\n",
            "Requirement already satisfied: sniffio>=1.1 in /usr/local/lib/python3.11/dist-packages (from anyio->httpx>=0.27.0->mistralai==1.5.1) (1.3.1)\n",
            "Downloading mistralai-1.5.1-py3-none-any.whl (278 kB)\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m278.3/278.3 kB\u001b[0m \u001b[31m7.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25hDownloading eval_type_backport-0.2.2-py3-none-any.whl (5.8 kB)\n",
            "Downloading jsonpath_python-1.0.6-py3-none-any.whl (7.6 kB)\n",
            "Downloading typing_inspect-0.9.0-py3-none-any.whl (8.8 kB)\n",
            "Downloading mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)\n",
            "Installing collected packages: mypy-extensions, jsonpath-python, eval-type-backport, typing-inspect, mistralai\n",
            "Successfully installed eval-type-backport-0.2.2 jsonpath-python-1.0.6 mistralai-1.5.1 mypy-extensions-1.0.0 typing-inspect-0.9.0\n",
            "Collecting gql==3.5.0\n",
            "  Downloading gql-3.5.0-py2.py3-none-any.whl.metadata (9.2 kB)\n",
            "Collecting graphql-core<3.3,>=3.2 (from gql==3.5.0)\n",
            "  Downloading graphql_core-3.2.6-py3-none-any.whl.metadata (11 kB)\n",
            "Requirement already satisfied: yarl<2.0,>=1.6 in /usr/local/lib/python3.11/dist-packages (from gql==3.5.0) (1.18.3)\n",
            "Collecting backoff<3.0,>=1.11.1 (from gql==3.5.0)\n",
            "  Downloading backoff-2.2.1-py3-none-any.whl.metadata (14 kB)\n",
            "Requirement already satisfied: anyio<5,>=3.0 in /usr/local/lib/python3.11/dist-packages (from gql==3.5.0) (3.7.1)\n",
            "Requirement already satisfied: idna>=2.8 in /usr/local/lib/python3.11/dist-packages (from anyio<5,>=3.0->gql==3.5.0) (3.10)\n",
            "Requirement already satisfied: sniffio>=1.1 in /usr/local/lib/python3.11/dist-packages (from anyio<5,>=3.0->gql==3.5.0) (1.3.1)\n",
            "Requirement already satisfied: multidict>=4.0 in /usr/local/lib/python3.11/dist-packages (from yarl<2.0,>=1.6->gql==3.5.0) (6.1.0)\n",
            "Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.11/dist-packages (from yarl<2.0,>=1.6->gql==3.5.0) (0.3.0)\n",
            "Downloading gql-3.5.0-py2.py3-none-any.whl (74 kB)\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m74.0/74.0 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25hDownloading backoff-2.2.1-py3-none-any.whl (15 kB)\n",
            "Downloading graphql_core-3.2.6-py3-none-any.whl (203 kB)\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m203.4/203.4 kB\u001b[0m \u001b[31m3.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25hInstalling collected packages: graphql-core, backoff, gql\n",
            "Successfully installed backoff-2.2.1 gql-3.5.0 graphql-core-3.2.6\n",
            "Requirement already satisfied: pydantic==2.10.6 in /usr/local/lib/python3.11/dist-packages (2.10.6)\n",
            "Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic==2.10.6) (0.7.0)\n",
            "Requirement already satisfied: pydantic-core==2.27.2 in /usr/local/lib/python3.11/dist-packages (from pydantic==2.10.6) (2.27.2)\n",
            "Requirement already satisfied: typing-extensions>=4.12.2 in /usr/local/lib/python3.11/dist-packages (from pydantic==2.10.6) (4.12.2)\n",
            "Collecting pypdf==5.3.0\n",
            "  Downloading pypdf-5.3.0-py3-none-any.whl.metadata (7.2 kB)\n",
            "Downloading pypdf-5.3.0-py3-none-any.whl (300 kB)\n",
            "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m300.7/300.7 kB\u001b[0m \u001b[31m4.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25hInstalling collected packages: pypdf\n",
            "Successfully installed pypdf-5.3.0\n"
          ]
        }
      ],
      "source": [
        "!pip install mistralai==1.5.1 # MistralAI\n",
        "!pip install gql==3.5.0 # GraphQL\n",
        "!pip install pydantic==2.10.6 # Data validation\n",
        "!pip install pypdf==5.3.0  # PDF processing"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "1jGe6-ubH_XO"
      },
      "source": [
        "### Imports"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "id": "lUVNhp-OH_XO"
      },
      "outputs": [],
      "source": [
        "from mistralai import Mistral\n",
        "from gql import gql, Client\n",
        "from gql.transport.requests import RequestsHTTPTransport\n",
        "from pydantic import BaseModel\n",
        "from typing import List, Dict, Optional, Any\n",
        "from dataclasses import dataclass\n",
        "from pypdf import PdfReader\n",
        "import json"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "AYiQD4MjH_XP"
      },
      "source": [
        "### Download Call Transcript\n",
        "\n",
        "For this demonstration we will use a product call regarding LeChat.\n",
        "\n",
        "*Note*: The trascript is synthetically generated just for the demonstration purposes."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "gLB0IeLJ32mh",
        "outputId": "7e400e1f-a3e1-4fd3-a1f7-3f05f625756b"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "--2025-03-10 07:30:27--  https://raw.githubusercontent.com/mistralai/cookbook/main/mistral/agents/transcript_linearticket_agent/lechat_product_call_trascript.pdf\n",
            "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...\n",
            "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 33611 (33K) [application/octet-stream]\n",
            "Saving to: ‘./lechat_product_call_trascript.pdf’\n",
            "\n",
            "./lechat_product_ca 100%[===================>]  32.82K  --.-KB/s    in 0.04s   \n",
            "\n",
            "2025-03-10 07:30:28 (802 KB/s) - ‘./lechat_product_call_trascript.pdf’ saved [33611/33611]\n",
            "\n"
          ]
        }
      ],
      "source": [
        "!wget 'https://raw.githubusercontent.com/mistralai/cookbook/main/mistral/agents/non_framework/transcript_linearticket_agent/lechat_product_call_trascript.pdf' -O './lechat_product_call_trascript.pdf'"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "p2-ebm3XH_XP"
      },
      "source": [
        "### Configuration and Setup\n",
        "\n",
        "Our pipeline integrates Mistral AI LLM for PRD generation and Linear for ticket management. Let's set up the required configurations:\n",
        "\n",
        "## API Setup\n",
        "1. **Linear Configuration**\n",
        "   - Get API key from Linear (Settings → API)\n",
        "   - Get your Team ID\n",
        "   - GraphQL endpoint: https://api.linear.app/graphql\n",
        "\n",
        "2. **Mistral AI Configuration**\n",
        "   - Get API key from Mistral AI\n",
        "   - We use \"mistral-large-latest\" model"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "id": "YiV-lG0mH_XP"
      },
      "outputs": [],
      "source": [
        "@dataclass\n",
        "class Config:\n",
        "    \"\"\"Configuration settings for the application.\"\"\"\n",
        "    LINEAR_API_KEY: str # OAuth token for Linear API authentication\n",
        "    LINEAR_TEAM_ID: str # Unique identifier for your Linear team/project\n",
        "    LINEAR_GRAPHQL_URL: str # Linear's GraphQL API endpoint (usually \"https://api.linear.app/graphql\")\n",
        "    MISTRAL_API_KEY: str # API Key for accessing Mistral LLMs\n",
        "    MISTRAL_MODEL: str # Specific Mistral model to use (e.g., \"mistral-large-latest\")\n",
        "\n",
        "config = Config(\n",
        "    LINEAR_API_KEY = \"YOUR API KEY ON LINEAR\",\n",
        "    LINEAR_TEAM_ID = \"YOUR TEAM ID ON LINEAR\",\n",
        "    LINEAR_GRAPHQL_URL = \"https://api.linear.app/graphql\",\n",
        "    MISTRAL_API_KEY = \"YOUR MISTRAL API KEY\", # Get your API key from https://console.mistral.ai/api-keys/\n",
        "    MISTRAL_MODEL = \"ministral-large-latest\",\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "3hU03MD7H_XP"
      },
      "source": [
        "### Data Models\n",
        "\n",
        "We also define our data structures for Features and descriptions that we create on Linear based on PRD."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "id": "YxIsVnmVH_XP"
      },
      "outputs": [],
      "source": [
        "class FeaturesList(BaseModel):\n",
        "    \"\"\"Pydantic model for structured feature data.\"\"\"\n",
        "    Features: List[str]\n",
        "    DescriptionOfFeatures: List[str]"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "3q1lbyKLH_XP"
      },
      "source": [
        "### PRD Generation Agent\n",
        "\n",
        "The PRD Generation Agent (`PRDAgent`) is responsible for converting call transcripts into accurate PRDs through an iterative process:\n",
        "\n",
        "1. First creates initial PRD (`generate_initial_prd`)\n",
        "2. Then gets feedback (`get_feedback`)\n",
        "3. Refines based on feedback (`refine_prd`)\n",
        "4. Repeats until quality is satisfactory (max 3 times) (`run`)\n",
        "\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "id": "2T9TPmGFH_XP"
      },
      "outputs": [],
      "source": [
        "class PRDAgent:\n",
        "    \"\"\"Agent responsible for generating and refining PRD from transcripts.\"\"\"\n",
        "\n",
        "    def __init__(self, transcript: str, mistral_client: Mistral, model: str = \"mistral-large-latest\"):\n",
        "        \"\"\"\n",
        "        Initialize PRD agent.\n",
        "\n",
        "        Args:\n",
        "            transcript (str): Call transcript text\n",
        "            mistral_client (Mistral): Initialized Mistral client\n",
        "            model (str): Model name to use\n",
        "        \"\"\"\n",
        "        self.transcript: str = transcript\n",
        "        self.prd: Optional[str] = None\n",
        "        self.feedback: Optional[str] = None\n",
        "        self.client: Mistral = mistral_client\n",
        "        self.model: str = model\n",
        "\n",
        "    def generate_initial_prd(self) -> str:\n",
        "        \"\"\"\n",
        "        Generate initial PRD from transcript.\n",
        "\n",
        "        Returns:\n",
        "            str: Generated PRD text\n",
        "        \"\"\"\n",
        "        prompt = f\"\"\"\n",
        "        Based on the following call transcript, create an initial Product Requirements Document (PRD) with some or all of these sections:\n",
        "        1. Title\n",
        "        2. Purpose\n",
        "        3. Scope\n",
        "        4. Features and Requirements\n",
        "        5. User Personas\n",
        "        6. Technical Requirements\n",
        "        7. Constraints\n",
        "        8. Success Metrics\n",
        "        9. Timeline and Milestones\n",
        "\n",
        "        Transcript:\n",
        "        {self.transcript}\n",
        "\n",
        "        Align everything only with the information provided in the transcript. If any section is not present in the transcript, you can skip it in the PRD.\n",
        "\n",
        "        PRD:\n",
        "        \"\"\"\n",
        "        response = self.client.chat.complete(\n",
        "            model=self.model,\n",
        "            messages=[{\"role\": \"user\", \"content\": prompt}],\n",
        "            temperature=0.1\n",
        "        )\n",
        "        self.prd = response.choices[0].message.content\n",
        "        return self.prd\n",
        "\n",
        "    def get_feedback(self) -> str:\n",
        "        \"\"\"\n",
        "        Get feedback on current PRD.\n",
        "\n",
        "        Returns:\n",
        "            str: Feedback text\n",
        "        \"\"\"\n",
        "        prompt = f\"\"\"\n",
        "            Review the following Product Requirements Document (PRD) based on the original call transcript. Provide feedback on:\n",
        "            - Missing information in PRD that are present in the transcript.\n",
        "            - Inconsistencies in the PRD that are not aligned with the transcript.\n",
        "\n",
        "            Transcript:\n",
        "            {self.transcript}\n",
        "\n",
        "            Current PRD:\n",
        "            {self.prd}\n",
        "\n",
        "            Align the feedback only with the information provided in the transcript. We are not looking for additional information based on your knowledge.\n",
        "\n",
        "            If no feedback is required, respond with \"None.\" and don't provide any further feedback. Your task is only to review the alignment between the PRD and the transcript and provide feedback based on that. Don't refine the PRD at this stage.\n",
        "\n",
        "            Feedback:\n",
        "            \"\"\"\n",
        "        response = self.client.chat.complete(\n",
        "            model=self.model,\n",
        "            messages=[{\"role\": \"user\", \"content\": prompt}],\n",
        "            temperature=0.1\n",
        "        )\n",
        "        self.feedback = response.choices[0].message.content\n",
        "        return self.feedback\n",
        "\n",
        "    def refine_prd(self) -> str:\n",
        "        \"\"\"\n",
        "        Refine PRD based on feedback.\n",
        "\n",
        "        Returns:\n",
        "            str: Refined PRD text\n",
        "        \"\"\"\n",
        "        prompt = f\"\"\"\n",
        "        Refine the PRD based on the provided feedback and aligning it with the transcript:\n",
        "\n",
        "        Current PRD:\n",
        "        {self.prd}\n",
        "\n",
        "        Feedback:\n",
        "        {self.feedback}\n",
        "\n",
        "        Transcript:\n",
        "        {self.transcript}\n",
        "        \"\"\"\n",
        "        response = self.client.chat.complete(\n",
        "            model=self.model,\n",
        "            messages=[{\"role\": \"user\", \"content\": prompt}],\n",
        "            temperature=0.1\n",
        "        )\n",
        "        self.prd = response.choices[0].message.content\n",
        "        return self.prd\n",
        "\n",
        "    def run(self, max_iterations: int = 3) -> str:\n",
        "        \"\"\"\n",
        "        Run the PRD generation and refinement process.\n",
        "\n",
        "        Args:\n",
        "            max_iterations (int): Maximum number of refinement iterations\n",
        "\n",
        "        Returns:\n",
        "            str: Final PRD text\n",
        "        \"\"\"\n",
        "        print(\"Generating initial PRD...\")\n",
        "        self.generate_initial_prd()\n",
        "        print(f\"Initial PRD:\\n{self.prd}\")\n",
        "\n",
        "        for iteration in range(max_iterations):\n",
        "            print(f\"\\nIteration {iteration}: Requesting feedback...\")\n",
        "            feedback = self.get_feedback()\n",
        "            print(f\"Feedback:\\n{feedback}\")\n",
        "\n",
        "            if \"none\" in feedback.strip().lower():\n",
        "                print(\"\\nNo further feedback. Finalizing PRD...\")\n",
        "                break\n",
        "\n",
        "            print(\"\\nRefining PRD...\")\n",
        "            self.refine_prd()\n",
        "            print(f\"Refined PRD:\\n{self.prd}\")\n",
        "\n",
        "        return self.prd"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "zauysE7tH_XQ"
      },
      "source": [
        "### Ticket Creation Agent\n",
        "\n",
        "The Ticket Creation Agent converts PRDs into actionable tickets on Linear through three main steps:\n",
        "\n",
        "1. Parses PRD into structured features and descriptions (`parse_prd`)\n",
        "2. Converts each feature into a ticket format (`create_ticket`)\n",
        "3. Creates tickets in Linear via GraphQL API (`create_tickets_from_prd`)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "id": "0W4MR-aTH_XQ"
      },
      "outputs": [],
      "source": [
        "class TicketCreationAgent:\n",
        "    \"\"\"Agent responsible for creating Linear tickets from PRD.\"\"\"\n",
        "\n",
        "    def __init__(self, api_key: str, team_id: str, mistral_client: Mistral, graphql_url: str):\n",
        "        \"\"\"\n",
        "        Initialize Linear ticket agent.\n",
        "\n",
        "        Args:\n",
        "            api_key (str): Linear API key\n",
        "            team_id (str): Linear team ID\n",
        "            mistral_client (Mistral): Initialized Mistral client\n",
        "            graphql_url (str): Linear GraphQL API URL\n",
        "        \"\"\"\n",
        "        self.client = Client(\n",
        "            transport=RequestsHTTPTransport(\n",
        "                url=graphql_url,\n",
        "                headers={'Authorization': api_key},\n",
        "                verify=True,\n",
        "                retries=3\n",
        "            ),\n",
        "            fetch_schema_from_transport=True\n",
        "        )\n",
        "        self.team_id = team_id\n",
        "        self.mistral_client = mistral_client\n",
        "\n",
        "    def parse_prd(self, prd_text: str) -> Dict[str, List[str]]:\n",
        "        \"\"\"\n",
        "        Parse PRD into structured feature data.\n",
        "\n",
        "        Args:\n",
        "            prd_text (str): PRD text to parse\n",
        "\n",
        "        Returns:\n",
        "            Dict[str, List[str]]: Structured feature data\n",
        "        \"\"\"\n",
        "        messages = [\n",
        "            {\n",
        "                \"role\": \"system\",\n",
        "                \"content\": (\n",
        "                    \"You are an AI assistant helping to create Features list and their descriptions from a Product Requirements Document (PRD).\"\n",
        "                    \"The description should contain a brief explanation of the feature that includes Technical requirements (if any), Constraints (if any), Success metrics (if any), User personas (if any), and Timeline and Milestones (if any).\"\n",
        "                )\n",
        "            },\n",
        "            {\n",
        "                \"role\": \"user\",\n",
        "                \"content\": f\"PRD:\\n\\n{prd_text}\"\n",
        "            }\n",
        "        ]\n",
        "\n",
        "        chat_response = self.mistral_client.chat.parse(\n",
        "            model=\"mistral-large-latest\",\n",
        "            messages=messages,\n",
        "            response_format=FeaturesList,\n",
        "            max_tokens=2048,\n",
        "            temperature=0.1\n",
        "        )\n",
        "\n",
        "        return json.loads(chat_response.choices[0].message.content)\n",
        "\n",
        "    def create_ticket(self, title: str, description: str) -> Dict[str, Any]:\n",
        "        \"\"\"\n",
        "        Create a single Linear ticket.\n",
        "\n",
        "        Args:\n",
        "            title (str): Ticket title\n",
        "            description (str): Ticket description\n",
        "\n",
        "        Returns:\n",
        "            Dict[str, Any]: Creation result from Linear API\n",
        "        \"\"\"\n",
        "        mutation = gql(\"\"\"\n",
        "        mutation CreateIssue($title: String!, $description: String!, $teamId: String!) {\n",
        "            issueCreate(\n",
        "                input: {\n",
        "                    title: $title,\n",
        "                    description: $description,\n",
        "                    teamId: $teamId\n",
        "                }\n",
        "            ) {\n",
        "                success\n",
        "                issue {\n",
        "                    id\n",
        "                    url\n",
        "                }\n",
        "            }\n",
        "        }\n",
        "        \"\"\")\n",
        "\n",
        "        variables = {\n",
        "            \"title\": title,\n",
        "            \"description\": description,\n",
        "            \"teamId\": self.team_id\n",
        "        }\n",
        "\n",
        "        result = self.client.execute(mutation, variable_values=variables)\n",
        "        print(f\"Created ticket: {result['issueCreate']['issue']['url']}\")\n",
        "        return result\n",
        "\n",
        "    def create_tickets_from_prd(self, parsed_items: Dict[str, List[str]]) -> List[Dict[str, Any]]:\n",
        "        \"\"\"\n",
        "        Create Linear tickets from parsed PRD items.\n",
        "\n",
        "        Args:\n",
        "            parsed_items (Dict[str, List[str]]): Parsed feature data\n",
        "\n",
        "        Returns:\n",
        "            List[Dict[str, Any]]: List of ticket creation results\n",
        "        \"\"\"\n",
        "        results = []\n",
        "        for title, description in zip(\n",
        "            parsed_items['Features'],\n",
        "            parsed_items['DescriptionOfFeatures']\n",
        "        ):\n",
        "            result = self.create_ticket(title, description)\n",
        "            results.append(result)\n",
        "        return results\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "RRiQd7FwH_XQ"
      },
      "source": [
        "### Workflow Orchestrator\n",
        "\n",
        "The Workflow Orchestrator:\n",
        "- Coordinates the entire process\n",
        "- Manages communication between agents\n",
        "- Handles the overall workflow"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "id": "KEax9c1WH_XQ"
      },
      "outputs": [],
      "source": [
        "class WorkflowOrchestrator:\n",
        "    \"\"\"Orchestrates the entire workflow from transcript to Linear tickets.\"\"\"\n",
        "\n",
        "    def __init__(self, config: Config, transcript: str):\n",
        "        \"\"\"\n",
        "        Initialize workflow orchestrator.\n",
        "\n",
        "        Args:\n",
        "            config (Config): Application configuration\n",
        "            transcript (str): Call transcript text\n",
        "        \"\"\"\n",
        "        mistral_client = Mistral(api_key=config.MISTRAL_API_KEY)\n",
        "        self.prd_agent = PRDAgent(\n",
        "            transcript=transcript,\n",
        "            mistral_client=mistral_client\n",
        "        )\n",
        "        self.linear_agent = TicketCreationAgent(\n",
        "            api_key=config.LINEAR_API_KEY,\n",
        "            team_id=config.LINEAR_TEAM_ID,\n",
        "            mistral_client=mistral_client,\n",
        "            graphql_url=config.LINEAR_GRAPHQL_URL\n",
        "        )\n",
        "\n",
        "    def run(self) -> Dict[str, Any]:\n",
        "        \"\"\"\n",
        "        Run the complete workflow.\n",
        "\n",
        "        Returns:\n",
        "            Dict[str, Any]: Workflow results including PRD and ticket data\n",
        "        \"\"\"\n",
        "        print(\"Generating and finalizing PRD...\")\n",
        "        prd = self.prd_agent.run()\n",
        "\n",
        "        print(\"\\nParsing PRD into actionable items...\")\n",
        "        parsed_items = self.linear_agent.parse_prd(prd)\n",
        "\n",
        "        print(\"\\nCreating Linear tickets...\")\n",
        "        ticket_results = self.linear_agent.create_tickets_from_prd(parsed_items)\n",
        "\n",
        "        return {\n",
        "            \"prd\": prd,\n",
        "            \"parsed_items\": parsed_items,\n",
        "            \"ticket_results\": ticket_results\n",
        "        }"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "2J71NcMs3_cQ"
      },
      "source": [
        "### Parse The Call Transcript\n",
        "\n",
        "We will use Mistral OCR model to parse the downloaded call transcript file."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "id": "i1iZ6fWw3qBO"
      },
      "outputs": [],
      "source": [
        "def parse_transcript(config: Config, file_path: str) -> str:\n",
        "  \"\"\"Parse a transcriot PDF file and extract text from all pages using Mistral OCR.\"\"\"\n",
        "\n",
        "  mistral_client = Mistral(api_key=config.MISTRAL_API_KEY)\n",
        "\n",
        "  uploaded_pdf = mistral_client.files.upload(\n",
        "      file={\n",
        "          \"file_name\": file_path,\n",
        "          \"content\": open(file_path, \"rb\"),\n",
        "      },\n",
        "      purpose=\"ocr\"\n",
        "  )\n",
        "\n",
        "  signed_url = mistral_client.files.get_signed_url(file_id=uploaded_pdf.id)\n",
        "\n",
        "  ocr_response = mistral_client.ocr.process(\n",
        "      model=\"mistral-ocr-latest\",\n",
        "      document={\n",
        "          \"type\": \"document_url\",\n",
        "          \"document_url\": signed_url.url,\n",
        "      }\n",
        "  )\n",
        "\n",
        "  text = \"\\n\".join([x.markdown for x in (ocr_response.pages)])\n",
        "\n",
        "  return text"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "id": "GHAHLu5B4X9w"
      },
      "outputs": [],
      "source": [
        "transcript = parse_transcript(config, \"./lechat_product_call_trascript.pdf\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "gUkVeRgVH_XQ"
      },
      "source": [
        "### Running the Pipeline\n",
        "\n",
        "Let's test the pipeline with a sample transcript that discusses about LeChat product call."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "uK_HWwSFH_XQ",
        "outputId": "4b2b549a-ac4a-4bb2-de8d-68c59a44a0d3"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Generating and finalizing PRD...\n",
            "Generating initial PRD...\n",
            "Initial PRD:\n",
            "# Product Requirements Document (PRD) for Le Chat\n",
            "\n",
            "## 1. Title\n",
            "Product Requirements Document for Le Chat AI Assistant\n",
            "\n",
            "## 2. Purpose\n",
            "The purpose of this PRD is to outline the requirements and features for the next update of Le Chat, our AI assistant. This document aims to address current strengths, areas for improvement, and innovative features to enhance user experience and engagement.\n",
            "\n",
            "## 3. Scope\n",
            "This PRD covers the following aspects of Le Chat:\n",
            "- Current strengths and areas for improvement\n",
            "- Prioritized features for the next update\n",
            "- Innovative feature ideas to set Le Chat apart from competitors\n",
            "\n",
            "## 4. Features and Requirements\n",
            "\n",
            "### Current Strengths\n",
            "- **Seamless Integration:** Le Chat works well across different devices and apps, with a stable API and positive feedback on ease of integration.\n",
            "- **Natural Language Processing:** Users appreciate the intuitive understanding of complex queries and personalized responses.\n",
            "- **User Engagement:** Personalization features drive higher retention rates and positive social media sharing.\n",
            "- **User Interface:** Clean and easy-to-navigate UI with well-received visual feedback and interactive elements.\n",
            "- **Data Analytics:** Increased user interactions and engagement metrics.\n",
            "- **Security:** Robust encryption protocols and positive feedback on privacy policies.\n",
            "\n",
            "### Areas for Improvement\n",
            "- **Latency Issues:** Optimize infrastructure to handle traffic spikes and reduce response times.\n",
            "- **AI Accuracy:** Improve AI’s understanding of context and sarcasm for better responses.\n",
            "- **Onboarding Process:** Create a smoother, more guided onboarding experience with interactive tutorials.\n",
            "- **Accessibility:** Conduct thorough accessibility testing and make necessary adjustments.\n",
            "- **Data Analysis Tools:** Improve tools for analyzing user feedback and feature usage.\n",
            "- **Incident Response:** Enhance incident response plan for swift and effective security issue resolution.\n",
            "\n",
            "### Prioritized Features for Next Update\n",
            "- **Real-Time Translation:** Enhance accuracy and speed in real-time translations and support more languages.\n",
            "- **Contextual Memory:** Improve AI’s ability to remember previous conversations for more relevant responses.\n",
            "- **Third-Party Integrations:** Integrate with popular productivity tools and explore partnerships with tech companies.\n",
            "- **Customizable Themes:** Allow users to personalize the look and feel of Le Chat.\n",
            "- **Advanced Analytics:** Provide users with insights into their interactions with Le Chat.\n",
            "- **Privacy Mode:** Allow users to control what data is stored and for how long.\n",
            "\n",
            "### Innovative Feature Ideas\n",
            "- **Customizable AI Personality:** Allow users to choose between different personas for the AI.\n",
            "- **Community Forum:** Create a forum for users to share tips, tricks, and best practices.\n",
            "- **Creative Content Generation:** Enable Le Chat to generate poems, stories, or jokes based on user inputs.\n",
            "- **Personalized Learning Experiences:** Offer language learning courses, coding tutorials, or educational games.\n",
            "- **Enhanced Security Features:** Implement multi-factor authentication, biometric verification, and data access controls.\n",
            "\n",
            "## 5. User Personas\n",
            "- **Tech-Savvy User:** Values seamless integration and advanced features.\n",
            "- **Casual User:** Appreciates intuitive interactions and personalized responses.\n",
            "- **Professional User:** Needs robust productivity tool integrations and advanced analytics.\n",
            "- **Creative User:** Enjoys generating and collaborating on creative content.\n",
            "- **Learner:** Seeks personalized learning experiences and educational content.\n",
            "- **Security-Conscious User:** Prioritizes data privacy and control over personal information.\n",
            "\n",
            "## 6. Technical Requirements\n",
            "- **Infrastructure Optimization:** Enhance server capabilities to handle peak usage times.\n",
            "- **AI Enhancements:** Improve natural language processing and contextual awareness.\n",
            "- **Accessibility Compliance:** Ensure Le Chat is usable by everyone, including those with disabilities.\n",
            "- **Data Analysis Tools:** Develop better tools for analyzing user feedback and feature usage.\n",
            "- **Security Measures:** Implement robust encryption protocols and regular security audits.\n",
            "\n",
            "## 7. Constraints\n",
            "- **Latency Issues:** Current infrastructure struggles with high demand during peak usage times.\n",
            "- **AI Limitations:** Difficulty understanding context and sarcasm in complex queries.\n",
            "- **Onboarding Complexity:** New users find the onboarding process overwhelming.\n",
            "- **Accessibility Gaps:** Need for thorough accessibility testing and adjustments.\n",
            "- **Data Analysis Tools:** Lack of advanced tools for analyzing user feedback and feature usage.\n",
            "- **Security Threats:** Need for vigilance against emerging threats and improved incident response.\n",
            "\n",
            "## 8. Success Metrics\n",
            "- **User Engagement:** Increase in user interactions and engagement metrics.\n",
            "- **Retention Rates:** Higher retention rates driven by personalization features.\n",
            "- **Positive Feedback:** Reduction in basic support queries and positive social media sharing.\n",
            "- **Feature Usage:** Increased exploration of features and positive feedback on new updates.\n",
            "- **Security Trust:** Positive feedback on privacy policies and data handling practices.\n",
            "\n",
            "## 9. Timeline and Milestones\n",
            "- **Immediate:** Compile insights into PRD and create engineering tickets for the next sprint.\n",
            "- **Short-Term:** Address latency issues, improve AI accuracy, and enhance the onboarding process.\n",
            "- **Mid-Term:** Implement prioritized features such as real-time translation, contextual memory, and third-party integrations.\n",
            "- **Long-Term:** Explore innovative feature ideas and continuously improve user experience and engagement.\n",
            "\n",
            "---\n",
            "\n",
            "This PRD serves as a comprehensive guide for the next update of Le Chat, ensuring that we address current challenges, prioritize key features, and innovate to stay ahead of the competition.\n",
            "\n",
            "Iteration 0: Requesting feedback...\n",
            "Feedback:\n",
            "### Missing Information in PRD that are Present in the Transcript\n",
            "\n",
            "1. **In-App Messaging:**\n",
            "   - **Transcript:** Dave mentioned that the in-app messaging needs improvement to better communicate new features and updates.\n",
            "   - **PRD:** This point is not included in the PRD.\n",
            "\n",
            "2. **Data Visualization:**\n",
            "   - **Transcript:** Frank mentioned the need for better data visualization capabilities to communicate insights to the team.\n",
            "   - **PRD:** This point is not included in the PRD.\n",
            "\n",
            "3. **Regular Security Audits:**\n",
            "   - **Transcript:** Grace mentioned the need for regular security audits.\n",
            "   - **PRD:** This point is not explicitly mentioned in the PRD.\n",
            "\n",
            "4. **Dynamic Personas:**\n",
            "   - **Transcript:** Bob mentioned the idea of dynamic personas that adapt to the user’s mood or context.\n",
            "   - **PRD:** This point is not included in the PRD.\n",
            "\n",
            "5. **Webinars and Q&A Sessions:**\n",
            "   - **Transcript:** Dave mentioned hosting regular webinars and Q&A sessions to engage with the user base.\n",
            "   - **PRD:** This point is not included in the PRD.\n",
            "\n",
            "6. **Collaborative Creative Projects:**\n",
            "   - **Transcript:** Eva mentioned features that allow users to collaborate on creative projects.\n",
            "   - **PRD:** This point is not included in the PRD.\n",
            "\n",
            "### Inconsistencies in the PRD that are Not Aligned with the Transcript\n",
            "\n",
            "1. **Privacy Mode:**\n",
            "   - **Transcript:** Carol mentioned the privacy mode where users can control what data is stored and for how long.\n",
            "   - **PRD:** This point is correctly included in the PRD.\n",
            "\n",
            "2. **Customizable AI Personality:**\n",
            "   - **Transcript:** Bob mentioned the feature allowing users to customize the AI’s personality traits.\n",
            "   - **PRD:** This point is correctly included in the PRD.\n",
            "\n",
            "3. **Community Forum:**\n",
            "   - **Transcript:** Dave mentioned introducing a community forum.\n",
            "   - **PRD:** This point is correctly included in the PRD.\n",
            "\n",
            "4. **Creative Content Generation:**\n",
            "   - **Transcript:** Eva mentioned Le Chat generating creative content like poems, stories, or jokes.\n",
            "   - **PRD:** This point is correctly included in the PRD.\n",
            "\n",
            "5. **Personalized Learning Experiences:**\n",
            "   - **Transcript:** Frank mentioned providing users with personalized learning experiences.\n",
            "   - **PRD:** This point is correctly included in the PRD.\n",
            "\n",
            "6. **Enhanced Security Features:**\n",
            "   - **Transcript:** Grace mentioned implementing multi-factor authentication, biometric verification, and data access controls.\n",
            "   - **PRD:** This point is correctly included in the PRD.\n",
            "\n",
            "### Summary\n",
            "\n",
            "The PRD is mostly aligned with the transcript, but there are several points from the transcript that are missing in the PRD. These include in-app messaging improvements, data visualization capabilities, regular security audits, dynamic personas, webinars and Q&A sessions, and collaborative creative projects. Addressing these missing points will ensure the PRD fully captures the discussion from the transcript.\n",
            "\n",
            "Refining PRD...\n",
            "Refined PRD:\n",
            "# Product Requirements Document (PRD) for Le Chat\n",
            "\n",
            "## 1. Title\n",
            "Product Requirements Document for Le Chat AI Assistant\n",
            "\n",
            "## 2. Purpose\n",
            "The purpose of this PRD is to outline the requirements and features for the next update of Le Chat, our AI assistant. This document aims to address current strengths, areas for improvement, and innovative features to enhance user experience and engagement.\n",
            "\n",
            "## 3. Scope\n",
            "This PRD covers the following aspects of Le Chat:\n",
            "- Current strengths and areas for improvement\n",
            "- Prioritized features for the next update\n",
            "- Innovative feature ideas to set Le Chat apart from competitors\n",
            "\n",
            "## 4. Features and Requirements\n",
            "\n",
            "### Current Strengths\n",
            "- **Seamless Integration:** Le Chat works well across different devices and apps, with a stable API and positive feedback on ease of integration.\n",
            "- **Natural Language Processing:** Users appreciate the intuitive understanding of complex queries and personalized responses.\n",
            "- **User Engagement:** Personalization features drive higher retention rates and positive social media sharing.\n",
            "- **User Interface:** Clean and easy-to-navigate UI with well-received visual feedback and interactive elements.\n",
            "- **Data Analytics:** Increased user interactions and engagement metrics.\n",
            "- **Security:** Robust encryption protocols and positive feedback on privacy policies.\n",
            "\n",
            "### Areas for Improvement\n",
            "- **Latency Issues:** Optimize infrastructure to handle traffic spikes and reduce response times.\n",
            "- **AI Accuracy:** Improve AI’s understanding of context and sarcasm for better responses.\n",
            "- **Onboarding Process:** Create a smoother, more guided onboarding experience with interactive tutorials.\n",
            "- **Accessibility:** Conduct thorough accessibility testing and make necessary adjustments.\n",
            "- **Data Analysis Tools:** Improve tools for analyzing user feedback and feature usage.\n",
            "- **Incident Response:** Enhance incident response plan for swift and effective security issue resolution.\n",
            "- **In-App Messaging:** Improve in-app messaging to better communicate new features and updates.\n",
            "- **Data Visualization:** Enhance data visualization capabilities to communicate insights to the team.\n",
            "- **Regular Security Audits:** Implement regular security audits to stay vigilant against emerging threats.\n",
            "\n",
            "### Prioritized Features for Next Update\n",
            "- **Real-Time Translation:** Enhance accuracy and speed in real-time translations and support more languages.\n",
            "- **Contextual Memory:** Improve AI’s ability to remember previous conversations for more relevant responses.\n",
            "- **Third-Party Integrations:** Integrate with popular productivity tools and explore partnerships with tech companies.\n",
            "- **Customizable Themes:** Allow users to personalize the look and feel of Le Chat.\n",
            "- **Advanced Analytics:** Provide users with insights into their interactions with Le Chat.\n",
            "- **Privacy Mode:** Allow users to control what data is stored and for how long.\n",
            "\n",
            "### Innovative Feature Ideas\n",
            "- **Customizable AI Personality:** Allow users to choose between different personas for the AI.\n",
            "- **Dynamic Personas:** Introduce dynamic personas that adapt to the user’s mood or context.\n",
            "- **Community Forum:** Create a forum for users to share tips, tricks, and best practices.\n",
            "- **Creative Content Generation:** Enable Le Chat to generate poems, stories, or jokes based on user inputs.\n",
            "- **Collaborative Creative Projects:** Allow users to collaborate on creative projects, such as co-writing stories or creating art.\n",
            "- **Personalized Learning Experiences:** Offer language learning courses, coding tutorials, or educational games.\n",
            "- **Enhanced Security Features:** Implement multi-factor authentication, biometric verification, and data access controls.\n",
            "- **Webinars and Q&A Sessions:** Host regular webinars and Q&A sessions to engage with the user base.\n",
            "\n",
            "## 5. User Personas\n",
            "- **Tech-Savvy User:** Values seamless integration and advanced features.\n",
            "- **Casual User:** Appreciates intuitive interactions and personalized responses.\n",
            "- **Professional User:** Needs robust productivity tool integrations and advanced analytics.\n",
            "- **Creative User:** Enjoys generating and collaborating on creative content.\n",
            "- **Learner:** Seeks personalized learning experiences and educational content.\n",
            "- **Security-Conscious User:** Prioritizes data privacy and control over personal information.\n",
            "\n",
            "## 6. Technical Requirements\n",
            "- **Infrastructure Optimization:** Enhance server capabilities to handle peak usage times.\n",
            "- **AI Enhancements:** Improve natural language processing and contextual awareness.\n",
            "- **Accessibility Compliance:** Ensure Le Chat is usable by everyone, including those with disabilities.\n",
            "- **Data Analysis Tools:** Develop better tools for analyzing user feedback and feature usage.\n",
            "- **Security Measures:** Implement robust encryption protocols and regular security audits.\n",
            "\n",
            "## 7. Constraints\n",
            "- **Latency Issues:** Current infrastructure struggles with high demand during peak usage times.\n",
            "- **AI Limitations:** Difficulty understanding context and sarcasm in complex queries.\n",
            "- **Onboarding Complexity:** New users find the onboarding process overwhelming.\n",
            "- **Accessibility Gaps:** Need for thorough accessibility testing and adjustments.\n",
            "- **Data Analysis Tools:** Lack of advanced tools for analyzing user feedback and feature usage.\n",
            "- **Security Threats:** Need for vigilance against emerging threats and improved incident response.\n",
            "\n",
            "## 8. Success Metrics\n",
            "- **User Engagement:** Increase in user interactions and engagement metrics.\n",
            "- **Retention Rates:** Higher retention rates driven by personalization features.\n",
            "- **Positive Feedback:** Reduction in basic support queries and positive social media sharing.\n",
            "- **Feature Usage:** Increased exploration of features and positive feedback on new updates.\n",
            "- **Security Trust:** Positive feedback on privacy policies and data handling practices.\n",
            "\n",
            "## 9. Timeline and Milestones\n",
            "- **Immediate:** Compile insights into PRD and create engineering tickets for the next sprint.\n",
            "- **Short-Term:** Address latency issues, improve AI accuracy, and enhance the onboarding process.\n",
            "- **Mid-Term:** Implement prioritized features such as real-time translation, contextual memory, and third-party integrations.\n",
            "- **Long-Term:** Explore innovative feature ideas and continuously improve user experience and engagement.\n",
            "\n",
            "---\n",
            "\n",
            "This PRD serves as a comprehensive guide for the next update of Le Chat, ensuring that we address current challenges, prioritize key features, and innovate to stay ahead of the competition.\n",
            "\n",
            "Iteration 1: Requesting feedback...\n",
            "Feedback:\n",
            "### Missing Information in PRD that are Present in the Transcript\n",
            "\n",
            "1. **Bug Reporting:**\n",
            "   - **Transcript:** Bob mentioned, \"Additionally, there have been a few bugs reported in the real-time update feature that need addressing.\"\n",
            "   - **PRD:** This specific issue is not mentioned in the PRD.\n",
            "\n",
            "2. **User Preferences and Habits Integration:**\n",
            "   - **Transcript:** Carol suggested, \"We could also explore integrating user preferences and habits into the AI's memory to further enhance personalization.\"\n",
            "   - **PRD:** This suggestion is not included in the PRD.\n",
            "\n",
            "3. **Seasonal Themes and Limited-Edition Designs:**\n",
            "   - **Transcript:** Eva mentioned, \"We could also explore seasonal themes and limited-edition designs to keep the UI fresh and exciting.\"\n",
            "   - **PRD:** This idea is not included in the PRD.\n",
            "\n",
            "4. **Personalized Recommendations Based on Usage Patterns:**\n",
            "   - **Transcript:** Frank suggested, \"For example, users could track their most frequently asked questions, response times, and even receive personalized recommendations based on their usage patterns.\"\n",
            "   - **PRD:** The specific mention of personalized recommendations based on usage patterns is missing.\n",
            "\n",
            "5. **Anonymize Data or Opt Out of Data Collection:**\n",
            "   - **Transcript:** Grace mentioned, \"We could also explore features that allow users to anonymize their data or opt out of certain data collection practices.\"\n",
            "   - **PRD:** This specific feature is not detailed in the PRD.\n",
            "\n",
            "### Inconsistencies in the PRD that are Not Aligned with the Transcript\n",
            "\n",
            "1. **Privacy Mode:**\n",
            "   - **Transcript:** Carol mentioned, \"A privacy mode where users can control what data is stored and for how long would build trust.\"\n",
            "   - **PRD:** This feature is listed under \"Innovative Feature Ideas\" instead of \"Prioritized Features for Next Update,\" which is inconsistent with the transcript where it was discussed as a prioritized feature.\n",
            "\n",
            "2. **Dynamic Personas:**\n",
            "   - **Transcript:** Bob suggested, \"We could also explore dynamic personas that adapt to the user’s mood or context.\"\n",
            "   - **PRD:** This feature is listed separately under \"Innovative Feature Ideas\" instead of being combined with \"Customizable AI Personality,\" which might cause confusion.\n",
            "\n",
            "3. **Community Forum:**\n",
            "   - **Transcript:** Dave suggested, \"Introducing a community forum where users can share tips, tricks, and best practices could foster a sense of community around Le Chat.\"\n",
            "   - **PRD:** This feature is listed under \"Innovative Feature Ideas\" instead of \"Prioritized Features for Next Update,\" which is inconsistent with the transcript where it was discussed as a prioritized feature.\n",
            "\n",
            "4. **Webinars and Q&A Sessions:**\n",
            "   - **Transcript:** Dave suggested, \"We could also host regular webinars and Q&A sessions to engage with our user base and gather feedback.\"\n",
            "   - **PRD:** This feature is listed under \"Innovative Feature Ideas\" instead of \"Prioritized Features for Next Update,\" which is inconsistent with the transcript where it was discussed as a prioritized feature.\n",
            "\n",
            "5. **Enhanced Security Features:**\n",
            "   - **Transcript:** Grace suggested, \"We should explore features that enhance user security and control.\"\n",
            "   - **PRD:** This feature is listed under \"Innovative Feature Ideas\" instead of \"Prioritized Features for Next Update,\" which is inconsistent with the transcript where it was discussed as a prioritized feature.\n",
            "\n",
            "### Summary\n",
            "\n",
            "The PRD has several missing pieces of information and inconsistencies when compared to the transcript. Addressing these gaps and aligning the PRD more closely with the discussion points from the transcript will ensure a more accurate and comprehensive document.\n",
            "\n",
            "Refining PRD...\n",
            "Refined PRD:\n",
            "# Product Requirements Document (PRD) for Le Chat\n",
            "\n",
            "## 1. Title\n",
            "Product Requirements Document for Le Chat AI Assistant\n",
            "\n",
            "## 2. Purpose\n",
            "The purpose of this PRD is to outline the requirements and features for the next update of Le Chat, our AI assistant. This document aims to address current strengths, areas for improvement, and innovative features to enhance user experience and engagement.\n",
            "\n",
            "## 3. Scope\n",
            "This PRD covers the following aspects of Le Chat:\n",
            "- Current strengths and areas for improvement\n",
            "- Prioritized features for the next update\n",
            "- Innovative feature ideas to set Le Chat apart from competitors\n",
            "\n",
            "## 4. Features and Requirements\n",
            "\n",
            "### Current Strengths\n",
            "- **Seamless Integration:** Le Chat works well across different devices and apps, with a stable API and positive feedback on ease of integration.\n",
            "- **Natural Language Processing:** Users appreciate the intuitive understanding of complex queries and personalized responses.\n",
            "- **User Engagement:** Personalization features drive higher retention rates and positive social media sharing.\n",
            "- **User Interface:** Clean and easy-to-navigate UI with well-received visual feedback and interactive elements.\n",
            "- **Data Analytics:** Increased user interactions and engagement metrics.\n",
            "- **Security:** Robust encryption protocols and positive feedback on privacy policies.\n",
            "\n",
            "### Areas for Improvement\n",
            "- **Latency Issues:** Optimize infrastructure to handle traffic spikes and reduce response times.\n",
            "- **AI Accuracy:** Improve AI’s understanding of context and sarcasm for better responses.\n",
            "- **Onboarding Process:** Create a smoother, more guided onboarding experience with interactive tutorials.\n",
            "- **Accessibility:** Conduct thorough accessibility testing and make necessary adjustments.\n",
            "- **Data Analysis Tools:** Improve tools for analyzing user feedback and feature usage.\n",
            "- **Incident Response:** Enhance incident response plan for swift and effective security issue resolution.\n",
            "- **In-App Messaging:** Improve in-app messaging to better communicate new features and updates.\n",
            "- **Data Visualization:** Enhance data visualization capabilities to communicate insights to the team.\n",
            "- **Regular Security Audits:** Implement regular security audits to stay vigilant against emerging threats.\n",
            "- **Bug Reporting:** Address bugs reported in the real-time update feature.\n",
            "\n",
            "### Prioritized Features for Next Update\n",
            "- **Real-Time Translation:** Enhance accuracy and speed in real-time translations and support more languages.\n",
            "- **Contextual Memory:** Improve AI’s ability to remember previous conversations for more relevant responses.\n",
            "- **Third-Party Integrations:** Integrate with popular productivity tools and explore partnerships with tech companies.\n",
            "- **Customizable Themes:** Allow users to personalize the look and feel of Le Chat.\n",
            "- **Advanced Analytics:** Provide users with insights into their interactions with Le Chat.\n",
            "- **Privacy Mode:** Allow users to control what data is stored and for how long.\n",
            "- **Community Forum:** Create a forum for users to share tips, tricks, and best practices.\n",
            "- **Webinars and Q&A Sessions:** Host regular webinars and Q&A sessions to engage with the user base.\n",
            "- **Enhanced Security Features:** Implement multi-factor authentication, biometric verification, and data access controls.\n",
            "- **User Preferences and Habits Integration:** Integrate user preferences and habits into the AI's memory to enhance personalization.\n",
            "- **Seasonal Themes and Limited-Edition Designs:** Explore seasonal themes and limited-edition designs to keep the UI fresh and exciting.\n",
            "- **Personalized Recommendations Based on Usage Patterns:** Allow users to track their most frequently asked questions, response times, and receive personalized recommendations.\n",
            "- **Anonymize Data or Opt Out of Data Collection:** Allow users to anonymize their data or opt out of certain data collection practices.\n",
            "\n",
            "### Innovative Feature Ideas\n",
            "- **Customizable AI Personality:** Allow users to choose between different personas for the AI.\n",
            "- **Dynamic Personas:** Introduce dynamic personas that adapt to the user’s mood or context.\n",
            "- **Creative Content Generation:** Enable Le Chat to generate poems, stories, or jokes based on user inputs.\n",
            "- **Collaborative Creative Projects:** Allow users to collaborate on creative projects, such as co-writing stories or creating art.\n",
            "- **Personalized Learning Experiences:** Offer language learning courses, coding tutorials, or educational games.\n",
            "\n",
            "## 5. User Personas\n",
            "- **Tech-Savvy User:** Values seamless integration and advanced features.\n",
            "- **Casual User:** Appreciates intuitive interactions and personalized responses.\n",
            "- **Professional User:** Needs robust productivity tool integrations and advanced analytics.\n",
            "- **Creative User:** Enjoys generating and collaborating on creative content.\n",
            "- **Learner:** Seeks personalized learning experiences and educational content.\n",
            "- **Security-Conscious User:** Prioritizes data privacy and control over personal information.\n",
            "\n",
            "## 6. Technical Requirements\n",
            "- **Infrastructure Optimization:** Enhance server capabilities to handle peak usage times.\n",
            "- **AI Enhancements:** Improve natural language processing and contextual awareness.\n",
            "- **Accessibility Compliance:** Ensure Le Chat is usable by everyone, including those with disabilities.\n",
            "- **Data Analysis Tools:** Develop better tools for analyzing user feedback and feature usage.\n",
            "- **Security Measures:** Implement robust encryption protocols and regular security audits.\n",
            "\n",
            "## 7. Constraints\n",
            "- **Latency Issues:** Current infrastructure struggles with high demand during peak usage times.\n",
            "- **AI Limitations:** Difficulty understanding context and sarcasm in complex queries.\n",
            "- **Onboarding Complexity:** New users find the onboarding process overwhelming.\n",
            "- **Accessibility Gaps:** Need for thorough accessibility testing and adjustments.\n",
            "- **Data Analysis Tools:** Lack of advanced tools for analyzing user feedback and feature usage.\n",
            "- **Security Threats:** Need for vigilance against emerging threats and improved incident response.\n",
            "\n",
            "## 8. Success Metrics\n",
            "- **User Engagement:** Increase in user interactions and engagement metrics.\n",
            "- **Retention Rates:** Higher retention rates driven by personalization features.\n",
            "- **Positive Feedback:** Reduction in basic support queries and positive social media sharing.\n",
            "- **Feature Usage:** Increased exploration of features and positive feedback on new updates.\n",
            "- **Security Trust:** Positive feedback on privacy policies and data handling practices.\n",
            "\n",
            "## 9. Timeline and Milestones\n",
            "- **Immediate:** Compile insights into PRD and create engineering tickets for the next sprint.\n",
            "- **Short-Term:** Address latency issues, improve AI accuracy, and enhance the onboarding process.\n",
            "- **Mid-Term:** Implement prioritized features such as real-time translation, contextual memory, and third-party integrations.\n",
            "- **Long-Term:** Explore innovative feature ideas and continuously improve user experience and engagement.\n",
            "\n",
            "---\n",
            "\n",
            "This PRD serves as a comprehensive guide for the next update of Le Chat, ensuring that we address current challenges, prioritize key features, and innovate to stay ahead of the competition.\n",
            "\n",
            "Iteration 2: Requesting feedback...\n",
            "Feedback:\n",
            "### Missing Information in PRD that are Present in the Transcript:\n",
            "\n",
            "1. **Marketing Success Metrics:**\n",
            "   - The transcript mentions a 30% increase in new user sign-ups due to the recent campaign highlighting Le Chat's adaptability. This specific metric is not included in the PRD.\n",
            "\n",
            "2. **User Feedback on Privacy Policies:**\n",
            "   - The transcript highlights positive feedback from users regarding privacy policies, which is not explicitly mentioned in the PRD.\n",
            "\n",
            "3. **User Interaction Data:**\n",
            "   - The transcript mentions that users are spending more time with Le Chat and exploring more features, which is a strong indicator of the feature set resonating well with the user base. This specific data point is not included in the PRD.\n",
            "\n",
            "4. **Real-Time Update Feature Bugs:**\n",
            "   - The transcript mentions bugs reported in the real-time update feature, but this is not listed under \"Areas for Improvement\" in the PRD.\n",
            "\n",
            "### Inconsistencies in the PRD that are not Aligned with the Transcript:\n",
            "\n",
            "1. **Privacy Mode:**\n",
            "   - The transcript mentions the idea of a privacy mode twice, once by Carol and once by Grace. However, the PRD lists it only once under \"Prioritized Features for Next Update.\"\n",
            "\n",
            "2. **Community Forum and Webinars:**\n",
            "   - The transcript suggests creating a community forum and hosting webinars as innovative feature ideas, but the PRD lists them under \"Prioritized Features for Next Update.\"\n",
            "\n",
            "3. **Enhanced Security Features:**\n",
            "   - The transcript mentions enhanced security features as an innovative idea by Grace, but the PRD lists them under \"Prioritized Features for Next Update.\"\n",
            "\n",
            "4. **User Preferences and Habits Integration:**\n",
            "   - The transcript mentions integrating user preferences and habits into the AI's memory as a suggestion by Carol, but the PRD lists it under \"Prioritized Features for Next Update.\"\n",
            "\n",
            "5. **Seasonal Themes and Limited-Edition Designs:**\n",
            "   - The transcript mentions seasonal themes and limited-edition designs as a suggestion by Eva, but the PRD lists them under \"Prioritized Features for Next Update.\"\n",
            "\n",
            "6. **Personalized Recommendations Based on Usage Patterns:**\n",
            "   - The transcript mentions personalized recommendations based on usage patterns as a suggestion by Frank, but the PRD lists it under \"Prioritized Features for Next Update.\"\n",
            "\n",
            "7. **Anonymize Data or Opt Out of Data Collection:**\n",
            "   - The transcript mentions allowing users to anonymize their data or opt out of certain data collection practices as a suggestion by Grace, but the PRD lists it under \"Prioritized Features for Next Update.\"\n",
            "\n",
            "By addressing these points, the PRD can be better aligned with the information provided in the transcript.\n",
            "\n",
            "Refining PRD...\n",
            "Refined PRD:\n",
            "# Product Requirements Document (PRD) for Le Chat\n",
            "\n",
            "## 1. Title\n",
            "Product Requirements Document for Le Chat AI Assistant\n",
            "\n",
            "## 2. Purpose\n",
            "The purpose of this PRD is to outline the requirements and features for the next update of Le Chat, our AI assistant. This document aims to address current strengths, areas for improvement, and innovative features to enhance user experience and engagement.\n",
            "\n",
            "## 3. Scope\n",
            "This PRD covers the following aspects of Le Chat:\n",
            "- Current strengths and areas for improvement\n",
            "- Prioritized features for the next update\n",
            "- Innovative feature ideas to set Le Chat apart from competitors\n",
            "\n",
            "## 4. Features and Requirements\n",
            "\n",
            "### Current Strengths\n",
            "- **Seamless Integration:** Le Chat works well across different devices and apps, with a stable API and positive feedback on ease of integration.\n",
            "- **Natural Language Processing:** Users appreciate the intuitive understanding of complex queries and personalized responses.\n",
            "- **User Engagement:** Personalization features drive higher retention rates and positive social media sharing.\n",
            "- **User Interface:** Clean and easy-to-navigate UI with well-received visual feedback and interactive elements.\n",
            "- **Data Analytics:** Increased user interactions and engagement metrics.\n",
            "- **Security:** Robust encryption protocols and positive feedback on privacy policies.\n",
            "- **Marketing Success:** A 30% increase in new user sign-ups due to the recent campaign highlighting Le Chat's adaptability.\n",
            "- **User Interaction Data:** Users are spending more time with Le Chat and exploring more features, indicating a strong resonance with the user base.\n",
            "\n",
            "### Areas for Improvement\n",
            "- **Latency Issues:** Optimize infrastructure to handle traffic spikes and reduce response times.\n",
            "- **AI Accuracy:** Improve AI’s understanding of context and sarcasm for better responses.\n",
            "- **Onboarding Process:** Create a smoother, more guided onboarding experience with interactive tutorials.\n",
            "- **Accessibility:** Conduct thorough accessibility testing and make necessary adjustments.\n",
            "- **Data Analysis Tools:** Improve tools for analyzing user feedback and feature usage.\n",
            "- **Incident Response:** Enhance incident response plan for swift and effective security issue resolution.\n",
            "- **In-App Messaging:** Improve in-app messaging to better communicate new features and updates.\n",
            "- **Data Visualization:** Enhance data visualization capabilities to communicate insights to the team.\n",
            "- **Regular Security Audits:** Implement regular security audits to stay vigilant against emerging threats.\n",
            "- **Bug Reporting:** Address bugs reported in the real-time update feature.\n",
            "\n",
            "### Prioritized Features for Next Update\n",
            "- **Real-Time Translation:** Enhance accuracy and speed in real-time translations and support more languages.\n",
            "- **Contextual Memory:** Improve AI’s ability to remember previous conversations for more relevant responses.\n",
            "- **Third-Party Integrations:** Integrate with popular productivity tools and explore partnerships with tech companies.\n",
            "- **Customizable Themes:** Allow users to personalize the look and feel of Le Chat.\n",
            "- **Advanced Analytics:** Provide users with insights into their interactions with Le Chat.\n",
            "- **Privacy Mode:** Allow users to control what data is stored and for how long.\n",
            "- **Community Forum:** Create a forum for users to share tips, tricks, and best practices.\n",
            "- **Webinars and Q&A Sessions:** Host regular webinars and Q&A sessions to engage with the user base.\n",
            "- **Enhanced Security Features:** Implement multi-factor authentication, biometric verification, and data access controls.\n",
            "- **User Preferences and Habits Integration:** Integrate user preferences and habits into the AI's memory to enhance personalization.\n",
            "- **Seasonal Themes and Limited-Edition Designs:** Explore seasonal themes and limited-edition designs to keep the UI fresh and exciting.\n",
            "- **Personalized Recommendations Based on Usage Patterns:** Allow users to track their most frequently asked questions, response times, and receive personalized recommendations.\n",
            "- **Anonymize Data or Opt Out of Data Collection:** Allow users to anonymize their data or opt out of certain data collection practices.\n",
            "\n",
            "### Innovative Feature Ideas\n",
            "- **Customizable AI Personality:** Allow users to choose between different personas for the AI.\n",
            "- **Dynamic Personas:** Introduce dynamic personas that adapt to the user’s mood or context.\n",
            "- **Creative Content Generation:** Enable Le Chat to generate poems, stories, or jokes based on user inputs.\n",
            "- **Collaborative Creative Projects:** Allow users to collaborate on creative projects, such as co-writing stories or creating art.\n",
            "- **Personalized Learning Experiences:** Offer language learning courses, coding tutorials, or educational games.\n",
            "- **Privacy Mode:** Allow users to control what data is stored and for how long.\n",
            "- **Community Forum and Webinars:** Create a community forum and host webinars to engage with the user base.\n",
            "- **Enhanced Security Features:** Implement multi-factor authentication, biometric verification, and data access controls.\n",
            "- **User Preferences and Habits Integration:** Integrate user preferences and habits into the AI's memory to enhance personalization.\n",
            "- **Seasonal Themes and Limited-Edition Designs:** Explore seasonal themes and limited-edition designs to keep the UI fresh and exciting.\n",
            "- **Personalized Recommendations Based on Usage Patterns:** Allow users to track their most frequently asked questions, response times, and receive personalized recommendations.\n",
            "- **Anonymize Data or Opt Out of Data Collection:** Allow users to anonymize their data or opt out of certain data collection practices.\n",
            "\n",
            "## 5. User Personas\n",
            "- **Tech-Savvy User:** Values seamless integration and advanced features.\n",
            "- **Casual User:** Appreciates intuitive interactions and personalized responses.\n",
            "- **Professional User:** Needs robust productivity tool integrations and advanced analytics.\n",
            "- **Creative User:** Enjoys generating and collaborating on creative content.\n",
            "- **Learner:** Seeks personalized learning experiences and educational content.\n",
            "- **Security-Conscious User:** Prioritizes data privacy and control over personal information.\n",
            "\n",
            "## 6. Technical Requirements\n",
            "- **Infrastructure Optimization:** Enhance server capabilities to handle peak usage times.\n",
            "- **AI Enhancements:** Improve natural language processing and contextual awareness.\n",
            "- **Accessibility Compliance:** Ensure Le Chat is usable by everyone, including those with disabilities.\n",
            "- **Data Analysis Tools:** Develop better tools for analyzing user feedback and feature usage.\n",
            "- **Security Measures:** Implement robust encryption protocols and regular security audits.\n",
            "\n",
            "## 7. Constraints\n",
            "- **Latency Issues:** Current infrastructure struggles with high demand during peak usage times.\n",
            "- **AI Limitations:** Difficulty understanding context and sarcasm in complex queries.\n",
            "- **Onboarding Complexity:** New users find the onboarding process overwhelming.\n",
            "- **Accessibility Gaps:** Need for thorough accessibility testing and adjustments.\n",
            "- **Data Analysis Tools:** Lack of advanced tools for analyzing user feedback and feature usage.\n",
            "- **Security Threats:** Need for vigilance against emerging threats and improved incident response.\n",
            "\n",
            "## 8. Success Metrics\n",
            "- **User Engagement:** Increase in user interactions and engagement metrics.\n",
            "- **Retention Rates:** Higher retention rates driven by personalization features.\n",
            "- **Positive Feedback:** Reduction in basic support queries and positive social media sharing.\n",
            "- **Feature Usage:** Increased exploration of features and positive feedback on new updates.\n",
            "- **Security Trust:** Positive feedback on privacy policies and data handling practices.\n",
            "- **Marketing Success:** A 30% increase in new user sign-ups due to the recent campaign highlighting Le Chat's adaptability.\n",
            "- **User Interaction Data:** Users are spending more time with Le Chat and exploring more features, indicating a strong resonance with the user base.\n",
            "\n",
            "## 9. Timeline and Milestones\n",
            "- **Immediate:** Compile insights into PRD and create engineering tickets for the next sprint.\n",
            "- **Short-Term:** Address latency issues, improve AI accuracy, and enhance the onboarding process.\n",
            "- **Mid-Term:** Implement prioritized features such as real-time translation, contextual memory, and third-party integrations.\n",
            "- **Long-Term:** Explore innovative feature ideas and continuously improve user experience and engagement.\n",
            "\n",
            "---\n",
            "\n",
            "This PRD serves as a comprehensive guide for the next update of Le Chat, ensuring that we address current challenges, prioritize key features, and innovate to stay ahead of the competition.\n",
            "\n",
            "Parsing PRD into actionable items...\n",
            "\n",
            "Creating Linear tickets...\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-97/infrastructure-optimization\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-98/ai-enhancements\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-99/accessibility-compliance\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-100/data-analysis-tools\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-101/security-measures\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-102/real-time-translation\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-103/contextual-memory\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-104/third-party-integrations\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-105/customizable-themes\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-106/advanced-analytics\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-107/privacy-mode\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-108/community-forum\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-109/webinars-and-qanda-sessions\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-110/enhanced-security-features\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-111/user-preferences-and-habits-integration\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-112/seasonal-themes-and-limited-edition-designs\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-113/personalized-recommendations-based-on-usage-patterns\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-114/anonymize-data-or-opt-out-of-data-collection\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-115/customizable-ai-personality\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-116/dynamic-personas\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-117/creative-content-generation\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-118/collaborative-creative-projects\n",
            "Created ticket: https://linear.app/mistralai/issue/MIS-119/personalized-learning-experiences\n"
          ]
        }
      ],
      "source": [
        "orchestrator = WorkflowOrchestrator(config, transcript)\n",
        "results = orchestrator.run()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "fICWV8HwH_XQ"
      },
      "source": [
        "### Understanding the Output\n",
        "The pipeline produces:\n",
        "1. A structured PRD\n",
        "2. List of features and descriptions\n",
        "3. Linear tickets with URLs"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "OHKyJ1QWH_XQ"
      },
      "source": [
        "#### PRD"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "kJ_8CaskH_XQ",
        "outputId": "3a7796a2-eb62-442d-82bc-8ec0708e82e2"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "# Product Requirements Document (PRD) for Le Chat\n",
            "\n",
            "## 1. Title\n",
            "Product Requirements Document for Le Chat AI Assistant\n",
            "\n",
            "## 2. Purpose\n",
            "The purpose of this PRD is to outline the requirements and features for the next update of Le Chat, our AI assistant. This document aims to address current strengths, areas for improvement, and innovative features to enhance user experience and engagement.\n",
            "\n",
            "## 3. Scope\n",
            "This PRD covers the following aspects of Le Chat:\n",
            "- Current strengths and areas for improvement\n",
            "- Prioritized features for the next update\n",
            "- Innovative feature ideas to set Le Chat apart from competitors\n",
            "\n",
            "## 4. Features and Requirements\n",
            "\n",
            "### Current Strengths\n",
            "- **Seamless Integration:** Le Chat works well across different devices and apps, with a stable API and positive feedback on ease of integration.\n",
            "- **Natural Language Processing:** Users appreciate the intuitive understanding of complex queries and personalized responses.\n",
            "- **User Engagement:** Personalization features drive higher retention rates and positive social media sharing.\n",
            "- **User Interface:** Clean and easy-to-navigate UI with well-received visual feedback and interactive elements.\n",
            "- **Data Analytics:** Increased user interactions and engagement metrics.\n",
            "- **Security:** Robust encryption protocols and positive feedback on privacy policies.\n",
            "- **Marketing Success:** A 30% increase in new user sign-ups due to the recent campaign highlighting Le Chat's adaptability.\n",
            "- **User Interaction Data:** Users are spending more time with Le Chat and exploring more features, indicating a strong resonance with the user base.\n",
            "\n",
            "### Areas for Improvement\n",
            "- **Latency Issues:** Optimize infrastructure to handle traffic spikes and reduce response times.\n",
            "- **AI Accuracy:** Improve AI’s understanding of context and sarcasm for better responses.\n",
            "- **Onboarding Process:** Create a smoother, more guided onboarding experience with interactive tutorials.\n",
            "- **Accessibility:** Conduct thorough accessibility testing and make necessary adjustments.\n",
            "- **Data Analysis Tools:** Improve tools for analyzing user feedback and feature usage.\n",
            "- **Incident Response:** Enhance incident response plan for swift and effective security issue resolution.\n",
            "- **In-App Messaging:** Improve in-app messaging to better communicate new features and updates.\n",
            "- **Data Visualization:** Enhance data visualization capabilities to communicate insights to the team.\n",
            "- **Regular Security Audits:** Implement regular security audits to stay vigilant against emerging threats.\n",
            "- **Bug Reporting:** Address bugs reported in the real-time update feature.\n",
            "\n",
            "### Prioritized Features for Next Update\n",
            "- **Real-Time Translation:** Enhance accuracy and speed in real-time translations and support more languages.\n",
            "- **Contextual Memory:** Improve AI’s ability to remember previous conversations for more relevant responses.\n",
            "- **Third-Party Integrations:** Integrate with popular productivity tools and explore partnerships with tech companies.\n",
            "- **Customizable Themes:** Allow users to personalize the look and feel of Le Chat.\n",
            "- **Advanced Analytics:** Provide users with insights into their interactions with Le Chat.\n",
            "- **Privacy Mode:** Allow users to control what data is stored and for how long.\n",
            "- **Community Forum:** Create a forum for users to share tips, tricks, and best practices.\n",
            "- **Webinars and Q&A Sessions:** Host regular webinars and Q&A sessions to engage with the user base.\n",
            "- **Enhanced Security Features:** Implement multi-factor authentication, biometric verification, and data access controls.\n",
            "- **User Preferences and Habits Integration:** Integrate user preferences and habits into the AI's memory to enhance personalization.\n",
            "- **Seasonal Themes and Limited-Edition Designs:** Explore seasonal themes and limited-edition designs to keep the UI fresh and exciting.\n",
            "- **Personalized Recommendations Based on Usage Patterns:** Allow users to track their most frequently asked questions, response times, and receive personalized recommendations.\n",
            "- **Anonymize Data or Opt Out of Data Collection:** Allow users to anonymize their data or opt out of certain data collection practices.\n",
            "\n",
            "### Innovative Feature Ideas\n",
            "- **Customizable AI Personality:** Allow users to choose between different personas for the AI.\n",
            "- **Dynamic Personas:** Introduce dynamic personas that adapt to the user’s mood or context.\n",
            "- **Creative Content Generation:** Enable Le Chat to generate poems, stories, or jokes based on user inputs.\n",
            "- **Collaborative Creative Projects:** Allow users to collaborate on creative projects, such as co-writing stories or creating art.\n",
            "- **Personalized Learning Experiences:** Offer language learning courses, coding tutorials, or educational games.\n",
            "- **Privacy Mode:** Allow users to control what data is stored and for how long.\n",
            "- **Community Forum and Webinars:** Create a community forum and host webinars to engage with the user base.\n",
            "- **Enhanced Security Features:** Implement multi-factor authentication, biometric verification, and data access controls.\n",
            "- **User Preferences and Habits Integration:** Integrate user preferences and habits into the AI's memory to enhance personalization.\n",
            "- **Seasonal Themes and Limited-Edition Designs:** Explore seasonal themes and limited-edition designs to keep the UI fresh and exciting.\n",
            "- **Personalized Recommendations Based on Usage Patterns:** Allow users to track their most frequently asked questions, response times, and receive personalized recommendations.\n",
            "- **Anonymize Data or Opt Out of Data Collection:** Allow users to anonymize their data or opt out of certain data collection practices.\n",
            "\n",
            "## 5. User Personas\n",
            "- **Tech-Savvy User:** Values seamless integration and advanced features.\n",
            "- **Casual User:** Appreciates intuitive interactions and personalized responses.\n",
            "- **Professional User:** Needs robust productivity tool integrations and advanced analytics.\n",
            "- **Creative User:** Enjoys generating and collaborating on creative content.\n",
            "- **Learner:** Seeks personalized learning experiences and educational content.\n",
            "- **Security-Conscious User:** Prioritizes data privacy and control over personal information.\n",
            "\n",
            "## 6. Technical Requirements\n",
            "- **Infrastructure Optimization:** Enhance server capabilities to handle peak usage times.\n",
            "- **AI Enhancements:** Improve natural language processing and contextual awareness.\n",
            "- **Accessibility Compliance:** Ensure Le Chat is usable by everyone, including those with disabilities.\n",
            "- **Data Analysis Tools:** Develop better tools for analyzing user feedback and feature usage.\n",
            "- **Security Measures:** Implement robust encryption protocols and regular security audits.\n",
            "\n",
            "## 7. Constraints\n",
            "- **Latency Issues:** Current infrastructure struggles with high demand during peak usage times.\n",
            "- **AI Limitations:** Difficulty understanding context and sarcasm in complex queries.\n",
            "- **Onboarding Complexity:** New users find the onboarding process overwhelming.\n",
            "- **Accessibility Gaps:** Need for thorough accessibility testing and adjustments.\n",
            "- **Data Analysis Tools:** Lack of advanced tools for analyzing user feedback and feature usage.\n",
            "- **Security Threats:** Need for vigilance against emerging threats and improved incident response.\n",
            "\n",
            "## 8. Success Metrics\n",
            "- **User Engagement:** Increase in user interactions and engagement metrics.\n",
            "- **Retention Rates:** Higher retention rates driven by personalization features.\n",
            "- **Positive Feedback:** Reduction in basic support queries and positive social media sharing.\n",
            "- **Feature Usage:** Increased exploration of features and positive feedback on new updates.\n",
            "- **Security Trust:** Positive feedback on privacy policies and data handling practices.\n",
            "- **Marketing Success:** A 30% increase in new user sign-ups due to the recent campaign highlighting Le Chat's adaptability.\n",
            "- **User Interaction Data:** Users are spending more time with Le Chat and exploring more features, indicating a strong resonance with the user base.\n",
            "\n",
            "## 9. Timeline and Milestones\n",
            "- **Immediate:** Compile insights into PRD and create engineering tickets for the next sprint.\n",
            "- **Short-Term:** Address latency issues, improve AI accuracy, and enhance the onboarding process.\n",
            "- **Mid-Term:** Implement prioritized features such as real-time translation, contextual memory, and third-party integrations.\n",
            "- **Long-Term:** Explore innovative feature ideas and continuously improve user experience and engagement.\n",
            "\n",
            "---\n",
            "\n",
            "This PRD serves as a comprehensive guide for the next update of Le Chat, ensuring that we address current challenges, prioritize key features, and innovate to stay ahead of the competition.\n"
          ]
        }
      ],
      "source": [
        "print(results[\"prd\"])"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "AN7ZqJG1H_XQ"
      },
      "source": [
        "#### Features"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "4PQPT_2OH_XQ",
        "outputId": "c270aa77-4b79-4364-c856-d4209b36a074"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "\n",
            "Feature: Infrastructure Optimization\n",
            "Description: Enhance server capabilities to handle peak usage times.\n",
            "\n",
            "Feature: AI Enhancements\n",
            "Description: Improve natural language processing and contextual awareness.\n",
            "\n",
            "Feature: Accessibility Compliance\n",
            "Description: Ensure Le Chat is usable by everyone, including those with disabilities.\n",
            "\n",
            "Feature: Data Analysis Tools\n",
            "Description: Develop better tools for analyzing user feedback and feature usage.\n",
            "\n",
            "Feature: Security Measures\n",
            "Description: Implement robust encryption protocols and regular security audits.\n",
            "\n",
            "Feature: Real-Time Translation\n",
            "Description: Enhance accuracy and speed in real-time translations and support more languages.\n",
            "\n",
            "Feature: Contextual Memory\n",
            "Description: Improve AI’s ability to remember previous conversations for more relevant responses.\n",
            "\n",
            "Feature: Third-Party Integrations\n",
            "Description: Integrate with popular productivity tools and explore partnerships with tech companies.\n",
            "\n",
            "Feature: Customizable Themes\n",
            "Description: Allow users to personalize the look and feel of Le Chat.\n",
            "\n",
            "Feature: Advanced Analytics\n",
            "Description: Provide users with insights into their interactions with Le Chat.\n",
            "\n",
            "Feature: Privacy Mode\n",
            "Description: Allow users to control what data is stored and for how long.\n",
            "\n",
            "Feature: Community Forum\n",
            "Description: Create a forum for users to share tips, tricks, and best practices.\n",
            "\n",
            "Feature: Webinars and Q&A Sessions\n",
            "Description: Host regular webinars and Q&A sessions to engage with the user base.\n",
            "\n",
            "Feature: Enhanced Security Features\n",
            "Description: Implement multi-factor authentication, biometric verification, and data access controls.\n",
            "\n",
            "Feature: User Preferences and Habits Integration\n",
            "Description: Integrate user preferences and habits into the AI's memory to enhance personalization.\n",
            "\n",
            "Feature: Seasonal Themes and Limited-Edition Designs\n",
            "Description: Explore seasonal themes and limited-edition designs to keep the UI fresh and exciting.\n",
            "\n",
            "Feature: Personalized Recommendations Based on Usage Patterns\n",
            "Description: Allow users to track their most frequently asked questions, response times, and receive personalized recommendations.\n",
            "\n",
            "Feature: Anonymize Data or Opt Out of Data Collection\n",
            "Description: Allow users to anonymize their data or opt out of certain data collection practices.\n",
            "\n",
            "Feature: Customizable AI Personality\n",
            "Description: Allow users to choose between different personas for the AI.\n",
            "\n",
            "Feature: Dynamic Personas\n",
            "Description: Introduce dynamic personas that adapt to the user’s mood or context.\n",
            "\n",
            "Feature: Creative Content Generation\n",
            "Description: Enable Le Chat to generate poems, stories, or jokes based on user inputs.\n",
            "\n",
            "Feature: Collaborative Creative Projects\n",
            "Description: Allow users to collaborate on creative projects, such as co-writing stories or creating art.\n",
            "\n",
            "Feature: Personalized Learning Experiences\n",
            "Description: Offer language learning courses, coding tutorials, or educational games.\n"
          ]
        }
      ],
      "source": [
        "for feature, desc in zip(\n",
        "    results[\"parsed_items\"][\"Features\"],\n",
        "    results[\"parsed_items\"][\"DescriptionOfFeatures\"]\n",
        "):\n",
        "    print(f\"\\nFeature: {feature}\")\n",
        "    print(f\"Description: {desc}\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "J4gZnCBLH_XR"
      },
      "source": [
        "#### Linear Tickets Created"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 14,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "KwSW8JqFH_XR",
        "outputId": "99d77c0c-601f-427c-80a6-8a30f44f24ca"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "{'issueCreate': {'success': True, 'issue': {'id': '70d16cf3-6785-4255-abe8-df0968af0c60', 'url': 'https://linear.app/mistralai/issue/MIS-97/infrastructure-optimization'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': 'b2e26ce9-a8dd-4e9f-9b3d-a2780a13b706', 'url': 'https://linear.app/mistralai/issue/MIS-98/ai-enhancements'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': 'e993f7e4-4bd6-49c8-870e-3b6c09defde1', 'url': 'https://linear.app/mistralai/issue/MIS-99/accessibility-compliance'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '0f6c4720-e839-460b-a292-bdba21840b15', 'url': 'https://linear.app/mistralai/issue/MIS-100/data-analysis-tools'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '93ec2588-8446-4605-9d12-01276ac43cfd', 'url': 'https://linear.app/mistralai/issue/MIS-101/security-measures'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '5b78d122-ba0c-4ff5-a926-66f56a6182aa', 'url': 'https://linear.app/mistralai/issue/MIS-102/real-time-translation'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '6e95d855-ca38-4ebd-838d-0e77e767217a', 'url': 'https://linear.app/mistralai/issue/MIS-103/contextual-memory'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': 'd686258b-ace2-47f6-b9b5-b0b6b2b8765f', 'url': 'https://linear.app/mistralai/issue/MIS-104/third-party-integrations'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': 'aa2802bd-37db-40b2-a0f1-63a90503459b', 'url': 'https://linear.app/mistralai/issue/MIS-105/customizable-themes'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '7e1f678a-8ba8-462f-9503-0cffa1fbeaa0', 'url': 'https://linear.app/mistralai/issue/MIS-106/advanced-analytics'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '6a364044-65cc-4a04-9032-5b717f8f74d7', 'url': 'https://linear.app/mistralai/issue/MIS-107/privacy-mode'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '92c03d9f-a99d-447c-bd6a-8123ae61afee', 'url': 'https://linear.app/mistralai/issue/MIS-108/community-forum'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': 'ba48ed9e-ee46-4e60-80dd-4dc05146141f', 'url': 'https://linear.app/mistralai/issue/MIS-109/webinars-and-qanda-sessions'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '143a64ae-d6a4-46a7-a031-7800c44a3769', 'url': 'https://linear.app/mistralai/issue/MIS-110/enhanced-security-features'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '73d73ee0-7bda-4129-85fe-89a45875cb98', 'url': 'https://linear.app/mistralai/issue/MIS-111/user-preferences-and-habits-integration'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': 'b1a011eb-ce6c-4561-a445-500cf33703fa', 'url': 'https://linear.app/mistralai/issue/MIS-112/seasonal-themes-and-limited-edition-designs'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '1a515547-c98a-49f6-862b-df3d48da75e6', 'url': 'https://linear.app/mistralai/issue/MIS-113/personalized-recommendations-based-on-usage-patterns'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': 'd6dc8224-ce9c-4b4a-88c8-31cd21fa0db2', 'url': 'https://linear.app/mistralai/issue/MIS-114/anonymize-data-or-opt-out-of-data-collection'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '66d20297-c4cc-45fa-ab97-30790bfe9c99', 'url': 'https://linear.app/mistralai/issue/MIS-115/customizable-ai-personality'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '07b02193-d313-4624-81c2-4b5a53fc4c18', 'url': 'https://linear.app/mistralai/issue/MIS-116/dynamic-personas'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': 'f95a583c-16b3-47a3-9b85-c0ad14e25999', 'url': 'https://linear.app/mistralai/issue/MIS-117/creative-content-generation'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': '98a6f432-6833-4e23-90d5-8085b72b5b0f', 'url': 'https://linear.app/mistralai/issue/MIS-118/collaborative-creative-projects'}}}\n",
            "{'issueCreate': {'success': True, 'issue': {'id': 'db9a89a1-4d9c-40b7-8c46-0ebb900b739e', 'url': 'https://linear.app/mistralai/issue/MIS-119/personalized-learning-experiences'}}}\n"
          ]
        }
      ],
      "source": [
        "for result in results[\"ticket_results\"]:\n",
        "    print(result)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "5MHur9_XH_XR"
      },
      "source": [
        "#### Here is a sample image showing how the tickets will be created in the Linear UI. (The tickets will vary based on the transcript.)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "GT9JbCiBH_XR"
      },
      "source": [
        "![LinearTicket](https://github.com/mistralai/cookbook/blob/main/mistral/agents/transcript_linearticket_agent/linear_tickets.png?raw=1)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "onJIvYPsH_XR"
      },
      "source": [
        "### Next Steps\n",
        "You can extend this pipeline by:\n",
        "1. Adding priority levels to tickets.\n",
        "2. Including custom fields in Linear tickets.\n",
        "3. Incorporate similar pipeline with Jira."
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "mistral",
      "language": "python",
      "name": "mistral"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.9.6"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}