11# Deepgram Python SDK
22
3- [ ![ Discord] ( https://dcbadge.vercel.app/api/server/xWRaCDBtW4?style=flat )] ( https://discord.gg/xWRaCDBtW4 ) [ ![ GitHub Workflow Status] ( https://img.shields.io/github/workflow/status/deepgram/deepgram-python-sdk/CI )] ( https://github.com/deepgram/deepgram-python-sdk/actions/workflows/CI.yml ) [ ![ PyPI] ( https://img.shields.io/pypi/v/deepgram-sdk )] ( https://pypi.org/project/deepgram-sdk/ )
3+ [ ![ Discord] ( https://dcbadge.vercel.app/api/server/xWRaCDBtW4?style=flat )] ( https://discord.gg/xWRaCDBtW4 ) [ ![ GitHub Workflow Status] ( https://img.shields.io/github/workflow/status/deepgram/deepgram-python-sdk/CI )] ( https://github.com/deepgram/deepgram-python-sdk/actions/workflows/CI.yml ) [ ![ PyPI] ( https://img.shields.io/pypi/v/deepgram-sdk )] ( https://pypi.org/project/deepgram-sdk/ )
44[ ![ Contributor Covenant] ( https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-rounded )] ( ./.github/CODE_OF_CONDUCT.md )
55
66Official Python SDK for [ Deepgram] ( https://www.deepgram.com/ ) . Power your apps with world-class speech and Language AI models.
77
88> This SDK only supports hosted usage of api.deepgram.com.
99
10- * [ Deepgram Python SDK] ( #deepgram-python-sdk )
11- * [ Documentation] ( #documentation )
12- * [ Getting an API Key] ( #getting-an-api-key )
13- * [ Installation] ( #installation )
14- * [ Examples] ( #examples )
15- * [ Testing] ( #testing )
16- * [ Configuration] ( #configuration )
17- * [ Custom API Endpoint] [ #custom-api-endpoint]
18- * [ Transcription] ( #transcription )
19- * [ Remote Files] ( #remote-files )
20- * [ Local Files] ( #local-files )
21- * [ Live Audio] ( #live-audio )
22- * [ Parameters] ( #parameters )
23- * [ Projects] ( #projects )
24- * [ Get Projects] ( #get-projects )
25- * [ Get Project] ( #get-project )
26- * [ Update Project] ( #update-project )
27- * [ Keys] ( #keys )
28- * [ List Keys] ( #list-keys )
29- * [ Get Key] ( #get-key )
30- * [ Create Key] ( #create-key )
31- * [ Delete Key] ( #delete-key )
32- * [ Members] ( #members )
33- * [ Get Members] ( #get-members )
34- * [ Remove Member] ( #remove-member )
35- * [ Scopes] ( #scopes )
36- * [ Get Member Scopes] ( #get-member-scopes )
37- * [ Update Scope] ( #update-scope )
38- * [ Invitations] ( #invitations )
39- * [ List Invites] ( #list-invites )
40- * [ Send Invite] ( #send-invite )
41- * [ Delete Invite] ( #delete-invite )
42- * [ Leave Project] ( #leave-project )
43- * [ Usage] ( #usage )
44- * [ Get All Requests] ( #get-all-requests )
45- * [ Get Request] ( #get-request )
46- * [ Get Fields] ( #get-fields )
47- * [ Billing] ( #billing )
48- * [ Get All Balances] ( #get-all-balances )
49- * [ Get Balance] ( #get-balance )
50- * [ Development and Contributing] ( #development-and-contributing )
51- * [ Getting Help] ( #getting-help )
10+ - [ Deepgram Python SDK] ( #deepgram-python-sdk )
11+ - [ Documentation] ( #documentation )
12+ - [ Getting an API Key] ( #getting-an-api-key )
13+ - [ Installation] ( #installation )
14+ - [ Examples] ( #examples )
15+ - [ Testing] ( #testing )
16+ - [ Configuration] ( #configuration )
17+ - [ Custom API Endpoint] [ #custom-api-endpoint]
18+ - [ Transcription] ( #transcription )
19+ - [ Remote Files] ( #remote-files )
20+ - [ Local Files] ( #local-files )
21+ - [ Live Audio] ( #live-audio )
22+ - [ Parameters] ( #parameters )
23+ - [ Transcribing to captions] ( #transcribing-to-captions )
24+ - [ Projects] ( #projects )
25+ - [ Get Projects] ( #get-projects )
26+ - [ Get Project] ( #get-project )
27+ - [ Update Project] ( #update-project )
28+ - [ Keys] ( #keys )
29+ - [ List Keys] ( #list-keys )
30+ - [ Get Key] ( #get-key )
31+ - [ Create Key] ( #create-key )
32+ - [ Delete Key] ( #delete-key )
33+ - [ Members] ( #members )
34+ - [ Get Members] ( #get-members )
35+ - [ Remove Member] ( #remove-member )
36+ - [ Scopes] ( #scopes )
37+ - [ Get Member Scopes] ( #get-member-scopes )
38+ - [ Update Scope] ( #update-scope )
39+ - [ Invitations] ( #invitations )
40+ - [ List Invites] ( #list-invites )
41+ - [ Send Invite] ( #send-invite )
42+ - [ Delete Invite] ( #delete-invite )
43+ - [ Leave Project] ( #leave-project )
44+ - [ Usage] ( #usage )
45+ - [ Get All Requests] ( #get-all-requests )
46+ - [ Get Request] ( #get-request )
47+ - [ Get Fields] ( #get-fields )
48+ - [ Billing] ( #billing )
49+ - [ Get All Balances] ( #get-all-balances )
50+ - [ Get Balance] ( #get-balance )
51+ - [ Development and Contributing] ( #development-and-contributing )
52+ - [ Getting Help] ( #getting-help )
5253
5354# Documentation
5455
@@ -103,8 +104,8 @@ pytest --cov=deepgram --api-key <key> tests/
103104
104105To setup the configuration of the Deepgram Client, do the following:
105106
106- * Import the Deepgram client
107- * Create a Deepgram Client instance and pass in credentials to the constructor.
107+ - Import the Deepgram client
108+ - Create a Deepgram Client instance and pass in credentials to the constructor.
108109
109110``` python
110111from deepgram import Deepgram
@@ -118,9 +119,9 @@ deepgram = Deepgram(DEEPGRAM_API_KEY)
118119In order to point the SDK at a different API environment (e.g., for on-prem deployments), you can pass in an object setting the ` api_url ` when initializing the Deepgram client.
119120
120121``` python
121- dg_client = Deepgram({
122- " api_key" : DEEPGRAM_API_KEY ,
123- " api_url" : " http://localhost:8080/v1/listen"
122+ dg_client = Deepgram({
123+ " api_key" : DEEPGRAM_API_KEY ,
124+ " api_url" : " http://localhost:8080/v1/listen"
124125})
125126```
126127
@@ -234,6 +235,18 @@ Depending on your preference, you can also add parameters as named arguments, in
234235response = await dg_client.transcription.prerecorded(source, punctuate = True , keywords = [' first:5' , ' second' ])
235236```
236237
238+ # Transcribing to captions
239+
240+ ``` python
241+ from deepgram_captions import DeepgramConverter, webvtt, srt
242+
243+ transcription = DeepgramConverter(dg_response)
244+ captions = webvtt(transcription)
245+ # captions = srt(transcription)
246+ ```
247+
248+ [ See our standalone captions library for more information] ( https://github.com/deepgram/deepgram-python-captions ) .
249+
237250# Projects
238251
239252The ` Deepgram.projects ` object provides access to manage projects associated with the API key you provided when instantiating the Deepgram client.
@@ -304,7 +317,7 @@ updateResponse = await deepgram.projects.update(project)
304317
305318``` ts
306319{
307- message : String ;
320+ message : String ;
308321}
309322```
310323
@@ -332,14 +345,14 @@ response = await deepgram.keys.list(PROJECT_ID)
332345
333346``` ts
334347{
335- api_keys : [
336- {
337- api_key_id: string ,
338- comment: string ,
339- created: string ,
340- scopes: Array < string > ,
341- },
342- ];
348+ api_keys : [
349+ {
350+ api_key_id: string ,
351+ comment: string ,
352+ created: string ,
353+ scopes: Array < string > ,
354+ },
355+ ];
343356}
344357```
345358
@@ -451,7 +464,7 @@ response = await deepgram.members.remove_member(PROJECT_ID, MEMBER_ID)
451464
452465``` ts
453466{
454- message : string ;
467+ message : string ;
455468}
456469```
457470
@@ -506,7 +519,7 @@ response = await deepgram.scopes.update_scope(PROJECT_ID, MEMBER_ID, 'member')
506519
507520``` ts
508521{
509- message : string ;
522+ message : string ;
510523}
511524```
512525
@@ -534,12 +547,12 @@ response = await deepgram.invitations.list_invitations(PROJECT_ID)
534547
535548``` ts
536549{
537- members : [
538- {
539- email: string ,
540- scope: string ,
541- },
542- ];
550+ members : [
551+ {
552+ email: string ,
553+ scope: string ,
554+ },
555+ ];
543556}
544557```
545558
@@ -567,7 +580,7 @@ response = await deepgram.invitations.send_invitation(PROJECT_ID, {
567580
568581``` ts
569582{
570- message : string ;
583+ message : string ;
571584}
572585```
573586
@@ -595,7 +608,7 @@ response = await deepgram.invitations.remove_invitation(
595608
596609``` ts
597610{
598- message : string ;
611+ message : string ;
599612}
600613```
601614
@@ -619,7 +632,7 @@ response = await deepgram.invitations.leave_project(PROJECT_ID)
619632
620633``` ts
621634{
622- message : string ;
635+ message : string ;
623636}
624637```
625638
@@ -973,12 +986,12 @@ const response = deepgram.billing.get_balance(PROJECT_ID, BALANCE_ID)
973986
974987``` ts
975988{
976- balance : {
977- balance_id : string ;
978- amount : number ;
979- units : string ;
980- purchase : string ;
981- }
989+ balance : {
990+ balance_id : string ;
991+ amount : number ;
992+ units : string ;
993+ purchase : string ;
994+ }
982995}
983996```
984997
@@ -995,6 +1008,6 @@ To make sure our community is safe for all, be sure to review and agree to our
9951008We love to hear from you so if you have questions, comments or find a bug in the
9961009project, let us know! You can either:
9971010
998- * [ Open an issue in this repository] ( https://github.com/deepgram/deepgram-python-sdk/issues/new )
999- * [ Join the Deepgram Github Discussions Community] ( https://github.com/orgs/deepgram/discussions )
1000- * [ Join the Deepgram Discord Community] ( https://discord.gg/xWRaCDBtW4 )
1011+ - [ Open an issue in this repository] ( https://github.com/deepgram/deepgram-python-sdk/issues/new )
1012+ - [ Join the Deepgram Github Discussions Community] ( https://github.com/orgs/deepgram/discussions )
1013+ - [ Join the Deepgram Discord Community] ( https://discord.gg/xWRaCDBtW4 )
0 commit comments