deepgram-sdk 3.0.0.dev6__tar.gz → 3.0.0.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {deepgram-sdk-3.0.0.dev6/deepgram_sdk.egg-info → deepgram-sdk-3.0.0.dev8}/PKG-INFO +1 -1
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/__init__.py +3 -4
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8/deepgram_sdk.egg-info}/PKG-INFO +1 -1
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram_sdk.egg-info/SOURCES.txt +0 -5
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/pyproject.toml +2 -2
- deepgram-sdk-3.0.0.dev6/deepgram/audio/__init__.py +0 -12
- deepgram-sdk-3.0.0.dev6/deepgram/audio/microphone/__init__.py +0 -6
- deepgram-sdk-3.0.0.dev6/deepgram/audio/microphone/constants.py +0 -12
- deepgram-sdk-3.0.0.dev6/deepgram/audio/microphone/errors.py +0 -22
- deepgram-sdk-3.0.0.dev6/deepgram/audio/microphone/microphone.py +0 -137
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/LICENSE +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/README.md +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/__init__.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/abstract_async_client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/abstract_sync_client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/errors.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/listen.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/__init__.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/enums.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/errors.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/helpers.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/v1/__init__.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/v1/async_client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/v1/client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/v1/options.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/v1/response.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/manage/__init__.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/manage/client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/manage/v1/__init__.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/manage/v1/async_client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/manage/v1/client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/manage/v1/options.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/manage/v1/response.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/onprem/__init__.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/onprem/client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/onprem/v1/__init__.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/onprem/v1/async_client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/onprem/v1/client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/__init__.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/errors.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/helpers.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/source.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/__init__.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/async_client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/client.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/options.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/response.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/errors.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/options.py +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram_sdk.egg-info/dependency_links.txt +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram_sdk.egg-info/requires.txt +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram_sdk.egg-info/top_level.txt +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/setup.cfg +0 -0
- {deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/setup.py +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# SPDX-License-Identifier: MIT
|
|
4
4
|
|
|
5
5
|
# version
|
|
6
|
-
__version__ = "v3.0.0-dev.
|
|
6
|
+
__version__ = "v3.0.0-dev.8"
|
|
7
7
|
|
|
8
8
|
# entry point for the deepgram python sdk
|
|
9
9
|
from .client import DeepgramClient, DeepgramApiKeyError
|
|
@@ -43,10 +43,9 @@ from .clients.manage.client import (
|
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
# utilities
|
|
46
|
-
from .audio.microphone
|
|
47
|
-
from .audio.microphone
|
|
46
|
+
from .audio.microphone import Microphone
|
|
47
|
+
from .audio.microphone import (
|
|
48
48
|
LOGGING,
|
|
49
|
-
FORMAT,
|
|
50
49
|
CHANNELS,
|
|
51
50
|
RATE,
|
|
52
51
|
CHUNK,
|
|
@@ -6,11 +6,6 @@ deepgram/__init__.py
|
|
|
6
6
|
deepgram/client.py
|
|
7
7
|
deepgram/errors.py
|
|
8
8
|
deepgram/options.py
|
|
9
|
-
deepgram/audio/__init__.py
|
|
10
|
-
deepgram/audio/microphone/__init__.py
|
|
11
|
-
deepgram/audio/microphone/constants.py
|
|
12
|
-
deepgram/audio/microphone/errors.py
|
|
13
|
-
deepgram/audio/microphone/microphone.py
|
|
14
9
|
deepgram/clients/__init__.py
|
|
15
10
|
deepgram/clients/abstract_async_client.py
|
|
16
11
|
deepgram/clients/abstract_sync_client.py
|
|
@@ -34,11 +34,11 @@ httpx = "^0.25.2"
|
|
|
34
34
|
websockets = "^12.0"
|
|
35
35
|
typing-extensions = "^4.8.0"
|
|
36
36
|
dataclasses-json = "^0.6.3"
|
|
37
|
-
python-dotenv = "^1.0.0"
|
|
37
|
+
# python-dotenv = "^1.0.0"
|
|
38
38
|
asyncio = "^3.4.3"
|
|
39
39
|
aiohttp = "^3.9.1"
|
|
40
40
|
verboselogs = "^1.7"
|
|
41
|
-
pyaudio = "^0.2.14"
|
|
41
|
+
# pyaudio = "^0.2.14"
|
|
42
42
|
|
|
43
43
|
[tool.poetry.group.dev.dependencies]
|
|
44
44
|
pytest = "^7.4.3"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
|
|
2
|
-
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
|
|
3
|
-
# SPDX-License-Identifier: MIT
|
|
4
|
-
|
|
5
|
-
from .microphone import microphone
|
|
6
|
-
from .microphone import (
|
|
7
|
-
LOGGING as iLOGGING,
|
|
8
|
-
FORMAT as iFORMAT,
|
|
9
|
-
CHANNELS as iCHANNELS,
|
|
10
|
-
RATE as iRATE,
|
|
11
|
-
CHUNK as iCHUNK,
|
|
12
|
-
)
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
|
|
2
|
-
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
|
|
3
|
-
# SPDX-License-Identifier: MIT
|
|
4
|
-
|
|
5
|
-
from .microphone import Microphone
|
|
6
|
-
from .constants import LOGGING, FORMAT, CHANNELS, RATE, CHUNK
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
|
|
2
|
-
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
|
|
3
|
-
# SPDX-License-Identifier: MIT
|
|
4
|
-
|
|
5
|
-
import pyaudio
|
|
6
|
-
import logging, verboselogs
|
|
7
|
-
|
|
8
|
-
LOGGING = logging.WARNING
|
|
9
|
-
FORMAT = pyaudio.paInt16
|
|
10
|
-
CHANNELS = 1
|
|
11
|
-
RATE = 16000
|
|
12
|
-
CHUNK = 8194
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
|
|
2
|
-
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
|
|
3
|
-
# SPDX-License-Identifier: MIT
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class DeepgramMicrophoneError(Exception):
|
|
7
|
-
"""
|
|
8
|
-
Exception raised for known errors related to Microphone library.
|
|
9
|
-
|
|
10
|
-
Attributes:
|
|
11
|
-
message (str): The error message describing the exception.
|
|
12
|
-
status (str): The HTTP status associated with the API error.
|
|
13
|
-
original_error (str - json): The original error that was raised.
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
def __init__(self, message: str):
|
|
17
|
-
super().__init__(message)
|
|
18
|
-
self.name = "DeepgramMicrophoneError"
|
|
19
|
-
self.message = message
|
|
20
|
-
|
|
21
|
-
def __str__(self):
|
|
22
|
-
return f"{self.name}: {self.message}"
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
|
|
2
|
-
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
|
|
3
|
-
# SPDX-License-Identifier: MIT
|
|
4
|
-
|
|
5
|
-
import inspect
|
|
6
|
-
import asyncio
|
|
7
|
-
import threading
|
|
8
|
-
import pyaudio
|
|
9
|
-
from array import array
|
|
10
|
-
import logging, verboselogs
|
|
11
|
-
|
|
12
|
-
from .errors import DeepgramMicrophoneError
|
|
13
|
-
from .constants import LOGGING, FORMAT, CHANNELS, RATE, CHUNK
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class Microphone:
|
|
17
|
-
"""
|
|
18
|
-
This implements a microphone for local audio input. This uses PyAudio under the hood.
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
def __init__(
|
|
22
|
-
self,
|
|
23
|
-
push_callback,
|
|
24
|
-
verbose=LOGGING,
|
|
25
|
-
format=FORMAT,
|
|
26
|
-
rate=RATE,
|
|
27
|
-
chunk=CHUNK,
|
|
28
|
-
channels=CHANNELS,
|
|
29
|
-
):
|
|
30
|
-
self.logger = logging.getLogger(__name__)
|
|
31
|
-
self.logger.addHandler(logging.StreamHandler())
|
|
32
|
-
self.logger.setLevel(verbose)
|
|
33
|
-
|
|
34
|
-
self.audio = pyaudio.PyAudio()
|
|
35
|
-
self.chunk = chunk
|
|
36
|
-
self.rate = rate
|
|
37
|
-
self.format = format
|
|
38
|
-
self.channels = channels
|
|
39
|
-
self.push_callback = push_callback
|
|
40
|
-
self.stream = None
|
|
41
|
-
|
|
42
|
-
def is_active(self):
|
|
43
|
-
self.logger.debug("Microphone.is_active ENTER")
|
|
44
|
-
if self.stream is None:
|
|
45
|
-
self.logger.error("stream is None")
|
|
46
|
-
self.logger.debug("Microphone.is_active LEAVE")
|
|
47
|
-
return False
|
|
48
|
-
|
|
49
|
-
val = self.stream.is_active()
|
|
50
|
-
self.logger.info("is_active: %s", val)
|
|
51
|
-
self.logger.debug("Microphone.is_active LEAVE")
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
def start(self):
|
|
55
|
-
self.logger.debug("Microphone.start ENTER")
|
|
56
|
-
|
|
57
|
-
if self.stream is not None:
|
|
58
|
-
self.logger.error("stream is None")
|
|
59
|
-
self.logger.debug("Microphone.start LEAVE")
|
|
60
|
-
raise DeepgramMicrophoneError("Microphone already started")
|
|
61
|
-
|
|
62
|
-
self.logger.info("format: %s", self.format)
|
|
63
|
-
self.logger.info("channels: %d", self.channels)
|
|
64
|
-
self.logger.info("rate: %d", self.rate)
|
|
65
|
-
self.logger.info("chunk: %d", self.chunk)
|
|
66
|
-
|
|
67
|
-
self.stream = self.audio.open(
|
|
68
|
-
format=self.format,
|
|
69
|
-
channels=self.channels,
|
|
70
|
-
rate=self.rate,
|
|
71
|
-
input=True,
|
|
72
|
-
frames_per_buffer=self.chunk,
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
self.exit = False
|
|
76
|
-
self.lock = threading.Lock()
|
|
77
|
-
|
|
78
|
-
self.stream.start_stream()
|
|
79
|
-
self.thread = threading.Thread(target=self.processing)
|
|
80
|
-
self.thread.start()
|
|
81
|
-
|
|
82
|
-
self.logger.notice("start succeeded")
|
|
83
|
-
self.logger.debug("Microphone.start LEAVE")
|
|
84
|
-
|
|
85
|
-
def processing(self):
|
|
86
|
-
self.logger.debug("Microphone.processing ENTER")
|
|
87
|
-
|
|
88
|
-
try:
|
|
89
|
-
while True:
|
|
90
|
-
data = self.stream.read(self.chunk)
|
|
91
|
-
|
|
92
|
-
self.lock.acquire()
|
|
93
|
-
localExit = self.exit
|
|
94
|
-
self.lock.release()
|
|
95
|
-
if localExit:
|
|
96
|
-
self.logger.info("exit is True")
|
|
97
|
-
break
|
|
98
|
-
if data is None:
|
|
99
|
-
self.logger.info("data is None")
|
|
100
|
-
continue
|
|
101
|
-
|
|
102
|
-
if inspect.iscoroutinefunction(self.push_callback):
|
|
103
|
-
self.logger.verbose("async/await callback")
|
|
104
|
-
asyncio.run(self.push_callback(data))
|
|
105
|
-
else:
|
|
106
|
-
self.logger.verbose("regular threaded callback")
|
|
107
|
-
self.push_callback(data)
|
|
108
|
-
|
|
109
|
-
self.logger.notice("processing exiting...")
|
|
110
|
-
self.logger.debug("Microphone.processing LEAVE")
|
|
111
|
-
|
|
112
|
-
except Exception as e:
|
|
113
|
-
self.logger.error("Error while sending: %s", str(e))
|
|
114
|
-
self.logger.debug("Microphone.processing LEAVE")
|
|
115
|
-
raise
|
|
116
|
-
|
|
117
|
-
def finish(self):
|
|
118
|
-
self.logger.debug("Microphone.finish ENTER")
|
|
119
|
-
|
|
120
|
-
self.lock.acquire()
|
|
121
|
-
self.logger.notice("signal exit")
|
|
122
|
-
self.exit = True
|
|
123
|
-
self.lock.release()
|
|
124
|
-
|
|
125
|
-
if self.thread is not None:
|
|
126
|
-
self.thread.join()
|
|
127
|
-
self.thread = None
|
|
128
|
-
self.logger.notice("processing/send thread joined")
|
|
129
|
-
|
|
130
|
-
if self.stream is not None:
|
|
131
|
-
self.stream.stop_stream()
|
|
132
|
-
self.stream.close()
|
|
133
|
-
self.stream = None
|
|
134
|
-
self.logger.notice("stream/recv thread joined")
|
|
135
|
-
|
|
136
|
-
self.logger.notice("finish succeeded")
|
|
137
|
-
self.logger.debug("Microphone.finish LEAVE")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/abstract_async_client.py
RENAMED
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/abstract_sync_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/live/v1/async_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/manage/v1/async_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/onprem/v1/async_client.py
RENAMED
|
File without changes
|
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/__init__.py
RENAMED
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/async_client.py
RENAMED
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/client.py
RENAMED
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/options.py
RENAMED
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram/clients/prerecorded/v1/response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepgram-sdk-3.0.0.dev6 → deepgram-sdk-3.0.0.dev8}/deepgram_sdk.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|