Add tiered summarization based on pricing plans

- Implement advanced AI summarization with action items for Pro plan
- Create basic bullet-point summarization for Freemium plan
- Add plan tier validation and feature differentiation
- Support speaker identification in transcripts
- Define plan limits (600 mins Pro/200 mins Freemium)
This commit is contained in:
Michael Ikehi
2025-04-24 17:18:53 +01:00
parent 316e82b6cf
commit a91613efe2
6 changed files with 270 additions and 73 deletions
+47 -18
View File
@@ -33,11 +33,12 @@ Transcribes audio or video content from a URL.
```json
{
"media_url": "https://example.com/audio-file.mp3",
"media_type": "audio" // "audio" or "video"
"media_type": "audio", // "audio" or "video"
"plan_tier": "freemium" // "freemium" or "pro" (optional, defaults to "freemium")
}
```
**Response:**
**Pro Plan Response (with speaker identification):**
```json
{
@@ -45,7 +46,33 @@ Transcribes audio or video content from a URL.
"sentences": [
{
"sentence": "Hello and welcome to the meeting.",
"speaker": "speaker_0",
"speaker": "speaker_0", // Speaker identification included
"start": 0.0,
"end": 2.5,
"words": [
{
"word": "Hello",
"start": 0.0,
"end": 0.4
},
// Additional words...
]
},
// Additional sentences...
]
}
}
```
**Freemium Plan Response (without speaker identification):**
```json
{
"transcript": {
"sentences": [
{
"sentence": "Hello and welcome to the meeting.",
// No "speaker" field in freemium plan
"start": 0.0,
"end": 2.5,
"words": [
@@ -271,14 +298,15 @@ headers = {
"Content-Type": "application/json"
}
# 1. Transcribe an audio file
# 1. Transcribe an audio file (Pro plan with speaker identification)
transcribe_payload = {
"media_url": "https://example.com/meeting-recording.mp3",
"media_type": "audio"
"media_type": "audio",
"plan_tier": "pro" # Specify "pro" for speaker identification or "freemium" for no speakers
}
transcribe_response = requests.post(
f"{base_url}/microdot-ai/transcribe",
f"{base_url}/microdot-ai/transcribe",
headers=headers,
json=transcribe_payload
)
@@ -287,19 +315,19 @@ transcribe_response = requests.post(
if transcribe_response.status_code == 200:
transcript_data = transcribe_response.json()
transcript_json = json.dumps(transcript_data["transcript"])
# 2. Generate a summary (Pro plan)
summary_payload = {
"transcript": transcript_json,
"plan_tier": "pro"
}
summary_response = requests.post(
f"{base_url}/microdot-ai/general-summary",
f"{base_url}/microdot-ai/general-summary",
headers=headers,
json=summary_payload
)
if summary_response.status_code == 200:
summary_data = summary_response.json()
print("Summary generated successfully!")
@@ -316,7 +344,7 @@ else:
const axios = require('axios');
// API endpoint
const baseUrl = 'https://api.microdot.ai';
const baseUrl = 'http://0.0.0.0:5056';
// Your API key
const apiKey = 'your_api_key_here';
@@ -331,34 +359,35 @@ const headers = {
const transcribeAudio = async () => {
const transcribePayload = {
media_url: 'https://example.com/meeting-recording.mp3',
media_type: 'audio'
media_type: 'audio',
plan_tier: 'pro' // Specify 'pro' for speaker identification or 'freemium' for no speakers
};
try {
const transcribeResponse = await axios.post(
`${baseUrl}/microdot-ai/transcribe`,
transcribePayload,
{ headers }
);
const transcriptData = transcribeResponse.data;
const transcriptJson = JSON.stringify(transcriptData.transcript);
// 2. Generate a summary (Pro plan)
const summaryPayload = {
transcript: transcriptJson,
plan_tier: 'pro'
};
const summaryResponse = await axios.post(
`${baseUrl}/microdot-ai/general-summary`,
summaryPayload,
{ headers }
);
console.log('Summary generated successfully!');
console.log(JSON.stringify(summaryResponse.data.transcript, null, 2));
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
}