vCon Library Guide for LLMs

Stick this in your robot's context window.

This guide provides a comprehensive overview of the vCon (Virtual Conversation) Python library, designed specifically for Large Language Models (LLMs) that need to generate or modify code using this library.

Overview

The vCon library is a Python implementation of the vCon 0.3.0 specification for structuring, managing, and manipulating conversation data in a standardized format. It enables the creation, validation, and manipulation of digital representations of conversations with rich metadata, supporting all modern conversation features including multimedia content, security, and extensibility.

Key Concepts

  • vCon Container: The primary object that holds all conversation data

  • Parties: Participants in a conversation (callers, agents, bots) with contact information

  • Dialogs: Individual messages or segments of the conversation (text, audio, video, etc.)

  • Attachments: Additional files or data associated with the conversation

  • Analysis: Results from processing the conversation (sentiment analysis, transcription, etc.)

  • Extensions: Optional features that extend the base vCon functionality

    • Lawful Basis Extension: GDPR-compliant consent management and privacy compliance

    • WTF Extension: World Transcription Format for standardized speech-to-text data

  • Digital Signatures: Cryptographic verification of vCon integrity

  • Civic Addresses: Location information for parties using GEOPRIV standard

  • Party History: Event tracking for multi-party conversations

Installation

Requirements

  • Python 3.12+

  • Core dependencies: authlib, uuid6, requests, pydash, python-dateutil

  • Optional: mutagen (audio metadata), ffmpeg (video processing), Pillow (image processing), PyPDF (PDF processing)

Core Classes and Usage Patterns

1. Vcon Class

The main container for all conversation data.

Creating a vCon

Saving and Exporting

Properties

2. Party Class

Represents a participant in the conversation.

Party Attributes

Core Contact Information:

  • tel: Telephone number (e.g., "+1234567890")

  • name: Display name (e.g., "Alice Smith")

  • role: Role in conversation ("caller", "agent", "bot", etc.)

  • mailto: Email address (e.g., "[email protected]")

Advanced Contact Methods (vCon 0.3.0):

  • sip: SIP URI for VoIP communication (e.g., "sip:[email protected]")

  • did: Decentralized Identifier for blockchain-based identity

  • jCard: vCard format contact information (RFC 7095)

  • timezone: Party's timezone (e.g., "America/New_York")

Location and Validation:

  • civicaddress: Civic address using CivicAddress class (GEOPRIV format)

  • gmlpos: GML position coordinates

  • validation: Validation status

  • stir: STIR verification for secure telephony

Metadata:

  • uuid: Unique identifier for the party

  • contact_list: Reference to contact list

  • meta: Additional metadata dictionary

  • Custom attributes can be added via kwargs

3. Dialog Class

Represents a message or segment in the conversation.

Special Dialog Types

Dialog Type Methods

Dialog Types and MIME Types

Valid Dialog Types:

  • "text": Text-based communication (chat, SMS, email)

  • "recording": Audio/video recording

  • "transfer": Call transfer operation

  • "incomplete": Failed or incomplete conversation setup

  • "audio": Audio content

  • "video": Video content

Supported MIME Types:

Text:

  • text/plain

Audio:

  • audio/x-wav, audio/wav, audio/wave

  • audio/mpeg, audio/mp3, audio/x-mp3

  • audio/x-mp4, audio/ogg, audio/webm

  • audio/x-m4a, audio/aac

Video:

  • video/x-mp4, video/mp4, video/ogg

  • video/quicktime, video/webm

  • video/x-msvideo, video/x-matroska

  • video/mpeg, video/x-flv, video/3gpp, video/x-m4v

Other:

  • multipart/mixed

  • message/rfc822 (for email)

  • application/json (for signaling data)

  • image/jpeg, image/tiff, application/pdf

4. Working with Tags

Tags are key-value pairs for simple metadata.

5. Working with Attachments

Attachments are arbitrary data associated with the conversation.

6. Working with Analysis

Analysis entries represent insights derived from dialog.

7. Extensions and Must-Support (vCon 0.3.0)

Extensions allow vCons to declare optional features they use, while must-support indicates required features.

7.1. Lawful Basis Extension

The Lawful Basis extension provides comprehensive support for privacy compliance and consent management according to GDPR and other privacy regulations.

