diff --git a/docs/Migrating-v4-to-v5.md b/docs/Migrating-v4-to-v5.md index 2de4697b..528ea702 100644 --- a/docs/Migrating-v4-to-v5.md +++ b/docs/Migrating-v4-to-v5.md @@ -343,7 +343,7 @@ connection.connect(); await connection.waitForOpen(); // Send text to synthesize -connection.sendSpeakV1Text({ type: "Text", text: "Hello, world!" }); +connection.sendText({ type: "Text", text: "Hello, world!" }); ``` ### Agent V1 @@ -385,7 +385,7 @@ connection.connect(); await connection.waitForOpen(); // Configure agent settings -connection.sendAgentV1Settings({ +connection.sendSettings({ type: "Settings", audio: { input: { diff --git a/examples/README.md b/examples/README.md index 14e09f98..8a8bca2e 100644 --- a/examples/README.md +++ b/examples/README.md @@ -5,48 +5,56 @@ This directory contains comprehensive examples demonstrating how to use the Deep ## Examples Overview ### Authentication -- **01-authentication-api-key.js** - API key authentication (3 methods) -- **02-authentication-access-token.js** - Access token authentication -- **03-authentication-proxy.js** - Proxy authentication for browser environments +- **01-authentication-api-key.ts** - API key authentication (3 methods) +- **02-authentication-access-token.ts** - Access token authentication +- **03-authentication-proxy.ts** - Proxy authentication for browser environments ### Transcription -- **04-transcription-prerecorded-url.js** - Transcribe audio from URL -- **05-transcription-prerecorded-file.js** - Transcribe audio from local file -- **06-transcription-prerecorded-callback.js** - Async transcription with callbacks -- **07-transcription-live-websocket.js** - Live transcription via WebSocket -- **08-transcription-captions.js** - Convert transcriptions to WebVTT/SRT captions -- **22-transcription-advanced-options.js** - Advanced transcription options +- **04-transcription-prerecorded-url.ts** - Transcribe audio from URL +- **05-transcription-prerecorded-file.ts** - Transcribe audio from local file +- **06-transcription-prerecorded-callback.ts** - Async transcription with callbacks +- **07-transcription-live-websocket.ts** - Live transcription via WebSocket +- **08-transcription-captions.ts** - Convert transcriptions to WebVTT/SRT captions +- **22-transcription-advanced-options.ts** - Advanced transcription options +- **26-transcription-live-websocket-v2.ts** - Live transcription via WebSocket V2 ### Voice Agent -- **09-voice-agent.js** - Voice Agent configuration and usage -- **36-agent-inject-message.js** - Injecting agent and user messages into an active session +- **09-voice-agent.ts** - Voice Agent configuration and usage +- **34-agent-custom-providers.ts** - Voice Agent with custom third-party providers +- **35-agent-provider-combinations.ts** - Voice Agent provider combinations +- **36-agent-inject-message.ts** - Injecting agent and user messages into an active session ### Text-to-Speech -- **10-text-to-speech-single.js** - Single request TTS -- **11-text-to-speech-streaming.js** - Streaming TTS via WebSocket +- **10-text-to-speech-single.ts** - Single request TTS +- **11-text-to-speech-streaming.ts** - Streaming TTS via WebSocket ### Text Intelligence -- **12-text-intelligence.js** - Text analysis using AI features +- **12-text-intelligence.ts** - Text analysis using AI features +- **28-text-intelligence-advanced.ts** - Advanced text intelligence options ### Management API -- **13-management-projects.js** - Project management (list, get, update, delete) -- **14-management-keys.js** - API key management (list, get, create, delete) -- **15-management-members.js** - Member management (list, remove, scopes) -- **16-management-invites.js** - Invitation management (list, send, delete, leave) -- **17-management-usage.js** - Usage statistics and request information -- **18-management-billing.js** - Billing and balance information -- **19-management-models.js** - Model information +- **13-management-projects.ts** - Project management (list, get, update, delete) +- **14-management-keys.ts** - API key management (list, get, create, delete) +- **15-management-members.ts** - Member management (list, remove, scopes) +- **16-management-invites.ts** - Invitation management (list, send, delete, leave) +- **17-management-usage.ts** - Usage statistics and request information +- **18-management-billing.ts** - Billing and balance information +- **19-management-models.ts** - Model information +- **29-management-usage-breakdown.ts** - Usage breakdown details +- **30-management-billing-detailed.ts** - Detailed billing information +- **31-management-member-permissions.ts** - Member permissions management +- **32-management-project-models.ts** - Project-specific model information ### On-Premises -- **20-onprem-credentials.js** - On-premises credentials management +- **20-onprem-credentials.ts** - On-premises credentials management ### Configuration & Advanced -- **21-configuration-scoped.js** - Scoped configuration examples -- **23-file-upload-types.js** - Different file upload types -- **24-error-handling.js** - Error handling patterns -- **25-request-options.js** - Advanced request options (headers, retries, timeouts) -- **26-logging.js** - Logging configuration -- **27-binary-response.js** - Binary response handling +- **21-configuration-scoped.ts** - Scoped configuration examples +- **23-file-upload-types.ts** - Different file upload types +- **24-error-handling.ts** - Error handling patterns +- **25-binary-response.ts** - Binary response handling +- **27-deepgram-session-header.ts** - Deepgram session header usage +- **33-configuration-eu-endpoint.ts** - EU endpoint configuration ## Usage @@ -55,10 +63,10 @@ This directory contains comprehensive examples demonstrating how to use the Deep pnpm install ``` -2. Set your API key and Project ID as an environment variable: +2. Set your API key and Project ID as environment variables: ```bash -export -export +export DEEPGRAM_API_KEY="your-api-key-here" +export DEEPGRAM_PROJECT_ID="your-id-here" ``` 3. Run an example: @@ -84,7 +92,7 @@ For more information, see: ## Notes -- All examples use the existing SDK signature (`createClient`) as documented in the README +- All examples use the v5 SDK signature (`new DeepgramClient()`) as documented in the README - Examples are commented out by default - uncomment the function calls to run them - Replace placeholder values (YOUR_DEEPGRAM_API_KEY, YOUR_PROJECT_ID, etc.) with actual values - Some examples require specific file paths or URLs - adjust as needed for your environment