Repository navigation
Description
Context
Omi extracts action items from conversations using LLMs. However, if a conversation is processed without calendar context, the LLM has to parse transcripts with generic labels like "Speaker 0" or "Speaker 1". The extraction engine currently cannot associate these labels with actual user identities, causing two primary issues:
- Vague Action Items: The LLM writes tasks without specific ownership (e.g. "Send the quarterly sales report") rather than attributing them correctly (e.g. "Send report to John").
- Attribution Errors: The LLM frequently extracts tasks assigned to other participants because it cannot distinguish the primary user from the other speakers.
In real-world usage, as shown in user transcription feeds, the app groups audio segments into generic speaker blocks like Speaker 1, Speaker 2, and Speaker 3. Because the LLM has no knowledge of who these speakers represent in relation to the primary user, it cannot reliably target the user's actual tasks.
Important Note: While the screenshot illustrates this in the mobile app UI, the solution must be entirely backend-driven and platform-agnostic. Do not build any dependencies on client-side screen layout or UI state.
Visual Comparison: Anonymized vs. Grounded Extraction
graph TD
subgraph "1. Anonymized Extraction (Current: No Identity Anchoring)"
T1["Transcript: Speaker 0 / Speaker 1"] --> LLM1{LLM Chainer}
LLM1 --> Task1[Task: Send report - Unattributed]
end
subgraph "2. Grounded Extraction (Proposed: Specific Identity Context)"
T2["Transcript: Soham / John"] --> LLM2{LLM Chainer}
Context["Context: Primary User is Soham"] --> LLM2
LLM2 --> Task2[Task: Follow up with John on report]
end
Root Cause Analysis
In backend/utils/conversations/process_conversation.py, the user's name is retrieved and passed into get_transcript() to construct the transcript text:
user_name = get_user_name(uid, use_default=False)
transcript_text = conversation.get_transcript(False, people=people, user_name=user_name)This maps the primary user's segments to their name (e.g., "Soham") and matches other segments to known contact names (e.g., "Sarah").
However, extract_action_items in backend/utils/llm/conversation_processing.py does not receive the resolved user_name. The system prompt asks the LLM to identify the primary user "based on conversational context." This is highly error-prone, resulting in generic task lists with poor ownership tracking.
Solution Design & Technical Specs
We pass the resolved primary user identity directly into the LLM extraction prompt, enabling precise task ownership mapping.
1. Updated Call Signature (backend/utils/llm/conversation_processing.py)
Add an optional user_name parameter to the function signature to maintain 100% backward compatibility:
def extract_action_items(
transcript: str,
started_at: datetime,
language_code: str,
tz: str,
photos: List[ConversationPhoto] = None,
existing_action_items: List[dict] = None,
calendar_meeting_context: 'CalendarMeetingContext' = None,
output_language_code: str = None,
user_name: Optional[str] = 'User',
)2. Context Grounded LLM Prompt System Template
Inject {user_name} directly into the prompt system templates:
CRITICAL CONTEXT:
• These action items are primarily for the PRIMARY USER, named "{user_name}", who is having/recording this conversation.
• Focus on tasks "{user_name}" needs to track, act upon, or follow up on.
• Include tasks for OTHER people ONLY if:
- "{user_name}" is dependent on that task being completed.
- "{user_name}" needs to follow up on it.And in the strict filtering rules:
1. **Clear Ownership & Relevance**:
- The primary user is "{user_name}". Focus on what "{user_name}" needs to do.
- For tasks assigned to "{user_name}": phrase them directly (start with verb).3. Forward Name in Caller Loop (backend/utils/conversations/process_conversation.py)
Retrieve the user_name display parameter at the top of the conversation loop and forward it down to all extract_action_items calls:
user_name = get_user_name(uid, use_default=False)
...
with track_usage(uid, Features.CONVERSATION_ACTION_ITEMS):
structured.action_items = extract_action_items(
transcript_text,
conversation.started_at,
language_code,
tz,
photos=conversation.photos,
existing_action_items=_fetch_dedup_candidates(uid, structured),
calendar_meeting_context=calendar_context,
output_language_code=user_language,
user_name=user_name,
)Karpathy Guidelines for Implementation
- Surgical Edits: Restrict edits to the
extract_action_itemsprompt logic inbackend/utils/llm/conversation_processing.pyand the forwarding calls inbackend/utils/conversations/process_conversation.py. Do not touch adjacent summarization or categorisation prompts. - Simplicity First: Do not add speculative parameters or configurable profiles. Use simple placeholder interpolation.
- Goal-Driven Verification: Ensure all local test suites run and pass. Run verification commands explicitly:
python -m pytest backend/tests/unit/test_action_item_date_validation.py
Verification Plan
- Run unit tests verifying date extraction and prompt parsing:
pytest tests/unit/test_action_item_date_validation.py - Verify task attribution with test inputs containing multiple names.
Activity
[-]Grounded User Identity for Precise Smart Action Item Extraction[/-][+]Backend: Ground speaker labels with voice profiles for precise action item extraction (#5474)[/+]