{ "openapi": "3.1.0", "info": { "title": "M-Path", "description": "Automatic Speech Recognition and Voice Emotion Recognition", "version": "dev" }, "paths": { "/api/v1/offline/processing": { "post": { "tags": ["Processing"], "summary": "Analyze Single File", "description": "For the best results, use audio files with a sample rate of 16 kHz and 16 bits per sample.", "operationId": "analyze_single_file", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Pipeline" } } }, "required": true }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ResultId" } } } }, "422": { "description": "Validation Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/HTTPValidationError" } } } } }, "security": [ { "HTTPBearer": [] } ] } }, "/api/v1/offline/processing/{result_id}": { "get": { "tags": ["Processing"], "summary": "Get Analysis Result", "description": "Retrieve the analysis results for a given result_id", "operationId": "get_analysis_result", "parameters": [ { "name": "result_id", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Result" } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorModel" } } } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorModel" } } } }, "425": { "description": "Too Early", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorModel" } } } } }, "security": [ { "HTTPBearer": [] } ] } } }, "components": { "schemas": { "Pipeline": { "type": "object", "description": "Main configuration for audio processing", "required": ["config", "audio"], "properties": { "config": { "$ref": "#/components/schemas/RecognitionConfig" }, "audio": { "$ref": "#/components/schemas/RecognitionAudio" }, "call_data": { "$ref": "#/components/schemas/RecognitionMeta", "default": {} } }, "example": { "config": { "language_code": "en-US", "insights": { "summary": { "prompt_customization": "Focus on key points and action items" }, "sentiment": {}, "topics": {} } }, "audio": { "uri": "https://example.com/audio.wav" } } }, "RecognitionConfig": { "type": "object", "description": "Configuration for audio processing pipeline", "properties": { "language_code": { "type": "string", "enum": ["en-US", "he-IL", "hi-IN", "es-ES", "fr-FR", "de-DE", "it-IT"], "title": "Language Code", "default": "en-US", "description": "Primary language of the audio file" }, "transcript_model": { "type": "string", "enum": ["openai_whisper"], "title": "Transcript Model", "default": "openai_whisper", "description": "Speech-to-text model to use for transcription" }, "emotions_model": { "type": "string", "enum": ["emotions", null], "title": "Emotions Model", "default": "emotions", "description": "Model to use for emotion detection. Set to null to disable" }, "emotions_alignment": { "type": "boolean", "title": "Emotions Alignment", "default": false, "description": "Enable temporal alignment of emotions with speech" }, "emotions_diarization": { "type": "boolean", "title": "Emotions Diarization", "default": false, "description": "Enable speaker-based emotion diarization" }, "channels": { "type": "integer", "enum": [1, 2], "title": "Channels", "default": 2, "description": "Number of audio channels (1 for mono, 2 for stereo)" }, "insights": { "type": "object", "description": "Configure which insights to generate and their options", "properties": { "agent_actions": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for agent actions analysis", "default": "" } } }, "csat": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for CSAT analysis", "default": "" } } }, "customer_requests": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for customer requests analysis", "default": "" } } }, "division": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for conversation division analysis", "default": "" } } }, "keywords": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for keywords extraction", "default": "" } } }, "label": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for labeling", "default": "" }, "labels": { "type": "array", "items": { "type": "string" }, "description": "List of labels to classify the conversation" } } }, "problems": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for problems detection", "default": "" } } }, "questions": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for questions analysis", "default": "" } } }, "sentiment": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for sentiment analysis", "default": "" } } }, "summary": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for summary generation", "default": "" } } }, "topics": { "type": "object", "properties": { "prompt_customization": { "type": "string", "description": "Custom prompt for topics extraction", "default": "" } } } }, "default": {} }, "webhook": { "type": "string", "format": "uri", "title": "Webhook", "description": "URL to receive processing results when complete", "nullable": true, "default": null } } }, "RecognitionAudio": { "type": "object", "description": "Audio file information", "required": ["uri"], "properties": { "uri": { "type": "string", "format": "uri", "title": "URI", "description": "Publicly accessible URL to the audio file" } } }, "RecognitionMeta": { "type": "object", "description": "Optional metadata about the call", "properties": { "id": { "type": "string", "title": "ID", "description": "Your internal identifier for this call" }, "timestamp": { "type": "string", "format": "date-time", "title": "Timestamp", "description": "When the call occurred" }, "speakers": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Speaker identifier" }, "label": { "type": "string", "description": "Display name for the speaker" }, "role": { "type": "string", "enum": ["agent", "customer"], "description": "Role of the speaker" } }, "required": ["id", "role"] }, "description": "Information about speakers in the call" } } }, "ResultId": { "type": "object", "properties": { "result_id": { "type": "string", "title": "Result ID", "description": "Identifier to retrieve the analysis results" } } }, "Result": { "type": "object", "properties": { "status": { "type": "string", "enum": ["pending", "processing", "completed", "failed"], "description": "Current status of the analysis" }, "progress": { "type": "number", "minimum": 0, "maximum": 100, "description": "Processing progress percentage" }, "result": { "type": "object", "description": "Analysis results when processing is complete" }, "error": { "type": "string", "description": "Error message if processing failed" } } }, "ErrorModel": { "type": "object", "properties": { "code": { "type": "string", "description": "Error code" }, "message": { "type": "string", "description": "Error message" } } }, "HTTPValidationError": { "type": "object", "properties": { "detail": { "type": "array", "items": { "$ref": "#/components/schemas/ValidationError" } } } }, "ValidationError": { "type": "object", "properties": { "loc": { "type": "array", "items": { "anyOf": [ { "type": "string" }, { "type": "integer" } ] } }, "msg": { "type": "string" }, "type": { "type": "string" } } } }, "securitySchemes": { "HTTPBearer": { "type": "http", "scheme": "bearer" } } } }