livekit-plugins-deepgram 1.0.18__py3-none-any.whl → 1.0.20__py3-none-any.whl

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.
@@ -1,3 +1,24 @@
1
+ # Copyright 2025 LiveKit, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Deepgram plugin for LiveKit Agents
16
+
17
+ Support for speech-to-text with [Deepgram](https://deepgram.com/).
18
+
19
+ See https://docs.livekit.io/agents/integrations/stt/deepgram/ for more information.
20
+ """
21
+
1
22
  from .stt import STT, AudioEnergyFilter, SpeechStream
2
23
  from .tts import TTS
3
24
  from .version import __version__
@@ -1,5 +1,6 @@
1
1
  import time
2
2
  from typing import Callable, Generic, Optional, TypeVar
3
+ from urllib.parse import urlencode
3
4
 
4
5
  T = TypeVar("T")
5
6
 
@@ -34,3 +35,23 @@ class PeriodicCollector(Generic[T]):
34
35
  self._callback(self._total)
35
36
  self._total = None
36
37
  self._last_flush_time = time.monotonic()
38
+
39
+
40
+ def _to_deepgram_url(opts: dict, base_url: str, *, websocket: bool) -> str:
41
+ # don't modify the original opts
42
+ opts = opts.copy()
43
+ if opts.get("keywords"):
44
+ # convert keywords to a list of "keyword:intensifier"
45
+ opts["keywords"] = [
46
+ f"{keyword}:{intensifier}" for (keyword, intensifier) in opts["keywords"]
47
+ ]
48
+
49
+ # lowercase bools
50
+ opts = {k: str(v).lower() if isinstance(v, bool) else v for k, v in opts.items()}
51
+
52
+ if websocket and base_url.startswith("http"):
53
+ base_url = base_url.replace("http", "ws", 1)
54
+
55
+ elif not websocket and base_url.startswith("ws"):
56
+ base_url = base_url.replace("ws", "http", 1)
57
+ return f"{base_url}?{urlencode(opts, doseq=True)}"
@@ -22,7 +22,6 @@ import weakref
22
22
  from dataclasses import dataclass
23
23
  from enum import Enum
24
24
  from typing import Any
25
- from urllib.parse import urlencode
26
25
 
27
26
  import aiohttp
28
27
  import numpy as np
@@ -43,7 +42,7 @@ from livekit.agents.types import (
43
42
  )
44
43
  from livekit.agents.utils import AudioBuffer, is_given
45
44
 
46
- from ._utils import PeriodicCollector
45
+ from ._utils import PeriodicCollector, _to_deepgram_url
47
46
  from .log import logger
48
47
  from .models import DeepgramLanguages, DeepgramModels
49
48
 
@@ -751,26 +750,6 @@ def prerecorded_transcription_to_speech_event(
751
750
  )
752
751
 
753
752
 
754
- def _to_deepgram_url(opts: dict, base_url: str, *, websocket: bool) -> str:
755
- # don't modify the original opts
756
- opts = opts.copy()
757
- if opts.get("keywords"):
758
- # convert keywords to a list of "keyword:intensifier"
759
- opts["keywords"] = [
760
- f"{keyword}:{intensifier}" for (keyword, intensifier) in opts["keywords"]
761
- ]
762
-
763
- # lowercase bools
764
- opts = {k: str(v).lower() if isinstance(v, bool) else v for k, v in opts.items()}
765
-
766
- if websocket and base_url.startswith("http"):
767
- base_url = base_url.replace("http", "ws", 1)
768
-
769
- elif not websocket and base_url.startswith("ws"):
770
- base_url = base_url.replace("ws", "http", 1)
771
- return f"{base_url}?{urlencode(opts, doseq=True)}"
772
-
773
-
774
753
  def _validate_model(
775
754
  model: DeepgramModels | str, language: NotGivenOr[DeepgramLanguages | str]
776
755
  ) -> DeepgramModels | str:
@@ -5,7 +5,6 @@ import json
5
5
  import os
6
6
  import weakref
7
7
  from dataclasses import dataclass
8
- from urllib.parse import urlencode
9
8
 
10
9
  import aiohttp
11
10
 
@@ -25,6 +24,7 @@ from livekit.agents.types import (
25
24
  )
26
25
  from livekit.agents.utils import is_given
27
26
 
27
+ from ._utils import _to_deepgram_url
28
28
  from .log import logger
29
29
 
30
30
  BASE_URL = "https://api.deepgram.com/v1/speak"
@@ -436,18 +436,3 @@ class SynthesizeStream(tts.SynthesizeStream):
436
436
  finally:
437
437
  if ws is not None and not ws.closed:
438
438
  await ws.close()
439
-
440
-
441
- def _to_deepgram_url(
442
- opts: dict,
443
- base_url: str,
444
- *,
445
- websocket: bool,
446
- ) -> str:
447
- if websocket and base_url.startswith("http"):
448
- base_url = base_url.replace("http", "ws", 1)
449
-
450
- elif not websocket and base_url.startswith("ws"):
451
- base_url = base_url.replace("ws", "http", 1)
452
-
453
- return f"{base_url}?{urlencode(opts, doseq=True)}"
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "1.0.18"
15
+ __version__ = "1.0.20"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit-plugins-deepgram
3
- Version: 1.0.18
3
+ Version: 1.0.20
4
4
  Summary: Agent Framework plugin for services using Deepgram's API.
5
5
  Project-URL: Documentation, https://docs.livekit.io
6
6
  Project-URL: Website, https://livekit.io/
@@ -18,13 +18,15 @@ Classifier: Topic :: Multimedia :: Sound/Audio
18
18
  Classifier: Topic :: Multimedia :: Video
19
19
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
20
  Requires-Python: >=3.9.0
21
- Requires-Dist: livekit-agents[codecs]>=1.0.18
21
+ Requires-Dist: livekit-agents[codecs]>=1.0.20
22
22
  Requires-Dist: numpy>=1.26
23
23
  Description-Content-Type: text/markdown
24
24
 
25
- # LiveKit Plugins DeepGram
25
+ # Deepgram plugin for LiveKit Agents
26
26
 
27
- Agent Framework plugin for speech-to-text with [DeepGram](https://deepgram.com/)'s API. Currently supports speech-to-text.
27
+ Support for speech-to-text with [Deepgram](https://deepgram.com/).
28
+
29
+ See [https://docs.livekit.io/agents/integrations/stt/deepgram/](https://docs.livekit.io/agents/integrations/stt/deepgram/) for more information.
28
30
 
29
31
  ## Installation
30
32
 
@@ -0,0 +1,11 @@
1
+ livekit/plugins/deepgram/__init__.py,sha256=7sCI3vSCelS8mjtjaIZP_tt61S8KKncEBnuf0urNejw,1358
2
+ livekit/plugins/deepgram/_utils.py,sha256=NgeR4qKZOeqs1wr8v4G2Q_KPZ5xUSFDE4f2N6WXnZH4,2041
3
+ livekit/plugins/deepgram/log.py,sha256=isjd2-ROJXiDFhRRnqRmYxv16U5H9dBV6ut2g5bU7q0,71
4
+ livekit/plugins/deepgram/models.py,sha256=dVguYc9AfjlexreN_O1C0NxX3q-ZK9k8s5B3hWsbtZ0,1236
5
+ livekit/plugins/deepgram/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ livekit/plugins/deepgram/stt.py,sha256=Ja2ESKoT0cquj2HXEPi1iWP_52HwQaU8jpWY4_ZlauA,31945
7
+ livekit/plugins/deepgram/tts.py,sha256=Ysi6_8CGtLlTvyBorfAZW2JLyptprk_0LKFlTJhfndU,15366
8
+ livekit/plugins/deepgram/version.py,sha256=t4KmPVTpEy1pOJ2GRCA-GNJfCQq_-zHNDBxGj4GKfVk,601
9
+ livekit_plugins_deepgram-1.0.20.dist-info/METADATA,sha256=7aOUDoNhmbipUGlVw4Tc72iAv_etvaBFERvzEtromtM,1450
10
+ livekit_plugins_deepgram-1.0.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
11
+ livekit_plugins_deepgram-1.0.20.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- livekit/plugins/deepgram/__init__.py,sha256=o1BgJLSoxrTkSUHXkKrFMl9e0bF6am2TFrDMV4U6j7g,584
2
- livekit/plugins/deepgram/_utils.py,sha256=0O3O77qURXjYYCenl5McE85fcBApaQvQl5zKQzvYfR8,1276
3
- livekit/plugins/deepgram/log.py,sha256=isjd2-ROJXiDFhRRnqRmYxv16U5H9dBV6ut2g5bU7q0,71
4
- livekit/plugins/deepgram/models.py,sha256=dVguYc9AfjlexreN_O1C0NxX3q-ZK9k8s5B3hWsbtZ0,1236
5
- livekit/plugins/deepgram/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- livekit/plugins/deepgram/stt.py,sha256=1O1jbfQRRX9WrpL2sCuKNb5bKvuE8bVsd9goA0td_FE,32692
7
- livekit/plugins/deepgram/tts.py,sha256=SX7vdMz4AZoZv2o_0EVwym5WMbFzy44nNGEyw2s9XFA,15728
8
- livekit/plugins/deepgram/version.py,sha256=cnPu9FVKZV9tFmmz7lEvftrO3B_nWJVFghi3j6UcJLs,601
9
- livekit_plugins_deepgram-1.0.18.dist-info/METADATA,sha256=k9L1oT3msr7jyk35hLp4awIXs9OrAVN91Hdjw08A_w4,1350
10
- livekit_plugins_deepgram-1.0.18.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
11
- livekit_plugins_deepgram-1.0.18.dist-info/RECORD,,