Skip to content

Feedback: guides-past-response-prompts

Original URL: https://www.assemblyai.com/docs/guides/past-response-prompts
Category: guides
Generated: 05/08/2025, 4:38:51 pm


Generated: 05/08/2025, 4:38:50 pm

Technical Documentation Analysis: Pass Context from Previous LeMUR Requests

Section titled “Technical Documentation Analysis: Pass Context from Previous LeMUR Requests”

This documentation provides a functional guide but has several significant gaps that could frustrate users and limit adoption. The core concept is clear, but execution lacks depth and polish expected for developer documentation.

Problem: Several key technical details are absent or unclear.

Specific Issues:

  • No error handling examples or common error scenarios
  • Missing information about token limits and cost implications
  • No explanation of context window limitations
  • Undefined behavior when context becomes too large

Recommendations:

# Add error handling example
try:
result = transcript.lemur.task(initial_prompt)
if len(result.response) == 0:
print("Warning: Empty response received")
except assemblyai.LemurError as e:
print(f"LeMUR API error: {e}")
except Exception as e:
print(f"Unexpected error: {e}")

Add a section on Token Management:

  • Explain approximate token costs
  • Show how to estimate context size
  • Provide context truncation strategies

Current Issues:

  • Quickstart section duplicates Getting Started content
  • No clear learning progression
  • Missing prerequisites section

Recommended Structure:

# Pass Context from Previous LeMUR Requests
## Overview
[Brief explanation + use cases]
## Prerequisites
- AssemblyAI account and API key
- Python 3.7+
- Basic familiarity with LeMUR
## Quick Example
[Minimal working example - 10 lines max]
## Step-by-Step Implementation
[Current "Getting Started" content, improved]
## Advanced Usage
[Context management, error handling, optimization]
## Troubleshooting
[Common issues and solutions]
## Related Resources
[Links to other relevant docs]

Problems:

  • Inconsistent model usage (Haiku recommended, but Sonnet used in code)
  • Magic strings and hardcoded values
  • No input validation

Improved Code Example:

import assemblyai
from typing import List
class LeMURConversation:
def __init__(self, api_key: str, model: assemblyai.LemurModel = assemblyai.LemurModel.claude3_haiku):
assemblyai.settings.api_key = api_key
self.transcriber = assemblyai.Transcriber()
self.model = model
self.context_history: List[str] = []
self.max_context_length = 4000 # tokens
def transcribe_audio(self, audio_source: str):
"""Transcribe audio file or URL"""
try:
return self.transcriber.transcribe(audio_source)
except Exception as e:
raise Exception(f"Transcription failed: {e}")
def ask_question(self, prompt: str, transcript) -> str:
"""Ask a question with context from previous responses"""
# Manage context size
context = self._get_managed_context()
if context:
full_prompt = f"{prompt} (Previous context: {context})"
else:
full_prompt = prompt
try:
result = transcript.lemur.task(full_prompt, final_model=self.model)
self.context_history.append(result.response)
return result.response
except Exception as e:
raise Exception(f"LeMUR request failed: {e}")
def _get_managed_context(self) -> str:
"""Get context while managing token limits"""
context = " ".join(self.context_history)
# Simple truncation - could be more sophisticated
if len(context) > self.max_context_length:
context = context[-self.max_context_length:]
return context

Current Issues:

  • No guidance on effective prompt writing
  • Missing examples of good vs. poor follow-up questions
  • No explanation of when this approach is most useful

Recommendations:

Add Best Practices Section:

## Best Practices
### Effective Follow-up Questions
**Good**: "What was Jenna's recovery timeline?"
**Poor**: "Tell me everything about her"
### When to Use Context Passing
- **Ideal for**: Character development, multi-step analysis, iterative refinement
- **Not ideal for**: Simple one-off questions, completely unrelated queries
### Managing Conversation Flow
- Keep individual responses focused
- Periodically summarize to compress context
- Reset context for new topics

Add Multiple Scenarios:

# Example 1: Meeting Analysis
initial_prompt = "Summarize the key decisions made in this meeting"
follow_up = "Who was responsible for each decision?"
# Example 2: Content Analysis
initial_prompt = "What are the main themes in this podcast?"
follow_up = "Which theme appeared most frequently?"
# Example 3: Educational Content
initial_prompt = "Explain the medical concepts discussed"
follow_up = "Which concept would be hardest for a beginner to understand?"

Problems:

  • Inconsistent model recommendations
  • No mention of rate limits
  • Missing API version compatibility

Fixes:

  • Align model recommendations throughout
  • Add rate limiting guidance
  • Specify SDK version compatibility
  • Include links to API reference documentation
  1. High Priority: Add error handling and input validation
  2. High Priority: Fix model consistency issues
  3. Medium Priority: Restructure content organization
  4. Medium Priority: Add context management strategies
  5. Low Priority: Expand examples and use cases
  • Add a troubleshooting section with common errors
  • Include performance tips for large conversations
  • Provide cost estimation guidance
  • Add links to related documentation (LeMUR basics, model selection)
  • Consider adding a video walkthrough or interactive demo

This documentation has good bones but needs significant enhancement to meet professional developer documentation standards. The improvements above would transform it from a basic code example into a comprehensive, user-friendly guide.