Key Features

  • Multiple Lawful Basis Types: consent, contract, legal_obligation, vital_interests, public_task, legitimate_interests

  • Purpose-Specific Permissions: Granular permission grants with conditions

  • Cryptographic Proof Mechanisms: Verbal confirmation, signed documents, cryptographic signatures, external systems

  • Temporal Validity: Expiration dates and status intervals

  • Content Integrity: Hash validation and canonicalization

  • External Registry Integration: SCITT (Supply Chain Integrity, Transparency, and Trust) support

Adding Lawful Basis Attachments

Checking Permissions

Finding Lawful Basis Attachments

Advanced Lawful Basis Features

7.2. WTF (World Transcription Format) Extension

The WTF extension provides standardized representation of speech-to-text transcription data from multiple providers.

Key Features

  • Multi-Provider Support: Whisper, Deepgram, AssemblyAI, Google, Amazon, Azure, and more

  • Standardized Format: Hierarchical structure with transcripts, segments, words, and speakers

  • Quality Metrics: Audio quality assessment and confidence scoring

  • Export Capabilities: SRT and WebVTT subtitle formats

  • Provider Adapters: Automatic conversion from provider-specific formats

  • Analysis Tools: Keyword extraction, confidence analysis, and transcription comparison

Adding WTF Transcription Attachments

Finding WTF Attachments

Exporting Transcriptions

Provider Data Conversion

Advanced WTF Features

Analysis Tools

7.3. Extension Validation and Processing

8. Civic Address Support (vCon 0.3.0)

Civic addresses provide location information for parties using the GEOPRIV standard.

9. Party History Events (vCon 0.3.0)

Track when parties join, leave, or change state during conversations.

10. Advanced Dialog Features (vCon 0.3.0)

New dialog fields for enhanced functionality.

Signing and Verification

Validation

Common Patterns and Best Practices

1. Creating a Complete Conversation

2. Working with Audio Content

3. External vs Inline Content

4. Video Content Handling

5. Image Content Handling

6. Content Hashing and Integrity

Error Handling

Working with Property Handling Modes

The Vcon constructor accepts a property_handling parameter to control how non-standard properties are handled:

LLM-Specific Patterns and Best Practices

1. Code Generation Templates

When generating vCon code, use these templates as starting points:

Basic Conversation Template

Multimedia Conversation Template

Extension-Enabled Conversation Template

Privacy-Compliant Conversation Template

Transcription-Enabled Conversation Template

2. Common LLM Tasks

Converting Chat History to vCon

Adding AI Analysis to vCon

Extracting Conversation Data

Adding Privacy Compliance to vCon

Converting Provider Transcription to WTF

Checking Privacy Permissions

Exporting Transcriptions

Validating Extensions

Processing Extensions

3. Error Handling Patterns

4. Validation Patterns

5. Integration Patterns

REST API Integration

Database Integration

6. Performance Considerations

Conclusion

The vCon library provides a comprehensive framework for working with conversation data. When generating code:

  1. Start Simple: Begin with Vcon.build_new() and basic Party/Dialog objects

  2. Add Rich Metadata: Use tags, attachments, and analysis for comprehensive data

  3. Handle Multimedia: Leverage video/image processing capabilities when needed

  4. Ensure Security: Use digital signatures for integrity verification

  5. Validate Always: Check vCon validity before saving or transmitting

  6. Handle Errors Gracefully: Implement proper error handling for robust applications

  7. Consider Performance: Optimize for storage or processing based on use case

  8. Use Extensions: Declare optional features and must-support requirements

  9. Track Events: Use party history for complex multi-party conversations

  10. Integrate Seamlessly: Follow patterns for API and database integration

  11. Implement Privacy Compliance: Use Lawful Basis extension for GDPR compliance

  12. Standardize Transcriptions: Use WTF extension for multi-provider transcription support

  13. Validate Extensions: Always validate extension data before processing

  14. Export Transcriptions: Leverage WTF export capabilities for subtitle formats

  15. Check Permissions: Use lawful basis permission checking for privacy compliance

The vCon 0.3.0 specification provides a robust foundation for modern conversation data management with support for multimedia content, security, and extensibility.

Last updated

Was this helpful?