diff --git a/.fern/metadata.json b/.fern/metadata.json index 4b01aae8..79dca0ec 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "3.37.5", + "cliVersion": "3.51.3", "generatorName": "fernapi/fern-python-sdk", - "generatorVersion": "4.46.14", + "generatorVersion": "4.53.0", "generatorConfig": { "client": { "class_name": "BaseClient", @@ -13,5 +13,5 @@ "should_generate_websocket_clients": true, "enable_wire_tests": true }, - "sdkVersion": "6.0.0-beta.3" + "sdkVersion": "5.3.2" } \ No newline at end of file diff --git a/README.md b/README.md index 570243d0..0c9f1e2a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ Power your apps with world-class speech and Language AI models - [Async Client](#async-client) - [Exception Handling](#exception-handling) - [Advanced Features](#advanced-features) -- [Websockets](#websockets) - [Advanced](#advanced) - [Access Raw Response Data](#access-raw-response-data) - [Retries](#retries) @@ -206,62 +205,6 @@ response = client.listen.v1.media.transcribe_file( ) ``` -## Websockets - -The SDK supports both sync and async websocket connections for real-time, low-latency communication. Sockets can be created using the `connect` method, which returns a context manager. -You can either iterate through the returned `SocketClient` to process messages as they arrive, or attach handlers to respond to specific events. - -```python - -# Connect to the websocket (Sync) -import threading - -from deepgram import DeepgramClient - -client = DeepgramClient(...) - -with client.v1.connect() as socket: - # Iterate over the messages as they arrive - for message in socket - print(message) - - # Or, attach handlers to specific events - socket.on(EventType.OPEN, lambda _: print("open")) - socket.on(EventType.MESSAGE, lambda message: print("received message", message)) - socket.on(EventType.CLOSE, lambda _: print("close")) - socket.on(EventType.ERROR, lambda error: print("error", error)) - - - # Start the listening loop in a background thread - listener_thread = threading.Thread(target=socket.start_listening, daemon=True) - listener_thread.start() -``` - -```python - -# Connect to the websocket (Async) -import asyncio - -from deepgram import AsyncDeepgramClient - -client = AsyncDeepgramClient(...) - -async with client.v1.connect() as socket: - # Iterate over the messages as they arrive - async for message in socket - print(message) - - # Or, attach handlers to specific events - socket.on(EventType.OPEN, lambda _: print("open")) - socket.on(EventType.MESSAGE, lambda message: print("received message", message)) - socket.on(EventType.CLOSE, lambda _: print("close")) - socket.on(EventType.ERROR, lambda error: print("error", error)) - - - # Start listening for events in an asyncio task - listen_task = asyncio.create_task(socket.start_listening()) -``` - ## Advanced ### Access Raw Response Data diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000..295b786c --- /dev/null +++ b/TODO.md @@ -0,0 +1,31 @@ +# Proxy Feature — Required Changes to Existing Files + +These changes are needed in Fern-generated or config files that aren't modified +by the proxy implementation itself. + +## pyproject.toml + +Add PyJWT as an optional dependency and create the `proxy` extra: + +```toml +[tool.poetry.dependencies] +# ... existing deps ... +PyJWT = {version = ">=2.0.0", optional = true} + +[tool.poetry.extras] +proxy = ["PyJWT"] +``` + +This allows users to install with: +``` +pip install "deepgram-sdk[proxy]" +``` + +## Optional runtime dependencies (not in pyproject.toml) + +These are NOT added as project dependencies — users install them directly: + +- **websockets** — required for WebSocket proxying +- **fastapi** — for the FastAPI adapter +- **flask** / **flask-sock** — for the Flask adapter (flask-sock for WS) +- **django** / **channels** — for the Django adapter (channels for WS) diff --git a/poetry.lock b/poetry.lock index 4c47d70a..2407e5c7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -358,13 +358,13 @@ files = [ [[package]] name = "packaging" -version = "25.0" +version = "26.0" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, - {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, + {file = "packaging-26.0-py3-none-any.whl", hash = "sha256:b36f1fef9334a5588b4166f8bcd26a14e521f2b55e6b9de3aaa80d3ff7a37529"}, + {file = "packaging-26.0.tar.gz", hash = "sha256:00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4"}, ] [[package]] @@ -767,102 +767,7 @@ h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] -[[package]] -name = "websockets" -version = "13.1" -description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" -optional = false -python-versions = ">=3.8" -files = [ - {file = "websockets-13.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f48c749857f8fb598fb890a75f540e3221d0976ed0bf879cf3c7eef34151acee"}, - {file = "websockets-13.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c7e72ce6bda6fb9409cc1e8164dd41d7c91466fb599eb047cfda72fe758a34a7"}, - {file = "websockets-13.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f779498eeec470295a2b1a5d97aa1bc9814ecd25e1eb637bd9d1c73a327387f6"}, - {file = "websockets-13.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4676df3fe46956fbb0437d8800cd5f2b6d41143b6e7e842e60554398432cf29b"}, - {file = "websockets-13.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a7affedeb43a70351bb811dadf49493c9cfd1ed94c9c70095fd177e9cc1541fa"}, - {file = "websockets-13.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1971e62d2caa443e57588e1d82d15f663b29ff9dfe7446d9964a4b6f12c1e700"}, - {file = "websockets-13.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5f2e75431f8dc4a47f31565a6e1355fb4f2ecaa99d6b89737527ea917066e26c"}, - {file = "websockets-13.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:58cf7e75dbf7e566088b07e36ea2e3e2bd5676e22216e4cad108d4df4a7402a0"}, - {file = "websockets-13.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c90d6dec6be2c7d03378a574de87af9b1efea77d0c52a8301dd831ece938452f"}, - {file = "websockets-13.1-cp310-cp310-win32.whl", hash = "sha256:730f42125ccb14602f455155084f978bd9e8e57e89b569b4d7f0f0c17a448ffe"}, - {file = "websockets-13.1-cp310-cp310-win_amd64.whl", hash = "sha256:5993260f483d05a9737073be197371940c01b257cc45ae3f1d5d7adb371b266a"}, - {file = "websockets-13.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:61fc0dfcda609cda0fc9fe7977694c0c59cf9d749fbb17f4e9483929e3c48a19"}, - {file = "websockets-13.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ceec59f59d092c5007e815def4ebb80c2de330e9588e101cf8bd94c143ec78a5"}, - {file = "websockets-13.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c1dca61c6db1166c48b95198c0b7d9c990b30c756fc2923cc66f68d17dc558fd"}, - {file = "websockets-13.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:308e20f22c2c77f3f39caca508e765f8725020b84aa963474e18c59accbf4c02"}, - {file = "websockets-13.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62d516c325e6540e8a57b94abefc3459d7dab8ce52ac75c96cad5549e187e3a7"}, - {file = "websockets-13.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87c6e35319b46b99e168eb98472d6c7d8634ee37750d7693656dc766395df096"}, - {file = "websockets-13.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:5f9fee94ebafbc3117c30be1844ed01a3b177bb6e39088bc6b2fa1dc15572084"}, - {file = "websockets-13.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:7c1e90228c2f5cdde263253fa5db63e6653f1c00e7ec64108065a0b9713fa1b3"}, - {file = "websockets-13.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6548f29b0e401eea2b967b2fdc1c7c7b5ebb3eeb470ed23a54cd45ef078a0db9"}, - {file = "websockets-13.1-cp311-cp311-win32.whl", hash = "sha256:c11d4d16e133f6df8916cc5b7e3e96ee4c44c936717d684a94f48f82edb7c92f"}, - {file = "websockets-13.1-cp311-cp311-win_amd64.whl", hash = "sha256:d04f13a1d75cb2b8382bdc16ae6fa58c97337253826dfe136195b7f89f661557"}, - {file = "websockets-13.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:9d75baf00138f80b48f1eac72ad1535aac0b6461265a0bcad391fc5aba875cfc"}, - {file = "websockets-13.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:9b6f347deb3dcfbfde1c20baa21c2ac0751afaa73e64e5b693bb2b848efeaa49"}, - {file = "websockets-13.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:de58647e3f9c42f13f90ac7e5f58900c80a39019848c5547bc691693098ae1bd"}, - {file = "websockets-13.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1b54689e38d1279a51d11e3467dd2f3a50f5f2e879012ce8f2d6943f00e83f0"}, - {file = "websockets-13.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cf1781ef73c073e6b0f90af841aaf98501f975d306bbf6221683dd594ccc52b6"}, - {file = "websockets-13.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d23b88b9388ed85c6faf0e74d8dec4f4d3baf3ecf20a65a47b836d56260d4b9"}, - {file = "websockets-13.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3c78383585f47ccb0fcf186dcb8a43f5438bd7d8f47d69e0b56f71bf431a0a68"}, - {file = "websockets-13.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:d6d300f8ec35c24025ceb9b9019ae9040c1ab2f01cddc2bcc0b518af31c75c14"}, - {file = "websockets-13.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a9dcaf8b0cc72a392760bb8755922c03e17a5a54e08cca58e8b74f6902b433cf"}, - {file = "websockets-13.1-cp312-cp312-win32.whl", hash = "sha256:2f85cf4f2a1ba8f602298a853cec8526c2ca42a9a4b947ec236eaedb8f2dc80c"}, - {file = "websockets-13.1-cp312-cp312-win_amd64.whl", hash = "sha256:38377f8b0cdeee97c552d20cf1865695fcd56aba155ad1b4ca8779a5b6ef4ac3"}, - {file = "websockets-13.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:a9ab1e71d3d2e54a0aa646ab6d4eebfaa5f416fe78dfe4da2839525dc5d765c6"}, - {file = "websockets-13.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:b9d7439d7fab4dce00570bb906875734df13d9faa4b48e261c440a5fec6d9708"}, - {file = "websockets-13.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:327b74e915cf13c5931334c61e1a41040e365d380f812513a255aa804b183418"}, - {file = "websockets-13.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:325b1ccdbf5e5725fdcb1b0e9ad4d2545056479d0eee392c291c1bf76206435a"}, - {file = "websockets-13.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:346bee67a65f189e0e33f520f253d5147ab76ae42493804319b5716e46dddf0f"}, - {file = "websockets-13.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:91a0fa841646320ec0d3accdff5b757b06e2e5c86ba32af2e0815c96c7a603c5"}, - {file = "websockets-13.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:18503d2c5f3943e93819238bf20df71982d193f73dcecd26c94514f417f6b135"}, - {file = "websockets-13.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:a9cd1af7e18e5221d2878378fbc287a14cd527fdd5939ed56a18df8a31136bb2"}, - {file = "websockets-13.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:70c5be9f416aa72aab7a2a76c90ae0a4fe2755c1816c153c1a2bcc3333ce4ce6"}, - {file = "websockets-13.1-cp313-cp313-win32.whl", hash = "sha256:624459daabeb310d3815b276c1adef475b3e6804abaf2d9d2c061c319f7f187d"}, - {file = "websockets-13.1-cp313-cp313-win_amd64.whl", hash = "sha256:c518e84bb59c2baae725accd355c8dc517b4a3ed8db88b4bc93c78dae2974bf2"}, - {file = "websockets-13.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:c7934fd0e920e70468e676fe7f1b7261c1efa0d6c037c6722278ca0228ad9d0d"}, - {file = "websockets-13.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:149e622dc48c10ccc3d2760e5f36753db9cacf3ad7bc7bbbfd7d9c819e286f23"}, - {file = "websockets-13.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a569eb1b05d72f9bce2ebd28a1ce2054311b66677fcd46cf36204ad23acead8c"}, - {file = "websockets-13.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:95df24ca1e1bd93bbca51d94dd049a984609687cb2fb08a7f2c56ac84e9816ea"}, - {file = "websockets-13.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d8dbb1bf0c0a4ae8b40bdc9be7f644e2f3fb4e8a9aca7145bfa510d4a374eeb7"}, - {file = "websockets-13.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:035233b7531fb92a76beefcbf479504db8c72eb3bff41da55aecce3a0f729e54"}, - {file = "websockets-13.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:e4450fc83a3df53dec45922b576e91e94f5578d06436871dce3a6be38e40f5db"}, - {file = "websockets-13.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:463e1c6ec853202dd3657f156123d6b4dad0c546ea2e2e38be2b3f7c5b8e7295"}, - {file = "websockets-13.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:6d6855bbe70119872c05107e38fbc7f96b1d8cb047d95c2c50869a46c65a8e96"}, - {file = "websockets-13.1-cp38-cp38-win32.whl", hash = "sha256:204e5107f43095012b00f1451374693267adbb832d29966a01ecc4ce1db26faf"}, - {file = "websockets-13.1-cp38-cp38-win_amd64.whl", hash = "sha256:485307243237328c022bc908b90e4457d0daa8b5cf4b3723fd3c4a8012fce4c6"}, - {file = "websockets-13.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:9b37c184f8b976f0c0a231a5f3d6efe10807d41ccbe4488df8c74174805eea7d"}, - {file = "websockets-13.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:163e7277e1a0bd9fb3c8842a71661ad19c6aa7bb3d6678dc7f89b17fbcc4aeb7"}, - {file = "websockets-13.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4b889dbd1342820cc210ba44307cf75ae5f2f96226c0038094455a96e64fb07a"}, - {file = "websockets-13.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:586a356928692c1fed0eca68b4d1c2cbbd1ca2acf2ac7e7ebd3b9052582deefa"}, - {file = "websockets-13.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7bd6abf1e070a6b72bfeb71049d6ad286852e285f146682bf30d0296f5fbadfa"}, - {file = "websockets-13.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2aad13a200e5934f5a6767492fb07151e1de1d6079c003ab31e1823733ae79"}, - {file = "websockets-13.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:df01aea34b6e9e33572c35cd16bae5a47785e7d5c8cb2b54b2acdb9678315a17"}, - {file = "websockets-13.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:e54affdeb21026329fb0744ad187cf812f7d3c2aa702a5edb562b325191fcab6"}, - {file = "websockets-13.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:9ef8aa8bdbac47f4968a5d66462a2a0935d044bf35c0e5a8af152d58516dbeb5"}, - {file = "websockets-13.1-cp39-cp39-win32.whl", hash = "sha256:deeb929efe52bed518f6eb2ddc00cc496366a14c726005726ad62c2dd9017a3c"}, - {file = "websockets-13.1-cp39-cp39-win_amd64.whl", hash = "sha256:7c65ffa900e7cc958cd088b9a9157a8141c991f8c53d11087e6fb7277a03f81d"}, - {file = "websockets-13.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:5dd6da9bec02735931fccec99d97c29f47cc61f644264eb995ad6c0c27667238"}, - {file = "websockets-13.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:2510c09d8e8df777177ee3d40cd35450dc169a81e747455cc4197e63f7e7bfe5"}, - {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1c3cf67185543730888b20682fb186fc8d0fa6f07ccc3ef4390831ab4b388d9"}, - {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bcc03c8b72267e97b49149e4863d57c2d77f13fae12066622dc78fe322490fe6"}, - {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:004280a140f220c812e65f36944a9ca92d766b6cc4560be652a0a3883a79ed8a"}, - {file = "websockets-13.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:e2620453c075abeb0daa949a292e19f56de518988e079c36478bacf9546ced23"}, - {file = "websockets-13.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:9156c45750b37337f7b0b00e6248991a047be4aa44554c9886fe6bdd605aab3b"}, - {file = "websockets-13.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:80c421e07973a89fbdd93e6f2003c17d20b69010458d3a8e37fb47874bd67d51"}, - {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:82d0ba76371769d6a4e56f7e83bb8e81846d17a6190971e38b5de108bde9b0d7"}, - {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e9875a0143f07d74dc5e1ded1c4581f0d9f7ab86c78994e2ed9e95050073c94d"}, - {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a11e38ad8922c7961447f35c7b17bffa15de4d17c70abd07bfbe12d6faa3e027"}, - {file = "websockets-13.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:4059f790b6ae8768471cddb65d3c4fe4792b0ab48e154c9f0a04cefaabcd5978"}, - {file = "websockets-13.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:25c35bf84bf7c7369d247f0b8cfa157f989862c49104c5cf85cb5436a641d93e"}, - {file = "websockets-13.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:83f91d8a9bb404b8c2c41a707ac7f7f75b9442a0a876df295de27251a856ad09"}, - {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7a43cfdcddd07f4ca2b1afb459824dd3c6d53a51410636a2c7fc97b9a8cf4842"}, - {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:48a2ef1381632a2f0cb4efeff34efa97901c9fbc118e01951ad7cfc10601a9bb"}, - {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:459bf774c754c35dbb487360b12c5727adab887f1622b8aed5755880a21c4a20"}, - {file = "websockets-13.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:95858ca14a9f6fa8413d29e0a585b31b278388aa775b8a81fa24830123874678"}, - {file = "websockets-13.1-py3-none-any.whl", hash = "sha256:a9a396a6ad26130cdae92ae10c36af09d9bfe6cafe69670fd3b6da9b07b4044f"}, - {file = "websockets-13.1.tar.gz", hash = "sha256:a3b3366087c1bc0a2795111edcadddb8b3b59509d5db5d7ea3fdd69f954a8878"}, -] - [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "f0ca4e1b4e25a2c0c414483a6ee1a2d19c97ee1fc920fd71b264efaa4d3ad99b" +content-hash = "bab34812d8b562ff6f64a656292646c46f472e19bcba8e27cf347d906b2bd51f" diff --git a/pyproject.toml b/pyproject.toml index 57b255e9..48a10a21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "deepgram-sdk" -version = "6.0.0-beta.3" +version = "5.3.2" description = "" readme = "README.md" authors = [] @@ -41,7 +41,6 @@ httpx = ">=0.21.2" pydantic = ">= 1.9.2" pydantic-core = ">=2.18.2" typing_extensions = ">= 4.0.0" -websockets = ">=12.0" [tool.poetry.group.dev.dependencies] mypy = "==1.13.0" diff --git a/reference.md b/reference.md index 88320ddc..8f2f33a3 100644 --- a/reference.md +++ b/reference.md @@ -1,6 +1,6 @@ # Reference ## Agent V1 Settings Think Models -
client.agent.v1.settings.think.models.list() -> AsyncHttpResponse[AgentThinkModelsV1Response] +
client.agent.v1.settings.think.models.list() -> AsyncHttpResponse[AgentThinkModelsV1Response]
@@ -61,7 +61,7 @@ client.agent.v1.settings.think.models.list()
## Auth V1 Tokens -
client.auth.v1.tokens.grant(...) -> AsyncHttpResponse[GrantV1Response] +
client.auth.v1.tokens.grant(...) -> AsyncHttpResponse[GrantV1Response]
@@ -130,7 +130,7 @@ client.auth.v1.tokens.grant()
## Listen V1 Media -
client.listen.v1.media.transcribe_url(...) -> AsyncHttpResponse[MediaTranscribeResponse] +
client.listen.v1.media.transcribe_url(...) -> AsyncHttpResponse[MediaTranscribeResponse]
@@ -523,7 +523,7 @@ client.listen.v1.media.transcribe_url(
-
client.listen.v1.media.transcribe_file(...) -> AsyncHttpResponse[MediaTranscribeResponse] +
client.listen.v1.media.transcribe_file(...) -> AsyncHttpResponse[MediaTranscribeResponse]
@@ -880,7 +880,7 @@ client.listen.v1.media.transcribe_file()
## Manage V1 Models -
client.manage.v1.models.list(...) -> AsyncHttpResponse[ListModelsV1Response] +
client.manage.v1.models.list(...) -> AsyncHttpResponse[ListModelsV1Response]
@@ -950,7 +950,7 @@ client.manage.v1.models.list(
-
client.manage.v1.models.get(...) -> AsyncHttpResponse[GetModelV1Response] +
client.manage.v1.models.get(...) -> AsyncHttpResponse[GetModelV1Response]
@@ -1021,7 +1021,7 @@ client.manage.v1.models.get(
## Manage V1 Projects -
client.manage.v1.projects.list() -> AsyncHttpResponse[ListProjectsV1Response] +
client.manage.v1.projects.list() -> AsyncHttpResponse[ListProjectsV1Response]
@@ -1081,7 +1081,7 @@ client.manage.v1.projects.list()
-
client.manage.v1.projects.get(...) -> AsyncHttpResponse[GetProjectV1Response] +
client.manage.v1.projects.get(...) -> AsyncHttpResponse[GetProjectV1Response]
@@ -1169,7 +1169,7 @@ client.manage.v1.projects.get(
-
client.manage.v1.projects.delete(...) -> AsyncHttpResponse[DeleteProjectV1Response] +
client.manage.v1.projects.delete(...) -> AsyncHttpResponse[DeleteProjectV1Response]
@@ -1239,7 +1239,7 @@ client.manage.v1.projects.delete(
-
client.manage.v1.projects.update(...) -> AsyncHttpResponse[UpdateProjectV1Response] +
client.manage.v1.projects.update(...) -> AsyncHttpResponse[UpdateProjectV1Response]
@@ -1317,7 +1317,7 @@ client.manage.v1.projects.update(
-
client.manage.v1.projects.leave(...) -> AsyncHttpResponse[LeaveProjectV1Response] +
client.manage.v1.projects.leave(...) -> AsyncHttpResponse[LeaveProjectV1Response]
@@ -1388,7 +1388,7 @@ client.manage.v1.projects.leave(
## Manage V1 Projects Keys -
client.manage.v1.projects.keys.list(...) -> AsyncHttpResponse[ListProjectKeysV1Response] +
client.manage.v1.projects.keys.list(...) -> AsyncHttpResponse[ListProjectKeysV1Response]
@@ -1467,7 +1467,7 @@ client.manage.v1.projects.keys.list(
-
client.manage.v1.projects.keys.create(...) -> AsyncHttpResponse[CreateKeyV1Response] +
client.manage.v1.projects.keys.create(...) -> AsyncHttpResponse[CreateKeyV1Response]
@@ -1546,7 +1546,7 @@ client.manage.v1.projects.keys.create(
-
client.manage.v1.projects.keys.get(...) -> AsyncHttpResponse[GetProjectKeyV1Response] +
client.manage.v1.projects.keys.get(...) -> AsyncHttpResponse[GetProjectKeyV1Response]
@@ -1625,7 +1625,7 @@ client.manage.v1.projects.keys.get(
-
client.manage.v1.projects.keys.delete(...) -> AsyncHttpResponse[DeleteProjectKeyV1Response] +
client.manage.v1.projects.keys.delete(...) -> AsyncHttpResponse[DeleteProjectKeyV1Response]
@@ -1705,7 +1705,7 @@ client.manage.v1.projects.keys.delete(
## Manage V1 Projects Members -
client.manage.v1.projects.members.list(...) -> AsyncHttpResponse[ListProjectMembersV1Response] +
client.manage.v1.projects.members.list(...) -> AsyncHttpResponse[ListProjectMembersV1Response]
@@ -1775,7 +1775,7 @@ client.manage.v1.projects.members.list(
-
client.manage.v1.projects.members.delete(...) -> AsyncHttpResponse[DeleteProjectMemberV1Response] +
client.manage.v1.projects.members.delete(...) -> AsyncHttpResponse[DeleteProjectMemberV1Response]
@@ -1855,7 +1855,7 @@ client.manage.v1.projects.members.delete(
## Manage V1 Projects Models -
client.manage.v1.projects.models.list(...) -> AsyncHttpResponse[ListModelsV1Response] +
client.manage.v1.projects.models.list(...) -> AsyncHttpResponse[ListModelsV1Response]
@@ -1934,7 +1934,7 @@ client.manage.v1.projects.models.list(
-
client.manage.v1.projects.models.get(...) -> AsyncHttpResponse[GetModelV1Response] +
client.manage.v1.projects.models.get(...) -> AsyncHttpResponse[GetModelV1Response]
@@ -2014,7 +2014,7 @@ client.manage.v1.projects.models.get(
## Manage V1 Projects Requests -
client.manage.v1.projects.requests.list(...) -> AsyncHttpResponse[ListProjectRequestsV1Response] +
client.manage.v1.projects.requests.list(...) -> AsyncHttpResponse[ListProjectRequestsV1Response]
@@ -2180,7 +2180,7 @@ client.manage.v1.projects.requests.list(
-
client.manage.v1.projects.requests.get(...) -> AsyncHttpResponse[GetProjectRequestV1Response] +
client.manage.v1.projects.requests.get(...) -> AsyncHttpResponse[GetProjectRequestV1Response]
@@ -2260,7 +2260,7 @@ client.manage.v1.projects.requests.get(
## Manage V1 Projects Usage -
client.manage.v1.projects.usage.get(...) -> AsyncHttpResponse[UsageV1Response] +
client.manage.v1.projects.usage.get(...) -> AsyncHttpResponse[UsageV1Response]
@@ -2727,7 +2727,7 @@ client.manage.v1.projects.usage.get(
## Manage V1 Projects Billing Balances -
client.manage.v1.projects.billing.balances.list(...) -> AsyncHttpResponse[ListProjectBalancesV1Response] +
client.manage.v1.projects.billing.balances.list(...) -> AsyncHttpResponse[ListProjectBalancesV1Response]
@@ -2797,7 +2797,7 @@ client.manage.v1.projects.billing.balances.list(
-
client.manage.v1.projects.billing.balances.get(...) -> AsyncHttpResponse[GetProjectBalanceV1Response] +
client.manage.v1.projects.billing.balances.get(...) -> AsyncHttpResponse[GetProjectBalanceV1Response]
@@ -2877,7 +2877,7 @@ client.manage.v1.projects.billing.balances.get(
## Manage V1 Projects Billing Breakdown -
client.manage.v1.projects.billing.breakdown.list(...) -> AsyncHttpResponse[BillingBreakdownV1Response] +
client.manage.v1.projects.billing.breakdown.list(...) -> AsyncHttpResponse[BillingBreakdownV1Response]
@@ -3015,7 +3015,7 @@ client.manage.v1.projects.billing.breakdown.list(
## Manage V1 Projects Billing Fields -
client.manage.v1.projects.billing.fields.list(...) -> AsyncHttpResponse[ListBillingFieldsV1Response] +
client.manage.v1.projects.billing.fields.list(...) -> AsyncHttpResponse[ListBillingFieldsV1Response]
@@ -3104,7 +3104,7 @@ client.manage.v1.projects.billing.fields.list(
## Manage V1 Projects Billing Purchases -
client.manage.v1.projects.billing.purchases.list(...) -> AsyncHttpResponse[ListProjectPurchasesV1Response] +
client.manage.v1.projects.billing.purchases.list(...) -> AsyncHttpResponse[ListProjectPurchasesV1Response]
@@ -3184,7 +3184,7 @@ client.manage.v1.projects.billing.purchases.list(
## Manage V1 Projects Members Invites -
client.manage.v1.projects.members.invites.list(...) -> AsyncHttpResponse[ListProjectInvitesV1Response] +
client.manage.v1.projects.members.invites.list(...) -> AsyncHttpResponse[ListProjectInvitesV1Response]
@@ -3254,7 +3254,7 @@ client.manage.v1.projects.members.invites.list(
-
client.manage.v1.projects.members.invites.create(...) -> AsyncHttpResponse[CreateProjectInviteV1Response] +
client.manage.v1.projects.members.invites.create(...) -> AsyncHttpResponse[CreateProjectInviteV1Response]
@@ -3342,7 +3342,7 @@ client.manage.v1.projects.members.invites.create(
-
client.manage.v1.projects.members.invites.delete(...) -> AsyncHttpResponse[DeleteProjectInviteV1Response] +
client.manage.v1.projects.members.invites.delete(...) -> AsyncHttpResponse[DeleteProjectInviteV1Response]
@@ -3422,7 +3422,7 @@ client.manage.v1.projects.members.invites.delete(
## Manage V1 Projects Members Scopes -
client.manage.v1.projects.members.scopes.list(...) -> AsyncHttpResponse[ListProjectMemberScopesV1Response] +
client.manage.v1.projects.members.scopes.list(...) -> AsyncHttpResponse[ListProjectMemberScopesV1Response]
@@ -3501,7 +3501,7 @@ client.manage.v1.projects.members.scopes.list(
-
client.manage.v1.projects.members.scopes.update(...) -> AsyncHttpResponse[UpdateProjectMemberScopesV1Response] +
client.manage.v1.projects.members.scopes.update(...) -> AsyncHttpResponse[UpdateProjectMemberScopesV1Response]
@@ -3590,7 +3590,7 @@ client.manage.v1.projects.members.scopes.update(
## Manage V1 Projects Usage Breakdown -
client.manage.v1.projects.usage.breakdown.get(...) -> AsyncHttpResponse[UsageBreakdownV1Response] +
client.manage.v1.projects.usage.breakdown.get(...) -> AsyncHttpResponse[UsageBreakdownV1Response]
@@ -4066,7 +4066,7 @@ client.manage.v1.projects.usage.breakdown.get(
## Manage V1 Projects Usage Fields -
client.manage.v1.projects.usage.fields.list(...) -> AsyncHttpResponse[UsageFieldsV1Response] +
client.manage.v1.projects.usage.fields.list(...) -> AsyncHttpResponse[UsageFieldsV1Response]
@@ -4155,7 +4155,7 @@ client.manage.v1.projects.usage.fields.list(
## Read V1 Text -
client.read.v1.text.analyze(...) -> AsyncHttpResponse[ReadV1Response] +
client.read.v1.text.analyze(...) -> AsyncHttpResponse[ReadV1Response]
@@ -4334,7 +4334,7 @@ client.read.v1.text.analyze(
## SelfHosted V1 DistributionCredentials -
client.self_hosted.v1.distribution_credentials.list(...) -> AsyncHttpResponse[ListProjectDistributionCredentialsV1Response] +
client.self_hosted.v1.distribution_credentials.list(...) -> AsyncHttpResponse[ListProjectDistributionCredentialsV1Response]
@@ -4404,7 +4404,7 @@ client.self_hosted.v1.distribution_credentials.list(
-
client.self_hosted.v1.distribution_credentials.create(...) -> AsyncHttpResponse[CreateProjectDistributionCredentialsV1Response] +
client.self_hosted.v1.distribution_credentials.create(...) -> AsyncHttpResponse[CreateProjectDistributionCredentialsV1Response]
@@ -4503,7 +4503,7 @@ client.self_hosted.v1.distribution_credentials.create(
-
client.self_hosted.v1.distribution_credentials.get(...) -> AsyncHttpResponse[GetProjectDistributionCredentialsV1Response] +
client.self_hosted.v1.distribution_credentials.get(...) -> AsyncHttpResponse[GetProjectDistributionCredentialsV1Response]
@@ -4582,7 +4582,7 @@ client.self_hosted.v1.distribution_credentials.get(
-
client.self_hosted.v1.distribution_credentials.delete(...) -> AsyncHttpResponse[GetProjectDistributionCredentialsV1Response] +
client.self_hosted.v1.distribution_credentials.delete(...) -> AsyncHttpResponse[GetProjectDistributionCredentialsV1Response]
@@ -4662,7 +4662,7 @@ client.self_hosted.v1.distribution_credentials.delete(
## Speak V1 Audio -
client.speak.v1.audio.generate(...) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] +
client.speak.v1.audio.generate(...) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]
diff --git a/requirements.txt b/requirements.txt index 4c0f6431..e80f640a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,3 @@ httpx>=0.21.2 pydantic>= 1.9.2 pydantic-core>=2.18.2 typing_extensions>= 4.0.0 -websockets>=12.0 diff --git a/src/deepgram/__init__.py b/src/deepgram/__init__.py index 548f35cb..ebb89072 100644 --- a/src/deepgram/__init__.py +++ b/src/deepgram/__init__.py @@ -78,27 +78,6 @@ ListProjectsV1Response, ListProjectsV1ResponseProjectsItem, ListenV1AcceptedResponse, - ListenV1Callback, - ListenV1CallbackMethod, - ListenV1Channels, - ListenV1DetectEntities, - ListenV1Diarize, - ListenV1Dictation, - ListenV1Encoding, - ListenV1Endpointing, - ListenV1Extra, - ListenV1InterimResults, - ListenV1Keyterm, - ListenV1Keywords, - ListenV1Language, - ListenV1MipOptOut, - ListenV1Model, - ListenV1Multichannel, - ListenV1Numerals, - ListenV1ProfanityFilter, - ListenV1Punctuate, - ListenV1Redact, - ListenV1Replace, ListenV1RequestFile, ListenV1Response, ListenV1ResponseMetadata, @@ -123,22 +102,6 @@ ListenV1ResponseResultsUtterances, ListenV1ResponseResultsUtterancesItem, ListenV1ResponseResultsUtterancesItemWordsItem, - ListenV1SampleRate, - ListenV1Search, - ListenV1SmartFormat, - ListenV1Tag, - ListenV1UtteranceEndMs, - ListenV1VadEvents, - ListenV1Version, - ListenV2EagerEotThreshold, - ListenV2Encoding, - ListenV2EotThreshold, - ListenV2EotTimeoutMs, - ListenV2Keyterm, - ListenV2MipOptOut, - ListenV2Model, - ListenV2SampleRate, - ListenV2Tag, ProjectRequestResponse, ReadV1Request, ReadV1RequestText, @@ -167,11 +130,7 @@ SharedTopicsResultsTopics, SharedTopicsResultsTopicsSegmentsItem, SharedTopicsResultsTopicsSegmentsItemTopicsItem, - SpeakV1Encoding, - SpeakV1MipOptOut, - SpeakV1Model, SpeakV1Response, - SpeakV1SampleRate, UpdateProjectMemberScopesV1Response, UpdateProjectV1Response, UsageBreakdownV1Response, @@ -276,7 +235,6 @@ ListenV1ResponseResultsUtterancesItemParams, ListenV1ResponseResultsUtterancesItemWordsItemParams, ListenV1ResponseResultsUtterancesParams, - ListenV2KeytermParams, ProjectRequestResponseParams, ReadV1RequestParams, ReadV1RequestTextParams, @@ -458,27 +416,6 @@ "ListProjectsV1ResponseProjectsItemParams": ".requests", "ListenV1AcceptedResponse": ".types", "ListenV1AcceptedResponseParams": ".requests", - "ListenV1Callback": ".types", - "ListenV1CallbackMethod": ".types", - "ListenV1Channels": ".types", - "ListenV1DetectEntities": ".types", - "ListenV1Diarize": ".types", - "ListenV1Dictation": ".types", - "ListenV1Encoding": ".types", - "ListenV1Endpointing": ".types", - "ListenV1Extra": ".types", - "ListenV1InterimResults": ".types", - "ListenV1Keyterm": ".types", - "ListenV1Keywords": ".types", - "ListenV1Language": ".types", - "ListenV1MipOptOut": ".types", - "ListenV1Model": ".types", - "ListenV1Multichannel": ".types", - "ListenV1Numerals": ".types", - "ListenV1ProfanityFilter": ".types", - "ListenV1Punctuate": ".types", - "ListenV1Redact": ".types", - "ListenV1Replace": ".types", "ListenV1RequestFile": ".types", "ListenV1Response": ".types", "ListenV1ResponseMetadata": ".types", @@ -526,23 +463,6 @@ "ListenV1ResponseResultsUtterancesItemWordsItem": ".types", "ListenV1ResponseResultsUtterancesItemWordsItemParams": ".requests", "ListenV1ResponseResultsUtterancesParams": ".requests", - "ListenV1SampleRate": ".types", - "ListenV1Search": ".types", - "ListenV1SmartFormat": ".types", - "ListenV1Tag": ".types", - "ListenV1UtteranceEndMs": ".types", - "ListenV1VadEvents": ".types", - "ListenV1Version": ".types", - "ListenV2EagerEotThreshold": ".types", - "ListenV2Encoding": ".types", - "ListenV2EotThreshold": ".types", - "ListenV2EotTimeoutMs": ".types", - "ListenV2Keyterm": ".types", - "ListenV2KeytermParams": ".requests", - "ListenV2MipOptOut": ".types", - "ListenV2Model": ".types", - "ListenV2SampleRate": ".types", - "ListenV2Tag": ".types", "ProjectRequestResponse": ".types", "ProjectRequestResponseParams": ".requests", "ReadV1Request": ".types", @@ -599,11 +519,7 @@ "SharedTopicsResultsTopicsSegmentsItemParams": ".requests", "SharedTopicsResultsTopicsSegmentsItemTopicsItem": ".types", "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams": ".requests", - "SpeakV1Encoding": ".types", - "SpeakV1MipOptOut": ".types", - "SpeakV1Model": ".types", "SpeakV1Response": ".types", - "SpeakV1SampleRate": ".types", "UpdateProjectMemberScopesV1Response": ".types", "UpdateProjectMemberScopesV1ResponseParams": ".requests", "UpdateProjectV1Response": ".types", @@ -797,27 +713,6 @@ def __dir__(): "ListProjectsV1ResponseProjectsItemParams", "ListenV1AcceptedResponse", "ListenV1AcceptedResponseParams", - "ListenV1Callback", - "ListenV1CallbackMethod", - "ListenV1Channels", - "ListenV1DetectEntities", - "ListenV1Diarize", - "ListenV1Dictation", - "ListenV1Encoding", - "ListenV1Endpointing", - "ListenV1Extra", - "ListenV1InterimResults", - "ListenV1Keyterm", - "ListenV1Keywords", - "ListenV1Language", - "ListenV1MipOptOut", - "ListenV1Model", - "ListenV1Multichannel", - "ListenV1Numerals", - "ListenV1ProfanityFilter", - "ListenV1Punctuate", - "ListenV1Redact", - "ListenV1Replace", "ListenV1RequestFile", "ListenV1Response", "ListenV1ResponseMetadata", @@ -865,23 +760,6 @@ def __dir__(): "ListenV1ResponseResultsUtterancesItemWordsItem", "ListenV1ResponseResultsUtterancesItemWordsItemParams", "ListenV1ResponseResultsUtterancesParams", - "ListenV1SampleRate", - "ListenV1Search", - "ListenV1SmartFormat", - "ListenV1Tag", - "ListenV1UtteranceEndMs", - "ListenV1VadEvents", - "ListenV1Version", - "ListenV2EagerEotThreshold", - "ListenV2Encoding", - "ListenV2EotThreshold", - "ListenV2EotTimeoutMs", - "ListenV2Keyterm", - "ListenV2KeytermParams", - "ListenV2MipOptOut", - "ListenV2Model", - "ListenV2SampleRate", - "ListenV2Tag", "ProjectRequestResponse", "ProjectRequestResponseParams", "ReadV1Request", @@ -938,11 +816,7 @@ def __dir__(): "SharedTopicsResultsTopicsSegmentsItemParams", "SharedTopicsResultsTopicsSegmentsItemTopicsItem", "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", - "SpeakV1Encoding", - "SpeakV1MipOptOut", - "SpeakV1Model", "SpeakV1Response", - "SpeakV1SampleRate", "UpdateProjectMemberScopesV1Response", "UpdateProjectMemberScopesV1ResponseParams", "UpdateProjectV1Response", diff --git a/src/deepgram/agent/__init__.py b/src/deepgram/agent/__init__.py index 6ed13aa0..148ad154 100644 --- a/src/deepgram/agent/__init__.py +++ b/src/deepgram/agent/__init__.py @@ -7,461 +7,7 @@ if typing.TYPE_CHECKING: from . import v1 - from .v1 import ( - AgentV1AgentAudioDone, - AgentV1AgentAudioDoneParams, - AgentV1AgentStartedSpeaking, - AgentV1AgentStartedSpeakingParams, - AgentV1AgentThinking, - AgentV1AgentThinkingParams, - AgentV1ConversationText, - AgentV1ConversationTextParams, - AgentV1ConversationTextRole, - AgentV1Error, - AgentV1ErrorParams, - AgentV1FunctionCallRequest, - AgentV1FunctionCallRequestFunctionsItem, - AgentV1FunctionCallRequestFunctionsItemParams, - AgentV1FunctionCallRequestParams, - AgentV1InjectAgentMessage, - AgentV1InjectAgentMessageParams, - AgentV1InjectUserMessage, - AgentV1InjectUserMessageParams, - AgentV1InjectionRefused, - AgentV1InjectionRefusedParams, - AgentV1KeepAlive, - AgentV1KeepAliveParams, - AgentV1PromptUpdated, - AgentV1PromptUpdatedParams, - AgentV1ReceiveFunctionCallResponse, - AgentV1ReceiveFunctionCallResponseParams, - AgentV1SendFunctionCallResponse, - AgentV1SendFunctionCallResponseParams, - AgentV1Settings, - AgentV1SettingsAgent, - AgentV1SettingsAgentContext, - AgentV1SettingsAgentContextMessagesItem, - AgentV1SettingsAgentContextMessagesItemContent, - AgentV1SettingsAgentContextMessagesItemContentParams, - AgentV1SettingsAgentContextMessagesItemContentRole, - AgentV1SettingsAgentContextMessagesItemFunctionCalls, - AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem, - AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams, - AgentV1SettingsAgentContextMessagesItemFunctionCallsParams, - AgentV1SettingsAgentContextMessagesItemParams, - AgentV1SettingsAgentContextParams, - AgentV1SettingsAgentListen, - AgentV1SettingsAgentListenParams, - AgentV1SettingsAgentListenProvider, - AgentV1SettingsAgentListenProviderParams, - AgentV1SettingsAgentListenProviderV1, - AgentV1SettingsAgentListenProviderV1Params, - AgentV1SettingsAgentListenProviderV2, - AgentV1SettingsAgentListenProviderV2Params, - AgentV1SettingsAgentListenProvider_V1, - AgentV1SettingsAgentListenProvider_V1Params, - AgentV1SettingsAgentListenProvider_V2, - AgentV1SettingsAgentListenProvider_V2Params, - AgentV1SettingsAgentParams, - AgentV1SettingsAgentSpeak, - AgentV1SettingsAgentSpeakEndpoint, - AgentV1SettingsAgentSpeakEndpointEndpoint, - AgentV1SettingsAgentSpeakEndpointEndpointParams, - AgentV1SettingsAgentSpeakEndpointParams, - AgentV1SettingsAgentSpeakEndpointProvider, - AgentV1SettingsAgentSpeakEndpointProviderAwsPolly, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice, - AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId, - AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice, - AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams, - AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel, - AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId, - AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel, - AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice, - AgentV1SettingsAgentSpeakEndpointProviderParams, - AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly, - AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams, - AgentV1SettingsAgentSpeakEndpointProvider_Cartesia, - AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams, - AgentV1SettingsAgentSpeakEndpointProvider_Deepgram, - AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams, - AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs, - AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams, - AgentV1SettingsAgentSpeakEndpointProvider_OpenAi, - AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams, - AgentV1SettingsAgentSpeakOneItem, - AgentV1SettingsAgentSpeakOneItemEndpoint, - AgentV1SettingsAgentSpeakOneItemEndpointParams, - AgentV1SettingsAgentSpeakOneItemParams, - AgentV1SettingsAgentSpeakOneItemProvider, - AgentV1SettingsAgentSpeakOneItemProviderAwsPolly, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice, - AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId, - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice, - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams, - AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel, - AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId, - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, - AgentV1SettingsAgentSpeakOneItemProviderParams, - AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly, - AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams, - AgentV1SettingsAgentSpeakOneItemProvider_Cartesia, - AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams, - AgentV1SettingsAgentSpeakOneItemProvider_Deepgram, - AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams, - AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs, - AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams, - AgentV1SettingsAgentSpeakOneItemProvider_OpenAi, - AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams, - AgentV1SettingsAgentSpeakParams, - AgentV1SettingsAgentThink, - AgentV1SettingsAgentThinkContextLength, - AgentV1SettingsAgentThinkContextLengthParams, - AgentV1SettingsAgentThinkEndpoint, - AgentV1SettingsAgentThinkEndpointParams, - AgentV1SettingsAgentThinkFunctionsItem, - AgentV1SettingsAgentThinkFunctionsItemEndpoint, - AgentV1SettingsAgentThinkFunctionsItemEndpointParams, - AgentV1SettingsAgentThinkFunctionsItemParams, - AgentV1SettingsAgentThinkParams, - AgentV1SettingsAgentThinkProvider, - AgentV1SettingsAgentThinkProviderAnthropicModel, - AgentV1SettingsAgentThinkProviderAwsBedrock, - AgentV1SettingsAgentThinkProviderAwsBedrockCredentials, - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams, - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType, - AgentV1SettingsAgentThinkProviderAwsBedrockModel, - AgentV1SettingsAgentThinkProviderAwsBedrockParams, - AgentV1SettingsAgentThinkProviderGoogleModel, - AgentV1SettingsAgentThinkProviderOpenAiModel, - AgentV1SettingsAgentThinkProviderParams, - AgentV1SettingsAgentThinkProvider_Anthropic, - AgentV1SettingsAgentThinkProvider_AnthropicParams, - AgentV1SettingsAgentThinkProvider_AwsBedrock, - AgentV1SettingsAgentThinkProvider_AwsBedrockParams, - AgentV1SettingsAgentThinkProvider_Google, - AgentV1SettingsAgentThinkProvider_GoogleParams, - AgentV1SettingsAgentThinkProvider_Groq, - AgentV1SettingsAgentThinkProvider_GroqParams, - AgentV1SettingsAgentThinkProvider_OpenAi, - AgentV1SettingsAgentThinkProvider_OpenAiParams, - AgentV1SettingsApplied, - AgentV1SettingsAppliedParams, - AgentV1SettingsAudio, - AgentV1SettingsAudioInput, - AgentV1SettingsAudioInputEncoding, - AgentV1SettingsAudioInputParams, - AgentV1SettingsAudioOutput, - AgentV1SettingsAudioOutputEncoding, - AgentV1SettingsAudioOutputParams, - AgentV1SettingsAudioParams, - AgentV1SettingsFlags, - AgentV1SettingsFlagsParams, - AgentV1SettingsParams, - AgentV1SpeakUpdated, - AgentV1SpeakUpdatedParams, - AgentV1UpdatePrompt, - AgentV1UpdatePromptParams, - AgentV1UpdateSpeak, - AgentV1UpdateSpeakParams, - AgentV1UpdateSpeakSpeak, - AgentV1UpdateSpeakSpeakEndpoint, - AgentV1UpdateSpeakSpeakEndpointParams, - AgentV1UpdateSpeakSpeakParams, - AgentV1UpdateSpeakSpeakProvider, - AgentV1UpdateSpeakSpeakProviderAwsPolly, - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials, - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams, - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType, - AgentV1UpdateSpeakSpeakProviderAwsPollyEngine, - AgentV1UpdateSpeakSpeakProviderAwsPollyParams, - AgentV1UpdateSpeakSpeakProviderAwsPollyVoice, - AgentV1UpdateSpeakSpeakProviderCartesia, - AgentV1UpdateSpeakSpeakProviderCartesiaModelId, - AgentV1UpdateSpeakSpeakProviderCartesiaParams, - AgentV1UpdateSpeakSpeakProviderCartesiaVoice, - AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams, - AgentV1UpdateSpeakSpeakProviderDeepgram, - AgentV1UpdateSpeakSpeakProviderDeepgramModel, - AgentV1UpdateSpeakSpeakProviderDeepgramParams, - AgentV1UpdateSpeakSpeakProviderElevenLabs, - AgentV1UpdateSpeakSpeakProviderElevenLabsModelId, - AgentV1UpdateSpeakSpeakProviderElevenLabsParams, - AgentV1UpdateSpeakSpeakProviderOpenAi, - AgentV1UpdateSpeakSpeakProviderOpenAiModel, - AgentV1UpdateSpeakSpeakProviderOpenAiParams, - AgentV1UpdateSpeakSpeakProviderOpenAiVoice, - AgentV1UpdateSpeakSpeakProviderParams, - AgentV1UpdateSpeakSpeakProvider_AwsPolly, - AgentV1UpdateSpeakSpeakProvider_AwsPollyParams, - AgentV1UpdateSpeakSpeakProvider_Cartesia, - AgentV1UpdateSpeakSpeakProvider_CartesiaParams, - AgentV1UpdateSpeakSpeakProvider_Deepgram, - AgentV1UpdateSpeakSpeakProvider_DeepgramParams, - AgentV1UpdateSpeakSpeakProvider_ElevenLabs, - AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams, - AgentV1UpdateSpeakSpeakProvider_OpenAi, - AgentV1UpdateSpeakSpeakProvider_OpenAiParams, - AgentV1UserStartedSpeaking, - AgentV1UserStartedSpeakingParams, - AgentV1Warning, - AgentV1WarningParams, - AgentV1Welcome, - AgentV1WelcomeParams, - Anthropic, - AnthropicParams, - Cartesia, - CartesiaParams, - Deepgram, - DeepgramParams, - ElevenLabs, - ElevenLabsParams, - Google, - GoogleParams, - Groq, - GroqParams, - OpenAi, - OpenAiParams, - ) -_dynamic_imports: typing.Dict[str, str] = { - "AgentV1AgentAudioDone": ".v1", - "AgentV1AgentAudioDoneParams": ".v1", - "AgentV1AgentStartedSpeaking": ".v1", - "AgentV1AgentStartedSpeakingParams": ".v1", - "AgentV1AgentThinking": ".v1", - "AgentV1AgentThinkingParams": ".v1", - "AgentV1ConversationText": ".v1", - "AgentV1ConversationTextParams": ".v1", - "AgentV1ConversationTextRole": ".v1", - "AgentV1Error": ".v1", - "AgentV1ErrorParams": ".v1", - "AgentV1FunctionCallRequest": ".v1", - "AgentV1FunctionCallRequestFunctionsItem": ".v1", - "AgentV1FunctionCallRequestFunctionsItemParams": ".v1", - "AgentV1FunctionCallRequestParams": ".v1", - "AgentV1InjectAgentMessage": ".v1", - "AgentV1InjectAgentMessageParams": ".v1", - "AgentV1InjectUserMessage": ".v1", - "AgentV1InjectUserMessageParams": ".v1", - "AgentV1InjectionRefused": ".v1", - "AgentV1InjectionRefusedParams": ".v1", - "AgentV1KeepAlive": ".v1", - "AgentV1KeepAliveParams": ".v1", - "AgentV1PromptUpdated": ".v1", - "AgentV1PromptUpdatedParams": ".v1", - "AgentV1ReceiveFunctionCallResponse": ".v1", - "AgentV1ReceiveFunctionCallResponseParams": ".v1", - "AgentV1SendFunctionCallResponse": ".v1", - "AgentV1SendFunctionCallResponseParams": ".v1", - "AgentV1Settings": ".v1", - "AgentV1SettingsAgent": ".v1", - "AgentV1SettingsAgentContext": ".v1", - "AgentV1SettingsAgentContextMessagesItem": ".v1", - "AgentV1SettingsAgentContextMessagesItemContent": ".v1", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".v1", - "AgentV1SettingsAgentContextMessagesItemParams": ".v1", - "AgentV1SettingsAgentContextParams": ".v1", - "AgentV1SettingsAgentListen": ".v1", - "AgentV1SettingsAgentListenParams": ".v1", - "AgentV1SettingsAgentListenProvider": ".v1", - "AgentV1SettingsAgentListenProviderParams": ".v1", - "AgentV1SettingsAgentListenProviderV1": ".v1", - "AgentV1SettingsAgentListenProviderV1Params": ".v1", - "AgentV1SettingsAgentListenProviderV2": ".v1", - "AgentV1SettingsAgentListenProviderV2Params": ".v1", - "AgentV1SettingsAgentListenProvider_V1": ".v1", - "AgentV1SettingsAgentListenProvider_V1Params": ".v1", - "AgentV1SettingsAgentListenProvider_V2": ".v1", - "AgentV1SettingsAgentListenProvider_V2Params": ".v1", - "AgentV1SettingsAgentParams": ".v1", - "AgentV1SettingsAgentSpeak": ".v1", - "AgentV1SettingsAgentSpeakEndpoint": ".v1", - "AgentV1SettingsAgentSpeakEndpointEndpoint": ".v1", - "AgentV1SettingsAgentSpeakEndpointEndpointParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPolly": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice": ".v1", - "AgentV1SettingsAgentSpeakEndpointProviderParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_Cartesia": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_Deepgram": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAi": ".v1", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams": ".v1", - "AgentV1SettingsAgentSpeakOneItem": ".v1", - "AgentV1SettingsAgentSpeakOneItemEndpoint": ".v1", - "AgentV1SettingsAgentSpeakOneItemEndpointParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPolly": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice": ".v1", - "AgentV1SettingsAgentSpeakOneItemProviderParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_Cartesia": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_Deepgram": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAi": ".v1", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams": ".v1", - "AgentV1SettingsAgentSpeakParams": ".v1", - "AgentV1SettingsAgentThink": ".v1", - "AgentV1SettingsAgentThinkContextLength": ".v1", - "AgentV1SettingsAgentThinkContextLengthParams": ".v1", - "AgentV1SettingsAgentThinkEndpoint": ".v1", - "AgentV1SettingsAgentThinkEndpointParams": ".v1", - "AgentV1SettingsAgentThinkFunctionsItem": ".v1", - "AgentV1SettingsAgentThinkFunctionsItemEndpoint": ".v1", - "AgentV1SettingsAgentThinkFunctionsItemEndpointParams": ".v1", - "AgentV1SettingsAgentThinkFunctionsItemParams": ".v1", - "AgentV1SettingsAgentThinkParams": ".v1", - "AgentV1SettingsAgentThinkProvider": ".v1", - "AgentV1SettingsAgentThinkProviderAnthropicModel": ".v1", - "AgentV1SettingsAgentThinkProviderAwsBedrock": ".v1", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentials": ".v1", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams": ".v1", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType": ".v1", - "AgentV1SettingsAgentThinkProviderAwsBedrockModel": ".v1", - "AgentV1SettingsAgentThinkProviderAwsBedrockParams": ".v1", - "AgentV1SettingsAgentThinkProviderGoogleModel": ".v1", - "AgentV1SettingsAgentThinkProviderOpenAiModel": ".v1", - "AgentV1SettingsAgentThinkProviderParams": ".v1", - "AgentV1SettingsAgentThinkProvider_Anthropic": ".v1", - "AgentV1SettingsAgentThinkProvider_AnthropicParams": ".v1", - "AgentV1SettingsAgentThinkProvider_AwsBedrock": ".v1", - "AgentV1SettingsAgentThinkProvider_AwsBedrockParams": ".v1", - "AgentV1SettingsAgentThinkProvider_Google": ".v1", - "AgentV1SettingsAgentThinkProvider_GoogleParams": ".v1", - "AgentV1SettingsAgentThinkProvider_Groq": ".v1", - "AgentV1SettingsAgentThinkProvider_GroqParams": ".v1", - "AgentV1SettingsAgentThinkProvider_OpenAi": ".v1", - "AgentV1SettingsAgentThinkProvider_OpenAiParams": ".v1", - "AgentV1SettingsApplied": ".v1", - "AgentV1SettingsAppliedParams": ".v1", - "AgentV1SettingsAudio": ".v1", - "AgentV1SettingsAudioInput": ".v1", - "AgentV1SettingsAudioInputEncoding": ".v1", - "AgentV1SettingsAudioInputParams": ".v1", - "AgentV1SettingsAudioOutput": ".v1", - "AgentV1SettingsAudioOutputEncoding": ".v1", - "AgentV1SettingsAudioOutputParams": ".v1", - "AgentV1SettingsAudioParams": ".v1", - "AgentV1SettingsFlags": ".v1", - "AgentV1SettingsFlagsParams": ".v1", - "AgentV1SettingsParams": ".v1", - "AgentV1SpeakUpdated": ".v1", - "AgentV1SpeakUpdatedParams": ".v1", - "AgentV1UpdatePrompt": ".v1", - "AgentV1UpdatePromptParams": ".v1", - "AgentV1UpdateSpeak": ".v1", - "AgentV1UpdateSpeakParams": ".v1", - "AgentV1UpdateSpeakSpeak": ".v1", - "AgentV1UpdateSpeakSpeakEndpoint": ".v1", - "AgentV1UpdateSpeakSpeakEndpointParams": ".v1", - "AgentV1UpdateSpeakSpeakParams": ".v1", - "AgentV1UpdateSpeakSpeakProvider": ".v1", - "AgentV1UpdateSpeakSpeakProviderAwsPolly": ".v1", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials": ".v1", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams": ".v1", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType": ".v1", - "AgentV1UpdateSpeakSpeakProviderAwsPollyEngine": ".v1", - "AgentV1UpdateSpeakSpeakProviderAwsPollyParams": ".v1", - "AgentV1UpdateSpeakSpeakProviderAwsPollyVoice": ".v1", - "AgentV1UpdateSpeakSpeakProviderCartesia": ".v1", - "AgentV1UpdateSpeakSpeakProviderCartesiaModelId": ".v1", - "AgentV1UpdateSpeakSpeakProviderCartesiaParams": ".v1", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoice": ".v1", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams": ".v1", - "AgentV1UpdateSpeakSpeakProviderDeepgram": ".v1", - "AgentV1UpdateSpeakSpeakProviderDeepgramModel": ".v1", - "AgentV1UpdateSpeakSpeakProviderDeepgramParams": ".v1", - "AgentV1UpdateSpeakSpeakProviderElevenLabs": ".v1", - "AgentV1UpdateSpeakSpeakProviderElevenLabsModelId": ".v1", - "AgentV1UpdateSpeakSpeakProviderElevenLabsParams": ".v1", - "AgentV1UpdateSpeakSpeakProviderOpenAi": ".v1", - "AgentV1UpdateSpeakSpeakProviderOpenAiModel": ".v1", - "AgentV1UpdateSpeakSpeakProviderOpenAiParams": ".v1", - "AgentV1UpdateSpeakSpeakProviderOpenAiVoice": ".v1", - "AgentV1UpdateSpeakSpeakProviderParams": ".v1", - "AgentV1UpdateSpeakSpeakProvider_AwsPolly": ".v1", - "AgentV1UpdateSpeakSpeakProvider_AwsPollyParams": ".v1", - "AgentV1UpdateSpeakSpeakProvider_Cartesia": ".v1", - "AgentV1UpdateSpeakSpeakProvider_CartesiaParams": ".v1", - "AgentV1UpdateSpeakSpeakProvider_Deepgram": ".v1", - "AgentV1UpdateSpeakSpeakProvider_DeepgramParams": ".v1", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabs": ".v1", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams": ".v1", - "AgentV1UpdateSpeakSpeakProvider_OpenAi": ".v1", - "AgentV1UpdateSpeakSpeakProvider_OpenAiParams": ".v1", - "AgentV1UserStartedSpeaking": ".v1", - "AgentV1UserStartedSpeakingParams": ".v1", - "AgentV1Warning": ".v1", - "AgentV1WarningParams": ".v1", - "AgentV1Welcome": ".v1", - "AgentV1WelcomeParams": ".v1", - "Anthropic": ".v1", - "AnthropicParams": ".v1", - "Cartesia": ".v1", - "CartesiaParams": ".v1", - "Deepgram": ".v1", - "DeepgramParams": ".v1", - "ElevenLabs": ".v1", - "ElevenLabsParams": ".v1", - "Google": ".v1", - "GoogleParams": ".v1", - "Groq": ".v1", - "GroqParams": ".v1", - "OpenAi": ".v1", - "OpenAiParams": ".v1", - "v1": ".v1", -} +_dynamic_imports: typing.Dict[str, str] = {"v1": ".v1"} def __getattr__(attr_name: str) -> typing.Any: @@ -485,231 +31,4 @@ def __dir__(): return sorted(lazy_attrs) -__all__ = [ - "AgentV1AgentAudioDone", - "AgentV1AgentAudioDoneParams", - "AgentV1AgentStartedSpeaking", - "AgentV1AgentStartedSpeakingParams", - "AgentV1AgentThinking", - "AgentV1AgentThinkingParams", - "AgentV1ConversationText", - "AgentV1ConversationTextParams", - "AgentV1ConversationTextRole", - "AgentV1Error", - "AgentV1ErrorParams", - "AgentV1FunctionCallRequest", - "AgentV1FunctionCallRequestFunctionsItem", - "AgentV1FunctionCallRequestFunctionsItemParams", - "AgentV1FunctionCallRequestParams", - "AgentV1InjectAgentMessage", - "AgentV1InjectAgentMessageParams", - "AgentV1InjectUserMessage", - "AgentV1InjectUserMessageParams", - "AgentV1InjectionRefused", - "AgentV1InjectionRefusedParams", - "AgentV1KeepAlive", - "AgentV1KeepAliveParams", - "AgentV1PromptUpdated", - "AgentV1PromptUpdatedParams", - "AgentV1ReceiveFunctionCallResponse", - "AgentV1ReceiveFunctionCallResponseParams", - "AgentV1SendFunctionCallResponse", - "AgentV1SendFunctionCallResponseParams", - "AgentV1Settings", - "AgentV1SettingsAgent", - "AgentV1SettingsAgentContext", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemParams", - "AgentV1SettingsAgentContextParams", - "AgentV1SettingsAgentListen", - "AgentV1SettingsAgentListenParams", - "AgentV1SettingsAgentListenProvider", - "AgentV1SettingsAgentListenProviderParams", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2", - "AgentV1SettingsAgentListenProviderV2Params", - "AgentV1SettingsAgentListenProvider_V1", - "AgentV1SettingsAgentListenProvider_V1Params", - "AgentV1SettingsAgentListenProvider_V2", - "AgentV1SettingsAgentListenProvider_V2Params", - "AgentV1SettingsAgentParams", - "AgentV1SettingsAgentSpeak", - "AgentV1SettingsAgentSpeakEndpoint", - "AgentV1SettingsAgentSpeakEndpointEndpoint", - "AgentV1SettingsAgentSpeakEndpointEndpointParams", - "AgentV1SettingsAgentSpeakEndpointParams", - "AgentV1SettingsAgentSpeakEndpointProvider", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPolly", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams", - "AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel", - "AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice", - "AgentV1SettingsAgentSpeakEndpointProviderParams", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams", - "AgentV1SettingsAgentSpeakEndpointProvider_Cartesia", - "AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams", - "AgentV1SettingsAgentSpeakEndpointProvider_Deepgram", - "AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAi", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams", - "AgentV1SettingsAgentSpeakOneItem", - "AgentV1SettingsAgentSpeakOneItemEndpoint", - "AgentV1SettingsAgentSpeakOneItemEndpointParams", - "AgentV1SettingsAgentSpeakOneItemParams", - "AgentV1SettingsAgentSpeakOneItemProvider", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPolly", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams", - "AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel", - "AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice", - "AgentV1SettingsAgentSpeakOneItemProviderParams", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams", - "AgentV1SettingsAgentSpeakOneItemProvider_Cartesia", - "AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams", - "AgentV1SettingsAgentSpeakOneItemProvider_Deepgram", - "AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAi", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams", - "AgentV1SettingsAgentSpeakParams", - "AgentV1SettingsAgentThink", - "AgentV1SettingsAgentThinkContextLength", - "AgentV1SettingsAgentThinkContextLengthParams", - "AgentV1SettingsAgentThinkEndpoint", - "AgentV1SettingsAgentThinkEndpointParams", - "AgentV1SettingsAgentThinkFunctionsItem", - "AgentV1SettingsAgentThinkFunctionsItemEndpoint", - "AgentV1SettingsAgentThinkFunctionsItemEndpointParams", - "AgentV1SettingsAgentThinkFunctionsItemParams", - "AgentV1SettingsAgentThinkParams", - "AgentV1SettingsAgentThinkProvider", - "AgentV1SettingsAgentThinkProviderAnthropicModel", - "AgentV1SettingsAgentThinkProviderAwsBedrock", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentials", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType", - "AgentV1SettingsAgentThinkProviderAwsBedrockModel", - "AgentV1SettingsAgentThinkProviderAwsBedrockParams", - "AgentV1SettingsAgentThinkProviderGoogleModel", - "AgentV1SettingsAgentThinkProviderOpenAiModel", - "AgentV1SettingsAgentThinkProviderParams", - "AgentV1SettingsAgentThinkProvider_Anthropic", - "AgentV1SettingsAgentThinkProvider_AnthropicParams", - "AgentV1SettingsAgentThinkProvider_AwsBedrock", - "AgentV1SettingsAgentThinkProvider_AwsBedrockParams", - "AgentV1SettingsAgentThinkProvider_Google", - "AgentV1SettingsAgentThinkProvider_GoogleParams", - "AgentV1SettingsAgentThinkProvider_Groq", - "AgentV1SettingsAgentThinkProvider_GroqParams", - "AgentV1SettingsAgentThinkProvider_OpenAi", - "AgentV1SettingsAgentThinkProvider_OpenAiParams", - "AgentV1SettingsApplied", - "AgentV1SettingsAppliedParams", - "AgentV1SettingsAudio", - "AgentV1SettingsAudioInput", - "AgentV1SettingsAudioInputEncoding", - "AgentV1SettingsAudioInputParams", - "AgentV1SettingsAudioOutput", - "AgentV1SettingsAudioOutputEncoding", - "AgentV1SettingsAudioOutputParams", - "AgentV1SettingsAudioParams", - "AgentV1SettingsFlags", - "AgentV1SettingsFlagsParams", - "AgentV1SettingsParams", - "AgentV1SpeakUpdated", - "AgentV1SpeakUpdatedParams", - "AgentV1UpdatePrompt", - "AgentV1UpdatePromptParams", - "AgentV1UpdateSpeak", - "AgentV1UpdateSpeakParams", - "AgentV1UpdateSpeakSpeak", - "AgentV1UpdateSpeakSpeakEndpoint", - "AgentV1UpdateSpeakSpeakEndpointParams", - "AgentV1UpdateSpeakSpeakParams", - "AgentV1UpdateSpeakSpeakProvider", - "AgentV1UpdateSpeakSpeakProviderAwsPolly", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType", - "AgentV1UpdateSpeakSpeakProviderAwsPollyEngine", - "AgentV1UpdateSpeakSpeakProviderAwsPollyParams", - "AgentV1UpdateSpeakSpeakProviderAwsPollyVoice", - "AgentV1UpdateSpeakSpeakProviderCartesia", - "AgentV1UpdateSpeakSpeakProviderCartesiaModelId", - "AgentV1UpdateSpeakSpeakProviderCartesiaParams", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoice", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams", - "AgentV1UpdateSpeakSpeakProviderDeepgram", - "AgentV1UpdateSpeakSpeakProviderDeepgramModel", - "AgentV1UpdateSpeakSpeakProviderDeepgramParams", - "AgentV1UpdateSpeakSpeakProviderElevenLabs", - "AgentV1UpdateSpeakSpeakProviderElevenLabsModelId", - "AgentV1UpdateSpeakSpeakProviderElevenLabsParams", - "AgentV1UpdateSpeakSpeakProviderOpenAi", - "AgentV1UpdateSpeakSpeakProviderOpenAiModel", - "AgentV1UpdateSpeakSpeakProviderOpenAiParams", - "AgentV1UpdateSpeakSpeakProviderOpenAiVoice", - "AgentV1UpdateSpeakSpeakProviderParams", - "AgentV1UpdateSpeakSpeakProvider_AwsPolly", - "AgentV1UpdateSpeakSpeakProvider_AwsPollyParams", - "AgentV1UpdateSpeakSpeakProvider_Cartesia", - "AgentV1UpdateSpeakSpeakProvider_CartesiaParams", - "AgentV1UpdateSpeakSpeakProvider_Deepgram", - "AgentV1UpdateSpeakSpeakProvider_DeepgramParams", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabs", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams", - "AgentV1UpdateSpeakSpeakProvider_OpenAi", - "AgentV1UpdateSpeakSpeakProvider_OpenAiParams", - "AgentV1UserStartedSpeaking", - "AgentV1UserStartedSpeakingParams", - "AgentV1Warning", - "AgentV1WarningParams", - "AgentV1Welcome", - "AgentV1WelcomeParams", - "Anthropic", - "AnthropicParams", - "Cartesia", - "CartesiaParams", - "Deepgram", - "DeepgramParams", - "ElevenLabs", - "ElevenLabsParams", - "Google", - "GoogleParams", - "Groq", - "GroqParams", - "OpenAi", - "OpenAiParams", - "v1", -] +__all__ = ["v1"] diff --git a/src/deepgram/agent/client.py b/src/deepgram/agent/client.py index 04a324ea..8565ff01 100644 --- a/src/deepgram/agent/client.py +++ b/src/deepgram/agent/client.py @@ -5,7 +5,6 @@ import typing from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawAgentClient, RawAgentClient if typing.TYPE_CHECKING: from .v1.client import AsyncV1Client, V1Client @@ -13,21 +12,9 @@ class AgentClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawAgentClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[V1Client] = None - @property - def with_raw_response(self) -> RawAgentClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawAgentClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: @@ -39,21 +26,9 @@ def v1(self): class AsyncAgentClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawAgentClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[AsyncV1Client] = None - @property - def with_raw_response(self) -> AsyncRawAgentClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawAgentClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: diff --git a/src/deepgram/agent/raw_client.py b/src/deepgram/agent/raw_client.py deleted file mode 100644 index 5b0817de..00000000 --- a/src/deepgram/agent/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawAgentClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawAgentClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/agent/v1/__init__.py b/src/deepgram/agent/v1/__init__.py index 2c4025de..31fcb147 100644 --- a/src/deepgram/agent/v1/__init__.py +++ b/src/deepgram/agent/v1/__init__.py @@ -6,464 +6,8 @@ from importlib import import_module if typing.TYPE_CHECKING: - from .types import ( - AgentV1AgentAudioDone, - AgentV1AgentStartedSpeaking, - AgentV1AgentThinking, - AgentV1ConversationText, - AgentV1ConversationTextRole, - AgentV1Error, - AgentV1FunctionCallRequest, - AgentV1FunctionCallRequestFunctionsItem, - AgentV1InjectAgentMessage, - AgentV1InjectUserMessage, - AgentV1InjectionRefused, - AgentV1KeepAlive, - AgentV1PromptUpdated, - AgentV1ReceiveFunctionCallResponse, - AgentV1SendFunctionCallResponse, - AgentV1Settings, - AgentV1SettingsAgent, - AgentV1SettingsAgentContext, - AgentV1SettingsAgentContextMessagesItem, - AgentV1SettingsAgentContextMessagesItemContent, - AgentV1SettingsAgentContextMessagesItemContentRole, - AgentV1SettingsAgentContextMessagesItemFunctionCalls, - AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem, - AgentV1SettingsAgentListen, - AgentV1SettingsAgentListenProvider, - AgentV1SettingsAgentListenProviderV1, - AgentV1SettingsAgentListenProviderV2, - AgentV1SettingsAgentListenProvider_V1, - AgentV1SettingsAgentListenProvider_V2, - AgentV1SettingsAgentSpeak, - AgentV1SettingsAgentSpeakEndpoint, - AgentV1SettingsAgentSpeakEndpointEndpoint, - AgentV1SettingsAgentSpeakEndpointProvider, - AgentV1SettingsAgentSpeakEndpointProviderAwsPolly, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice, - AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId, - AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice, - AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel, - AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId, - AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel, - AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice, - AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly, - AgentV1SettingsAgentSpeakEndpointProvider_Cartesia, - AgentV1SettingsAgentSpeakEndpointProvider_Deepgram, - AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs, - AgentV1SettingsAgentSpeakEndpointProvider_OpenAi, - AgentV1SettingsAgentSpeakOneItem, - AgentV1SettingsAgentSpeakOneItemEndpoint, - AgentV1SettingsAgentSpeakOneItemProvider, - AgentV1SettingsAgentSpeakOneItemProviderAwsPolly, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice, - AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId, - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice, - AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel, - AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId, - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, - AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly, - AgentV1SettingsAgentSpeakOneItemProvider_Cartesia, - AgentV1SettingsAgentSpeakOneItemProvider_Deepgram, - AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs, - AgentV1SettingsAgentSpeakOneItemProvider_OpenAi, - AgentV1SettingsAgentThink, - AgentV1SettingsAgentThinkContextLength, - AgentV1SettingsAgentThinkEndpoint, - AgentV1SettingsAgentThinkFunctionsItem, - AgentV1SettingsAgentThinkFunctionsItemEndpoint, - AgentV1SettingsAgentThinkProvider, - AgentV1SettingsAgentThinkProviderAnthropicModel, - AgentV1SettingsAgentThinkProviderAwsBedrock, - AgentV1SettingsAgentThinkProviderAwsBedrockCredentials, - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType, - AgentV1SettingsAgentThinkProviderAwsBedrockModel, - AgentV1SettingsAgentThinkProviderGoogleModel, - AgentV1SettingsAgentThinkProviderOpenAiModel, - AgentV1SettingsAgentThinkProvider_Anthropic, - AgentV1SettingsAgentThinkProvider_AwsBedrock, - AgentV1SettingsAgentThinkProvider_Google, - AgentV1SettingsAgentThinkProvider_Groq, - AgentV1SettingsAgentThinkProvider_OpenAi, - AgentV1SettingsApplied, - AgentV1SettingsAudio, - AgentV1SettingsAudioInput, - AgentV1SettingsAudioInputEncoding, - AgentV1SettingsAudioOutput, - AgentV1SettingsAudioOutputEncoding, - AgentV1SettingsFlags, - AgentV1SpeakUpdated, - AgentV1UpdatePrompt, - AgentV1UpdateSpeak, - AgentV1UpdateSpeakSpeak, - AgentV1UpdateSpeakSpeakEndpoint, - AgentV1UpdateSpeakSpeakProvider, - AgentV1UpdateSpeakSpeakProviderAwsPolly, - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials, - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType, - AgentV1UpdateSpeakSpeakProviderAwsPollyEngine, - AgentV1UpdateSpeakSpeakProviderAwsPollyVoice, - AgentV1UpdateSpeakSpeakProviderCartesia, - AgentV1UpdateSpeakSpeakProviderCartesiaModelId, - AgentV1UpdateSpeakSpeakProviderCartesiaVoice, - AgentV1UpdateSpeakSpeakProviderDeepgram, - AgentV1UpdateSpeakSpeakProviderDeepgramModel, - AgentV1UpdateSpeakSpeakProviderElevenLabs, - AgentV1UpdateSpeakSpeakProviderElevenLabsModelId, - AgentV1UpdateSpeakSpeakProviderOpenAi, - AgentV1UpdateSpeakSpeakProviderOpenAiModel, - AgentV1UpdateSpeakSpeakProviderOpenAiVoice, - AgentV1UpdateSpeakSpeakProvider_AwsPolly, - AgentV1UpdateSpeakSpeakProvider_Cartesia, - AgentV1UpdateSpeakSpeakProvider_Deepgram, - AgentV1UpdateSpeakSpeakProvider_ElevenLabs, - AgentV1UpdateSpeakSpeakProvider_OpenAi, - AgentV1UserStartedSpeaking, - AgentV1Warning, - AgentV1Welcome, - Anthropic, - Cartesia, - Deepgram, - ElevenLabs, - Google, - Groq, - OpenAi, - ) from . import settings - from .requests import ( - AgentV1AgentAudioDoneParams, - AgentV1AgentStartedSpeakingParams, - AgentV1AgentThinkingParams, - AgentV1ConversationTextParams, - AgentV1ErrorParams, - AgentV1FunctionCallRequestFunctionsItemParams, - AgentV1FunctionCallRequestParams, - AgentV1InjectAgentMessageParams, - AgentV1InjectUserMessageParams, - AgentV1InjectionRefusedParams, - AgentV1KeepAliveParams, - AgentV1PromptUpdatedParams, - AgentV1ReceiveFunctionCallResponseParams, - AgentV1SendFunctionCallResponseParams, - AgentV1SettingsAgentContextMessagesItemContentParams, - AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams, - AgentV1SettingsAgentContextMessagesItemFunctionCallsParams, - AgentV1SettingsAgentContextMessagesItemParams, - AgentV1SettingsAgentContextParams, - AgentV1SettingsAgentListenParams, - AgentV1SettingsAgentListenProviderParams, - AgentV1SettingsAgentListenProviderV1Params, - AgentV1SettingsAgentListenProviderV2Params, - AgentV1SettingsAgentListenProvider_V1Params, - AgentV1SettingsAgentListenProvider_V2Params, - AgentV1SettingsAgentParams, - AgentV1SettingsAgentSpeakEndpointEndpointParams, - AgentV1SettingsAgentSpeakEndpointParams, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams, - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams, - AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams, - AgentV1SettingsAgentSpeakEndpointProviderParams, - AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams, - AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams, - AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams, - AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams, - AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams, - AgentV1SettingsAgentSpeakOneItemEndpointParams, - AgentV1SettingsAgentSpeakOneItemParams, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams, - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams, - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams, - AgentV1SettingsAgentSpeakOneItemProviderParams, - AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams, - AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams, - AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams, - AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams, - AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams, - AgentV1SettingsAgentSpeakParams, - AgentV1SettingsAgentThinkContextLengthParams, - AgentV1SettingsAgentThinkEndpointParams, - AgentV1SettingsAgentThinkFunctionsItemEndpointParams, - AgentV1SettingsAgentThinkFunctionsItemParams, - AgentV1SettingsAgentThinkParams, - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams, - AgentV1SettingsAgentThinkProviderAwsBedrockParams, - AgentV1SettingsAgentThinkProviderParams, - AgentV1SettingsAgentThinkProvider_AnthropicParams, - AgentV1SettingsAgentThinkProvider_AwsBedrockParams, - AgentV1SettingsAgentThinkProvider_GoogleParams, - AgentV1SettingsAgentThinkProvider_GroqParams, - AgentV1SettingsAgentThinkProvider_OpenAiParams, - AgentV1SettingsAppliedParams, - AgentV1SettingsAudioInputParams, - AgentV1SettingsAudioOutputParams, - AgentV1SettingsAudioParams, - AgentV1SettingsFlagsParams, - AgentV1SettingsParams, - AgentV1SpeakUpdatedParams, - AgentV1UpdatePromptParams, - AgentV1UpdateSpeakParams, - AgentV1UpdateSpeakSpeakEndpointParams, - AgentV1UpdateSpeakSpeakParams, - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams, - AgentV1UpdateSpeakSpeakProviderAwsPollyParams, - AgentV1UpdateSpeakSpeakProviderCartesiaParams, - AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams, - AgentV1UpdateSpeakSpeakProviderDeepgramParams, - AgentV1UpdateSpeakSpeakProviderElevenLabsParams, - AgentV1UpdateSpeakSpeakProviderOpenAiParams, - AgentV1UpdateSpeakSpeakProviderParams, - AgentV1UpdateSpeakSpeakProvider_AwsPollyParams, - AgentV1UpdateSpeakSpeakProvider_CartesiaParams, - AgentV1UpdateSpeakSpeakProvider_DeepgramParams, - AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams, - AgentV1UpdateSpeakSpeakProvider_OpenAiParams, - AgentV1UserStartedSpeakingParams, - AgentV1WarningParams, - AgentV1WelcomeParams, - AnthropicParams, - CartesiaParams, - DeepgramParams, - ElevenLabsParams, - GoogleParams, - GroqParams, - OpenAiParams, - ) -_dynamic_imports: typing.Dict[str, str] = { - "AgentV1AgentAudioDone": ".types", - "AgentV1AgentAudioDoneParams": ".requests", - "AgentV1AgentStartedSpeaking": ".types", - "AgentV1AgentStartedSpeakingParams": ".requests", - "AgentV1AgentThinking": ".types", - "AgentV1AgentThinkingParams": ".requests", - "AgentV1ConversationText": ".types", - "AgentV1ConversationTextParams": ".requests", - "AgentV1ConversationTextRole": ".types", - "AgentV1Error": ".types", - "AgentV1ErrorParams": ".requests", - "AgentV1FunctionCallRequest": ".types", - "AgentV1FunctionCallRequestFunctionsItem": ".types", - "AgentV1FunctionCallRequestFunctionsItemParams": ".requests", - "AgentV1FunctionCallRequestParams": ".requests", - "AgentV1InjectAgentMessage": ".types", - "AgentV1InjectAgentMessageParams": ".requests", - "AgentV1InjectUserMessage": ".types", - "AgentV1InjectUserMessageParams": ".requests", - "AgentV1InjectionRefused": ".types", - "AgentV1InjectionRefusedParams": ".requests", - "AgentV1KeepAlive": ".types", - "AgentV1KeepAliveParams": ".requests", - "AgentV1PromptUpdated": ".types", - "AgentV1PromptUpdatedParams": ".requests", - "AgentV1ReceiveFunctionCallResponse": ".types", - "AgentV1ReceiveFunctionCallResponseParams": ".requests", - "AgentV1SendFunctionCallResponse": ".types", - "AgentV1SendFunctionCallResponseParams": ".requests", - "AgentV1Settings": ".types", - "AgentV1SettingsAgent": ".types", - "AgentV1SettingsAgentContext": ".types", - "AgentV1SettingsAgentContextMessagesItem": ".types", - "AgentV1SettingsAgentContextMessagesItemContent": ".types", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".types", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".requests", - "AgentV1SettingsAgentContextMessagesItemParams": ".requests", - "AgentV1SettingsAgentContextParams": ".requests", - "AgentV1SettingsAgentListen": ".types", - "AgentV1SettingsAgentListenParams": ".requests", - "AgentV1SettingsAgentListenProvider": ".types", - "AgentV1SettingsAgentListenProviderParams": ".requests", - "AgentV1SettingsAgentListenProviderV1": ".types", - "AgentV1SettingsAgentListenProviderV1Params": ".requests", - "AgentV1SettingsAgentListenProviderV2": ".types", - "AgentV1SettingsAgentListenProviderV2Params": ".requests", - "AgentV1SettingsAgentListenProvider_V1": ".types", - "AgentV1SettingsAgentListenProvider_V1Params": ".requests", - "AgentV1SettingsAgentListenProvider_V2": ".types", - "AgentV1SettingsAgentListenProvider_V2Params": ".requests", - "AgentV1SettingsAgentParams": ".requests", - "AgentV1SettingsAgentSpeak": ".types", - "AgentV1SettingsAgentSpeakEndpoint": ".types", - "AgentV1SettingsAgentSpeakEndpointEndpoint": ".types", - "AgentV1SettingsAgentSpeakEndpointEndpointParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointProvider": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPolly": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice": ".types", - "AgentV1SettingsAgentSpeakEndpointProviderParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly": ".types", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointProvider_Cartesia": ".types", - "AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointProvider_Deepgram": ".types", - "AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs": ".types", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams": ".requests", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAi": ".types", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams": ".requests", - "AgentV1SettingsAgentSpeakOneItem": ".types", - "AgentV1SettingsAgentSpeakOneItemEndpoint": ".types", - "AgentV1SettingsAgentSpeakOneItemEndpointParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemProvider": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPolly": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice": ".types", - "AgentV1SettingsAgentSpeakOneItemProviderParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly": ".types", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemProvider_Cartesia": ".types", - "AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemProvider_Deepgram": ".types", - "AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs": ".types", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams": ".requests", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAi": ".types", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams": ".requests", - "AgentV1SettingsAgentSpeakParams": ".requests", - "AgentV1SettingsAgentThink": ".types", - "AgentV1SettingsAgentThinkContextLength": ".types", - "AgentV1SettingsAgentThinkContextLengthParams": ".requests", - "AgentV1SettingsAgentThinkEndpoint": ".types", - "AgentV1SettingsAgentThinkEndpointParams": ".requests", - "AgentV1SettingsAgentThinkFunctionsItem": ".types", - "AgentV1SettingsAgentThinkFunctionsItemEndpoint": ".types", - "AgentV1SettingsAgentThinkFunctionsItemEndpointParams": ".requests", - "AgentV1SettingsAgentThinkFunctionsItemParams": ".requests", - "AgentV1SettingsAgentThinkParams": ".requests", - "AgentV1SettingsAgentThinkProvider": ".types", - "AgentV1SettingsAgentThinkProviderAnthropicModel": ".types", - "AgentV1SettingsAgentThinkProviderAwsBedrock": ".types", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentials": ".types", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams": ".requests", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType": ".types", - "AgentV1SettingsAgentThinkProviderAwsBedrockModel": ".types", - "AgentV1SettingsAgentThinkProviderAwsBedrockParams": ".requests", - "AgentV1SettingsAgentThinkProviderGoogleModel": ".types", - "AgentV1SettingsAgentThinkProviderOpenAiModel": ".types", - "AgentV1SettingsAgentThinkProviderParams": ".requests", - "AgentV1SettingsAgentThinkProvider_Anthropic": ".types", - "AgentV1SettingsAgentThinkProvider_AnthropicParams": ".requests", - "AgentV1SettingsAgentThinkProvider_AwsBedrock": ".types", - "AgentV1SettingsAgentThinkProvider_AwsBedrockParams": ".requests", - "AgentV1SettingsAgentThinkProvider_Google": ".types", - "AgentV1SettingsAgentThinkProvider_GoogleParams": ".requests", - "AgentV1SettingsAgentThinkProvider_Groq": ".types", - "AgentV1SettingsAgentThinkProvider_GroqParams": ".requests", - "AgentV1SettingsAgentThinkProvider_OpenAi": ".types", - "AgentV1SettingsAgentThinkProvider_OpenAiParams": ".requests", - "AgentV1SettingsApplied": ".types", - "AgentV1SettingsAppliedParams": ".requests", - "AgentV1SettingsAudio": ".types", - "AgentV1SettingsAudioInput": ".types", - "AgentV1SettingsAudioInputEncoding": ".types", - "AgentV1SettingsAudioInputParams": ".requests", - "AgentV1SettingsAudioOutput": ".types", - "AgentV1SettingsAudioOutputEncoding": ".types", - "AgentV1SettingsAudioOutputParams": ".requests", - "AgentV1SettingsAudioParams": ".requests", - "AgentV1SettingsFlags": ".types", - "AgentV1SettingsFlagsParams": ".requests", - "AgentV1SettingsParams": ".requests", - "AgentV1SpeakUpdated": ".types", - "AgentV1SpeakUpdatedParams": ".requests", - "AgentV1UpdatePrompt": ".types", - "AgentV1UpdatePromptParams": ".requests", - "AgentV1UpdateSpeak": ".types", - "AgentV1UpdateSpeakParams": ".requests", - "AgentV1UpdateSpeakSpeak": ".types", - "AgentV1UpdateSpeakSpeakEndpoint": ".types", - "AgentV1UpdateSpeakSpeakEndpointParams": ".requests", - "AgentV1UpdateSpeakSpeakParams": ".requests", - "AgentV1UpdateSpeakSpeakProvider": ".types", - "AgentV1UpdateSpeakSpeakProviderAwsPolly": ".types", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials": ".types", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams": ".requests", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType": ".types", - "AgentV1UpdateSpeakSpeakProviderAwsPollyEngine": ".types", - "AgentV1UpdateSpeakSpeakProviderAwsPollyParams": ".requests", - "AgentV1UpdateSpeakSpeakProviderAwsPollyVoice": ".types", - "AgentV1UpdateSpeakSpeakProviderCartesia": ".types", - "AgentV1UpdateSpeakSpeakProviderCartesiaModelId": ".types", - "AgentV1UpdateSpeakSpeakProviderCartesiaParams": ".requests", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoice": ".types", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams": ".requests", - "AgentV1UpdateSpeakSpeakProviderDeepgram": ".types", - "AgentV1UpdateSpeakSpeakProviderDeepgramModel": ".types", - "AgentV1UpdateSpeakSpeakProviderDeepgramParams": ".requests", - "AgentV1UpdateSpeakSpeakProviderElevenLabs": ".types", - "AgentV1UpdateSpeakSpeakProviderElevenLabsModelId": ".types", - "AgentV1UpdateSpeakSpeakProviderElevenLabsParams": ".requests", - "AgentV1UpdateSpeakSpeakProviderOpenAi": ".types", - "AgentV1UpdateSpeakSpeakProviderOpenAiModel": ".types", - "AgentV1UpdateSpeakSpeakProviderOpenAiParams": ".requests", - "AgentV1UpdateSpeakSpeakProviderOpenAiVoice": ".types", - "AgentV1UpdateSpeakSpeakProviderParams": ".requests", - "AgentV1UpdateSpeakSpeakProvider_AwsPolly": ".types", - "AgentV1UpdateSpeakSpeakProvider_AwsPollyParams": ".requests", - "AgentV1UpdateSpeakSpeakProvider_Cartesia": ".types", - "AgentV1UpdateSpeakSpeakProvider_CartesiaParams": ".requests", - "AgentV1UpdateSpeakSpeakProvider_Deepgram": ".types", - "AgentV1UpdateSpeakSpeakProvider_DeepgramParams": ".requests", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabs": ".types", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams": ".requests", - "AgentV1UpdateSpeakSpeakProvider_OpenAi": ".types", - "AgentV1UpdateSpeakSpeakProvider_OpenAiParams": ".requests", - "AgentV1UserStartedSpeaking": ".types", - "AgentV1UserStartedSpeakingParams": ".requests", - "AgentV1Warning": ".types", - "AgentV1WarningParams": ".requests", - "AgentV1Welcome": ".types", - "AgentV1WelcomeParams": ".requests", - "Anthropic": ".types", - "AnthropicParams": ".requests", - "Cartesia": ".types", - "CartesiaParams": ".requests", - "Deepgram": ".types", - "DeepgramParams": ".requests", - "ElevenLabs": ".types", - "ElevenLabsParams": ".requests", - "Google": ".types", - "GoogleParams": ".requests", - "Groq": ".types", - "GroqParams": ".requests", - "OpenAi": ".types", - "OpenAiParams": ".requests", - "settings": ".settings", -} +_dynamic_imports: typing.Dict[str, str] = {"settings": ".settings"} def __getattr__(attr_name: str) -> typing.Any: @@ -487,231 +31,4 @@ def __dir__(): return sorted(lazy_attrs) -__all__ = [ - "AgentV1AgentAudioDone", - "AgentV1AgentAudioDoneParams", - "AgentV1AgentStartedSpeaking", - "AgentV1AgentStartedSpeakingParams", - "AgentV1AgentThinking", - "AgentV1AgentThinkingParams", - "AgentV1ConversationText", - "AgentV1ConversationTextParams", - "AgentV1ConversationTextRole", - "AgentV1Error", - "AgentV1ErrorParams", - "AgentV1FunctionCallRequest", - "AgentV1FunctionCallRequestFunctionsItem", - "AgentV1FunctionCallRequestFunctionsItemParams", - "AgentV1FunctionCallRequestParams", - "AgentV1InjectAgentMessage", - "AgentV1InjectAgentMessageParams", - "AgentV1InjectUserMessage", - "AgentV1InjectUserMessageParams", - "AgentV1InjectionRefused", - "AgentV1InjectionRefusedParams", - "AgentV1KeepAlive", - "AgentV1KeepAliveParams", - "AgentV1PromptUpdated", - "AgentV1PromptUpdatedParams", - "AgentV1ReceiveFunctionCallResponse", - "AgentV1ReceiveFunctionCallResponseParams", - "AgentV1SendFunctionCallResponse", - "AgentV1SendFunctionCallResponseParams", - "AgentV1Settings", - "AgentV1SettingsAgent", - "AgentV1SettingsAgentContext", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemParams", - "AgentV1SettingsAgentContextParams", - "AgentV1SettingsAgentListen", - "AgentV1SettingsAgentListenParams", - "AgentV1SettingsAgentListenProvider", - "AgentV1SettingsAgentListenProviderParams", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2", - "AgentV1SettingsAgentListenProviderV2Params", - "AgentV1SettingsAgentListenProvider_V1", - "AgentV1SettingsAgentListenProvider_V1Params", - "AgentV1SettingsAgentListenProvider_V2", - "AgentV1SettingsAgentListenProvider_V2Params", - "AgentV1SettingsAgentParams", - "AgentV1SettingsAgentSpeak", - "AgentV1SettingsAgentSpeakEndpoint", - "AgentV1SettingsAgentSpeakEndpointEndpoint", - "AgentV1SettingsAgentSpeakEndpointEndpointParams", - "AgentV1SettingsAgentSpeakEndpointParams", - "AgentV1SettingsAgentSpeakEndpointProvider", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPolly", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams", - "AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel", - "AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice", - "AgentV1SettingsAgentSpeakEndpointProviderParams", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams", - "AgentV1SettingsAgentSpeakEndpointProvider_Cartesia", - "AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams", - "AgentV1SettingsAgentSpeakEndpointProvider_Deepgram", - "AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAi", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams", - "AgentV1SettingsAgentSpeakOneItem", - "AgentV1SettingsAgentSpeakOneItemEndpoint", - "AgentV1SettingsAgentSpeakOneItemEndpointParams", - "AgentV1SettingsAgentSpeakOneItemParams", - "AgentV1SettingsAgentSpeakOneItemProvider", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPolly", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams", - "AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel", - "AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice", - "AgentV1SettingsAgentSpeakOneItemProviderParams", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams", - "AgentV1SettingsAgentSpeakOneItemProvider_Cartesia", - "AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams", - "AgentV1SettingsAgentSpeakOneItemProvider_Deepgram", - "AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAi", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams", - "AgentV1SettingsAgentSpeakParams", - "AgentV1SettingsAgentThink", - "AgentV1SettingsAgentThinkContextLength", - "AgentV1SettingsAgentThinkContextLengthParams", - "AgentV1SettingsAgentThinkEndpoint", - "AgentV1SettingsAgentThinkEndpointParams", - "AgentV1SettingsAgentThinkFunctionsItem", - "AgentV1SettingsAgentThinkFunctionsItemEndpoint", - "AgentV1SettingsAgentThinkFunctionsItemEndpointParams", - "AgentV1SettingsAgentThinkFunctionsItemParams", - "AgentV1SettingsAgentThinkParams", - "AgentV1SettingsAgentThinkProvider", - "AgentV1SettingsAgentThinkProviderAnthropicModel", - "AgentV1SettingsAgentThinkProviderAwsBedrock", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentials", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType", - "AgentV1SettingsAgentThinkProviderAwsBedrockModel", - "AgentV1SettingsAgentThinkProviderAwsBedrockParams", - "AgentV1SettingsAgentThinkProviderGoogleModel", - "AgentV1SettingsAgentThinkProviderOpenAiModel", - "AgentV1SettingsAgentThinkProviderParams", - "AgentV1SettingsAgentThinkProvider_Anthropic", - "AgentV1SettingsAgentThinkProvider_AnthropicParams", - "AgentV1SettingsAgentThinkProvider_AwsBedrock", - "AgentV1SettingsAgentThinkProvider_AwsBedrockParams", - "AgentV1SettingsAgentThinkProvider_Google", - "AgentV1SettingsAgentThinkProvider_GoogleParams", - "AgentV1SettingsAgentThinkProvider_Groq", - "AgentV1SettingsAgentThinkProvider_GroqParams", - "AgentV1SettingsAgentThinkProvider_OpenAi", - "AgentV1SettingsAgentThinkProvider_OpenAiParams", - "AgentV1SettingsApplied", - "AgentV1SettingsAppliedParams", - "AgentV1SettingsAudio", - "AgentV1SettingsAudioInput", - "AgentV1SettingsAudioInputEncoding", - "AgentV1SettingsAudioInputParams", - "AgentV1SettingsAudioOutput", - "AgentV1SettingsAudioOutputEncoding", - "AgentV1SettingsAudioOutputParams", - "AgentV1SettingsAudioParams", - "AgentV1SettingsFlags", - "AgentV1SettingsFlagsParams", - "AgentV1SettingsParams", - "AgentV1SpeakUpdated", - "AgentV1SpeakUpdatedParams", - "AgentV1UpdatePrompt", - "AgentV1UpdatePromptParams", - "AgentV1UpdateSpeak", - "AgentV1UpdateSpeakParams", - "AgentV1UpdateSpeakSpeak", - "AgentV1UpdateSpeakSpeakEndpoint", - "AgentV1UpdateSpeakSpeakEndpointParams", - "AgentV1UpdateSpeakSpeakParams", - "AgentV1UpdateSpeakSpeakProvider", - "AgentV1UpdateSpeakSpeakProviderAwsPolly", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType", - "AgentV1UpdateSpeakSpeakProviderAwsPollyEngine", - "AgentV1UpdateSpeakSpeakProviderAwsPollyParams", - "AgentV1UpdateSpeakSpeakProviderAwsPollyVoice", - "AgentV1UpdateSpeakSpeakProviderCartesia", - "AgentV1UpdateSpeakSpeakProviderCartesiaModelId", - "AgentV1UpdateSpeakSpeakProviderCartesiaParams", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoice", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams", - "AgentV1UpdateSpeakSpeakProviderDeepgram", - "AgentV1UpdateSpeakSpeakProviderDeepgramModel", - "AgentV1UpdateSpeakSpeakProviderDeepgramParams", - "AgentV1UpdateSpeakSpeakProviderElevenLabs", - "AgentV1UpdateSpeakSpeakProviderElevenLabsModelId", - "AgentV1UpdateSpeakSpeakProviderElevenLabsParams", - "AgentV1UpdateSpeakSpeakProviderOpenAi", - "AgentV1UpdateSpeakSpeakProviderOpenAiModel", - "AgentV1UpdateSpeakSpeakProviderOpenAiParams", - "AgentV1UpdateSpeakSpeakProviderOpenAiVoice", - "AgentV1UpdateSpeakSpeakProviderParams", - "AgentV1UpdateSpeakSpeakProvider_AwsPolly", - "AgentV1UpdateSpeakSpeakProvider_AwsPollyParams", - "AgentV1UpdateSpeakSpeakProvider_Cartesia", - "AgentV1UpdateSpeakSpeakProvider_CartesiaParams", - "AgentV1UpdateSpeakSpeakProvider_Deepgram", - "AgentV1UpdateSpeakSpeakProvider_DeepgramParams", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabs", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams", - "AgentV1UpdateSpeakSpeakProvider_OpenAi", - "AgentV1UpdateSpeakSpeakProvider_OpenAiParams", - "AgentV1UserStartedSpeaking", - "AgentV1UserStartedSpeakingParams", - "AgentV1Warning", - "AgentV1WarningParams", - "AgentV1Welcome", - "AgentV1WelcomeParams", - "Anthropic", - "AnthropicParams", - "Cartesia", - "CartesiaParams", - "Deepgram", - "DeepgramParams", - "ElevenLabs", - "ElevenLabsParams", - "Google", - "GoogleParams", - "Groq", - "GroqParams", - "OpenAi", - "OpenAiParams", - "settings", -] +__all__ = ["settings"] diff --git a/src/deepgram/agent/v1/client.py b/src/deepgram/agent/v1/client.py index 05f2854d..4ea379c0 100644 --- a/src/deepgram/agent/v1/client.py +++ b/src/deepgram/agent/v1/client.py @@ -3,86 +3,18 @@ from __future__ import annotations import typing -from contextlib import asynccontextmanager, contextmanager -import websockets.exceptions -import websockets.sync.client as websockets_sync_client -from ...core.api_error import ApiError from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.request_options import RequestOptions -from .raw_client import AsyncRawV1Client, RawV1Client -from .socket_client import AsyncV1SocketClient, V1SocketClient if typing.TYPE_CHECKING: from .settings.client import AsyncSettingsClient, SettingsClient -try: - from websockets.legacy.client import connect as websockets_client_connect # type: ignore -except ImportError: - from websockets import connect as websockets_client_connect # type: ignore - class V1Client: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._settings: typing.Optional[SettingsClient] = None - @property - def with_raw_response(self) -> RawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawV1Client - """ - return self._raw_client - - @contextmanager - def connect( - self, *, authorization: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None - ) -> typing.Iterator[V1SocketClient]: - """ - Build a conversational voice agent using Deepgram's Voice Agent WebSocket - - Parameters - ---------- - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - V1SocketClient - """ - ws_url = self._raw_client._client_wrapper.get_environment().agent + "/v1/agent/converse" - headers = self._raw_client._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - with websockets_sync_client.connect(ws_url, additional_headers=headers) as protocol: - yield V1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - @property def settings(self): if self._settings is None: @@ -94,65 +26,9 @@ def settings(self): class AsyncV1Client: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._settings: typing.Optional[AsyncSettingsClient] = None - @property - def with_raw_response(self) -> AsyncRawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawV1Client - """ - return self._raw_client - - @asynccontextmanager - async def connect( - self, *, authorization: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None - ) -> typing.AsyncIterator[AsyncV1SocketClient]: - """ - Build a conversational voice agent using Deepgram's Voice Agent WebSocket - - Parameters - ---------- - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncV1SocketClient - """ - ws_url = self._raw_client._client_wrapper.get_environment().agent + "/v1/agent/converse" - headers = self._raw_client._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - async with websockets_client_connect(ws_url, extra_headers=headers) as protocol: - yield AsyncV1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - @property def settings(self): if self._settings is None: diff --git a/src/deepgram/agent/v1/raw_client.py b/src/deepgram/agent/v1/raw_client.py deleted file mode 100644 index cd8e8d06..00000000 --- a/src/deepgram/agent/v1/raw_client.py +++ /dev/null @@ -1,114 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -from contextlib import asynccontextmanager, contextmanager - -import websockets.exceptions -import websockets.sync.client as websockets_sync_client -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.request_options import RequestOptions -from .socket_client import AsyncV1SocketClient, V1SocketClient - -try: - from websockets.legacy.client import connect as websockets_client_connect # type: ignore -except ImportError: - from websockets import connect as websockets_client_connect # type: ignore - - -class RawV1Client: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - @contextmanager - def connect( - self, *, authorization: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None - ) -> typing.Iterator[V1SocketClient]: - """ - Build a conversational voice agent using Deepgram's Voice Agent WebSocket - - Parameters - ---------- - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - V1SocketClient - """ - ws_url = self._client_wrapper.get_environment().agent + "/v1/agent/converse" - headers = self._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - with websockets_sync_client.connect(ws_url, additional_headers=headers) as protocol: - yield V1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - - -class AsyncRawV1Client: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - @asynccontextmanager - async def connect( - self, *, authorization: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None - ) -> typing.AsyncIterator[AsyncV1SocketClient]: - """ - Build a conversational voice agent using Deepgram's Voice Agent WebSocket - - Parameters - ---------- - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncV1SocketClient - """ - ws_url = self._client_wrapper.get_environment().agent + "/v1/agent/converse" - headers = self._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - async with websockets_client_connect(ws_url, extra_headers=headers) as protocol: - yield AsyncV1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) diff --git a/src/deepgram/agent/v1/requests/__init__.py b/src/deepgram/agent/v1/requests/__init__.py deleted file mode 100644 index c978f689..00000000 --- a/src/deepgram/agent/v1/requests/__init__.py +++ /dev/null @@ -1,357 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .agent_v1agent_audio_done import AgentV1AgentAudioDoneParams - from .agent_v1agent_started_speaking import AgentV1AgentStartedSpeakingParams - from .agent_v1agent_thinking import AgentV1AgentThinkingParams - from .agent_v1conversation_text import AgentV1ConversationTextParams - from .agent_v1error import AgentV1ErrorParams - from .agent_v1function_call_request import AgentV1FunctionCallRequestParams - from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItemParams - from .agent_v1inject_agent_message import AgentV1InjectAgentMessageParams - from .agent_v1inject_user_message import AgentV1InjectUserMessageParams - from .agent_v1injection_refused import AgentV1InjectionRefusedParams - from .agent_v1keep_alive import AgentV1KeepAliveParams - from .agent_v1prompt_updated import AgentV1PromptUpdatedParams - from .agent_v1receive_function_call_response import AgentV1ReceiveFunctionCallResponseParams - from .agent_v1send_function_call_response import AgentV1SendFunctionCallResponseParams - from .agent_v1settings import AgentV1SettingsParams - from .agent_v1settings_agent import AgentV1SettingsAgentParams - from .agent_v1settings_agent_context import AgentV1SettingsAgentContextParams - from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItemParams - from .agent_v1settings_agent_context_messages_item_content import ( - AgentV1SettingsAgentContextMessagesItemContentParams, - ) - from .agent_v1settings_agent_context_messages_item_function_calls import ( - AgentV1SettingsAgentContextMessagesItemFunctionCallsParams, - ) - from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import ( - AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams, - ) - from .agent_v1settings_agent_listen import AgentV1SettingsAgentListenParams - from .agent_v1settings_agent_listen_provider import ( - AgentV1SettingsAgentListenProviderParams, - AgentV1SettingsAgentListenProvider_V1Params, - AgentV1SettingsAgentListenProvider_V2Params, - ) - from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1Params - from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2Params - from .agent_v1settings_agent_speak import AgentV1SettingsAgentSpeakParams - from .agent_v1settings_agent_speak_endpoint import AgentV1SettingsAgentSpeakEndpointParams - from .agent_v1settings_agent_speak_endpoint_endpoint import AgentV1SettingsAgentSpeakEndpointEndpointParams - from .agent_v1settings_agent_speak_endpoint_provider import ( - AgentV1SettingsAgentSpeakEndpointProviderParams, - AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams, - AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams, - AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams, - AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams, - AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams, - ) - from .agent_v1settings_agent_speak_endpoint_provider_aws_polly import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams, - ) - from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams, - ) - from .agent_v1settings_agent_speak_endpoint_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams, - ) - from .agent_v1settings_agent_speak_one_item import AgentV1SettingsAgentSpeakOneItemParams - from .agent_v1settings_agent_speak_one_item_endpoint import AgentV1SettingsAgentSpeakOneItemEndpointParams - from .agent_v1settings_agent_speak_one_item_provider import ( - AgentV1SettingsAgentSpeakOneItemProviderParams, - AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams, - AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams, - AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams, - AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams, - AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams, - ) - from .agent_v1settings_agent_speak_one_item_provider_aws_polly import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams, - ) - from .agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams, - ) - from .agent_v1settings_agent_speak_one_item_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams, - ) - from .agent_v1settings_agent_think import AgentV1SettingsAgentThinkParams - from .agent_v1settings_agent_think_context_length import AgentV1SettingsAgentThinkContextLengthParams - from .agent_v1settings_agent_think_endpoint import AgentV1SettingsAgentThinkEndpointParams - from .agent_v1settings_agent_think_functions_item import AgentV1SettingsAgentThinkFunctionsItemParams - from .agent_v1settings_agent_think_functions_item_endpoint import ( - AgentV1SettingsAgentThinkFunctionsItemEndpointParams, - ) - from .agent_v1settings_agent_think_provider import ( - AgentV1SettingsAgentThinkProviderParams, - AgentV1SettingsAgentThinkProvider_AnthropicParams, - AgentV1SettingsAgentThinkProvider_AwsBedrockParams, - AgentV1SettingsAgentThinkProvider_GoogleParams, - AgentV1SettingsAgentThinkProvider_GroqParams, - AgentV1SettingsAgentThinkProvider_OpenAiParams, - ) - from .agent_v1settings_agent_think_provider_aws_bedrock import AgentV1SettingsAgentThinkProviderAwsBedrockParams - from .agent_v1settings_agent_think_provider_aws_bedrock_credentials import ( - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams, - ) - from .agent_v1settings_applied import AgentV1SettingsAppliedParams - from .agent_v1settings_audio import AgentV1SettingsAudioParams - from .agent_v1settings_audio_input import AgentV1SettingsAudioInputParams - from .agent_v1settings_audio_output import AgentV1SettingsAudioOutputParams - from .agent_v1settings_flags import AgentV1SettingsFlagsParams - from .agent_v1speak_updated import AgentV1SpeakUpdatedParams - from .agent_v1update_prompt import AgentV1UpdatePromptParams - from .agent_v1update_speak import AgentV1UpdateSpeakParams - from .agent_v1update_speak_speak import AgentV1UpdateSpeakSpeakParams - from .agent_v1update_speak_speak_endpoint import AgentV1UpdateSpeakSpeakEndpointParams - from .agent_v1update_speak_speak_provider import ( - AgentV1UpdateSpeakSpeakProviderParams, - AgentV1UpdateSpeakSpeakProvider_AwsPollyParams, - AgentV1UpdateSpeakSpeakProvider_CartesiaParams, - AgentV1UpdateSpeakSpeakProvider_DeepgramParams, - AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams, - AgentV1UpdateSpeakSpeakProvider_OpenAiParams, - ) - from .agent_v1update_speak_speak_provider_aws_polly import AgentV1UpdateSpeakSpeakProviderAwsPollyParams - from .agent_v1update_speak_speak_provider_aws_polly_credentials import ( - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams, - ) - from .agent_v1update_speak_speak_provider_cartesia import AgentV1UpdateSpeakSpeakProviderCartesiaParams - from .agent_v1update_speak_speak_provider_cartesia_voice import AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams - from .agent_v1update_speak_speak_provider_deepgram import AgentV1UpdateSpeakSpeakProviderDeepgramParams - from .agent_v1update_speak_speak_provider_eleven_labs import AgentV1UpdateSpeakSpeakProviderElevenLabsParams - from .agent_v1update_speak_speak_provider_open_ai import AgentV1UpdateSpeakSpeakProviderOpenAiParams - from .agent_v1user_started_speaking import AgentV1UserStartedSpeakingParams - from .agent_v1warning import AgentV1WarningParams - from .agent_v1welcome import AgentV1WelcomeParams - from .anthropic import AnthropicParams - from .cartesia import CartesiaParams - from .deepgram import DeepgramParams - from .eleven_labs import ElevenLabsParams - from .google import GoogleParams - from .groq import GroqParams - from .open_ai import OpenAiParams -_dynamic_imports: typing.Dict[str, str] = { - "AgentV1AgentAudioDoneParams": ".agent_v1agent_audio_done", - "AgentV1AgentStartedSpeakingParams": ".agent_v1agent_started_speaking", - "AgentV1AgentThinkingParams": ".agent_v1agent_thinking", - "AgentV1ConversationTextParams": ".agent_v1conversation_text", - "AgentV1ErrorParams": ".agent_v1error", - "AgentV1FunctionCallRequestFunctionsItemParams": ".agent_v1function_call_request_functions_item", - "AgentV1FunctionCallRequestParams": ".agent_v1function_call_request", - "AgentV1InjectAgentMessageParams": ".agent_v1inject_agent_message", - "AgentV1InjectUserMessageParams": ".agent_v1inject_user_message", - "AgentV1InjectionRefusedParams": ".agent_v1injection_refused", - "AgentV1KeepAliveParams": ".agent_v1keep_alive", - "AgentV1PromptUpdatedParams": ".agent_v1prompt_updated", - "AgentV1ReceiveFunctionCallResponseParams": ".agent_v1receive_function_call_response", - "AgentV1SendFunctionCallResponseParams": ".agent_v1send_function_call_response", - "AgentV1SettingsAgentContextMessagesItemContentParams": ".agent_v1settings_agent_context_messages_item_content", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams": ".agent_v1settings_agent_context_messages_item_function_calls", - "AgentV1SettingsAgentContextMessagesItemParams": ".agent_v1settings_agent_context_messages_item", - "AgentV1SettingsAgentContextParams": ".agent_v1settings_agent_context", - "AgentV1SettingsAgentListenParams": ".agent_v1settings_agent_listen", - "AgentV1SettingsAgentListenProviderParams": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProviderV1Params": ".agent_v1settings_agent_listen_provider_v1", - "AgentV1SettingsAgentListenProviderV2Params": ".agent_v1settings_agent_listen_provider_v2", - "AgentV1SettingsAgentListenProvider_V1Params": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProvider_V2Params": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentParams": ".agent_v1settings_agent", - "AgentV1SettingsAgentSpeakEndpointEndpointParams": ".agent_v1settings_agent_speak_endpoint_endpoint", - "AgentV1SettingsAgentSpeakEndpointParams": ".agent_v1settings_agent_speak_endpoint", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams": ".agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams": ".agent_v1settings_agent_speak_endpoint_provider_aws_polly", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams": ".agent_v1settings_agent_speak_endpoint_provider_cartesia_voice", - "AgentV1SettingsAgentSpeakEndpointProviderParams": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakOneItemEndpointParams": ".agent_v1settings_agent_speak_one_item_endpoint", - "AgentV1SettingsAgentSpeakOneItemParams": ".agent_v1settings_agent_speak_one_item", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams": ".agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams": ".agent_v1settings_agent_speak_one_item_provider_aws_polly", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams": ".agent_v1settings_agent_speak_one_item_provider_cartesia_voice", - "AgentV1SettingsAgentSpeakOneItemProviderParams": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakParams": ".agent_v1settings_agent_speak", - "AgentV1SettingsAgentThinkContextLengthParams": ".agent_v1settings_agent_think_context_length", - "AgentV1SettingsAgentThinkEndpointParams": ".agent_v1settings_agent_think_endpoint", - "AgentV1SettingsAgentThinkFunctionsItemEndpointParams": ".agent_v1settings_agent_think_functions_item_endpoint", - "AgentV1SettingsAgentThinkFunctionsItemParams": ".agent_v1settings_agent_think_functions_item", - "AgentV1SettingsAgentThinkParams": ".agent_v1settings_agent_think", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams": ".agent_v1settings_agent_think_provider_aws_bedrock_credentials", - "AgentV1SettingsAgentThinkProviderAwsBedrockParams": ".agent_v1settings_agent_think_provider_aws_bedrock", - "AgentV1SettingsAgentThinkProviderParams": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProvider_AnthropicParams": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProvider_AwsBedrockParams": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProvider_GoogleParams": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProvider_GroqParams": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProvider_OpenAiParams": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAppliedParams": ".agent_v1settings_applied", - "AgentV1SettingsAudioInputParams": ".agent_v1settings_audio_input", - "AgentV1SettingsAudioOutputParams": ".agent_v1settings_audio_output", - "AgentV1SettingsAudioParams": ".agent_v1settings_audio", - "AgentV1SettingsFlagsParams": ".agent_v1settings_flags", - "AgentV1SettingsParams": ".agent_v1settings", - "AgentV1SpeakUpdatedParams": ".agent_v1speak_updated", - "AgentV1UpdatePromptParams": ".agent_v1update_prompt", - "AgentV1UpdateSpeakParams": ".agent_v1update_speak", - "AgentV1UpdateSpeakSpeakEndpointParams": ".agent_v1update_speak_speak_endpoint", - "AgentV1UpdateSpeakSpeakParams": ".agent_v1update_speak_speak", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams": ".agent_v1update_speak_speak_provider_aws_polly_credentials", - "AgentV1UpdateSpeakSpeakProviderAwsPollyParams": ".agent_v1update_speak_speak_provider_aws_polly", - "AgentV1UpdateSpeakSpeakProviderCartesiaParams": ".agent_v1update_speak_speak_provider_cartesia", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams": ".agent_v1update_speak_speak_provider_cartesia_voice", - "AgentV1UpdateSpeakSpeakProviderDeepgramParams": ".agent_v1update_speak_speak_provider_deepgram", - "AgentV1UpdateSpeakSpeakProviderElevenLabsParams": ".agent_v1update_speak_speak_provider_eleven_labs", - "AgentV1UpdateSpeakSpeakProviderOpenAiParams": ".agent_v1update_speak_speak_provider_open_ai", - "AgentV1UpdateSpeakSpeakProviderParams": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProvider_AwsPollyParams": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProvider_CartesiaParams": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProvider_DeepgramParams": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProvider_OpenAiParams": ".agent_v1update_speak_speak_provider", - "AgentV1UserStartedSpeakingParams": ".agent_v1user_started_speaking", - "AgentV1WarningParams": ".agent_v1warning", - "AgentV1WelcomeParams": ".agent_v1welcome", - "AnthropicParams": ".anthropic", - "CartesiaParams": ".cartesia", - "DeepgramParams": ".deepgram", - "ElevenLabsParams": ".eleven_labs", - "GoogleParams": ".google", - "GroqParams": ".groq", - "OpenAiParams": ".open_ai", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "AgentV1AgentAudioDoneParams", - "AgentV1AgentStartedSpeakingParams", - "AgentV1AgentThinkingParams", - "AgentV1ConversationTextParams", - "AgentV1ErrorParams", - "AgentV1FunctionCallRequestFunctionsItemParams", - "AgentV1FunctionCallRequestParams", - "AgentV1InjectAgentMessageParams", - "AgentV1InjectUserMessageParams", - "AgentV1InjectionRefusedParams", - "AgentV1KeepAliveParams", - "AgentV1PromptUpdatedParams", - "AgentV1ReceiveFunctionCallResponseParams", - "AgentV1SendFunctionCallResponseParams", - "AgentV1SettingsAgentContextMessagesItemContentParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsParams", - "AgentV1SettingsAgentContextMessagesItemParams", - "AgentV1SettingsAgentContextParams", - "AgentV1SettingsAgentListenParams", - "AgentV1SettingsAgentListenProviderParams", - "AgentV1SettingsAgentListenProviderV1Params", - "AgentV1SettingsAgentListenProviderV2Params", - "AgentV1SettingsAgentListenProvider_V1Params", - "AgentV1SettingsAgentListenProvider_V2Params", - "AgentV1SettingsAgentParams", - "AgentV1SettingsAgentSpeakEndpointEndpointParams", - "AgentV1SettingsAgentSpeakEndpointParams", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams", - "AgentV1SettingsAgentSpeakEndpointProviderParams", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams", - "AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams", - "AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams", - "AgentV1SettingsAgentSpeakOneItemEndpointParams", - "AgentV1SettingsAgentSpeakOneItemParams", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams", - "AgentV1SettingsAgentSpeakOneItemProviderParams", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams", - "AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams", - "AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams", - "AgentV1SettingsAgentSpeakParams", - "AgentV1SettingsAgentThinkContextLengthParams", - "AgentV1SettingsAgentThinkEndpointParams", - "AgentV1SettingsAgentThinkFunctionsItemEndpointParams", - "AgentV1SettingsAgentThinkFunctionsItemParams", - "AgentV1SettingsAgentThinkParams", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams", - "AgentV1SettingsAgentThinkProviderAwsBedrockParams", - "AgentV1SettingsAgentThinkProviderParams", - "AgentV1SettingsAgentThinkProvider_AnthropicParams", - "AgentV1SettingsAgentThinkProvider_AwsBedrockParams", - "AgentV1SettingsAgentThinkProvider_GoogleParams", - "AgentV1SettingsAgentThinkProvider_GroqParams", - "AgentV1SettingsAgentThinkProvider_OpenAiParams", - "AgentV1SettingsAppliedParams", - "AgentV1SettingsAudioInputParams", - "AgentV1SettingsAudioOutputParams", - "AgentV1SettingsAudioParams", - "AgentV1SettingsFlagsParams", - "AgentV1SettingsParams", - "AgentV1SpeakUpdatedParams", - "AgentV1UpdatePromptParams", - "AgentV1UpdateSpeakParams", - "AgentV1UpdateSpeakSpeakEndpointParams", - "AgentV1UpdateSpeakSpeakParams", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams", - "AgentV1UpdateSpeakSpeakProviderAwsPollyParams", - "AgentV1UpdateSpeakSpeakProviderCartesiaParams", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams", - "AgentV1UpdateSpeakSpeakProviderDeepgramParams", - "AgentV1UpdateSpeakSpeakProviderElevenLabsParams", - "AgentV1UpdateSpeakSpeakProviderOpenAiParams", - "AgentV1UpdateSpeakSpeakProviderParams", - "AgentV1UpdateSpeakSpeakProvider_AwsPollyParams", - "AgentV1UpdateSpeakSpeakProvider_CartesiaParams", - "AgentV1UpdateSpeakSpeakProvider_DeepgramParams", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams", - "AgentV1UpdateSpeakSpeakProvider_OpenAiParams", - "AgentV1UserStartedSpeakingParams", - "AgentV1WarningParams", - "AgentV1WelcomeParams", - "AnthropicParams", - "CartesiaParams", - "DeepgramParams", - "ElevenLabsParams", - "GoogleParams", - "GroqParams", - "OpenAiParams", -] diff --git a/src/deepgram/agent/v1/requests/agent_v1agent_audio_done.py b/src/deepgram/agent/v1/requests/agent_v1agent_audio_done.py deleted file mode 100644 index 43b4f013..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1agent_audio_done.py +++ /dev/null @@ -1,12 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1AgentAudioDoneParams(typing_extensions.TypedDict): - type: typing.Literal["AgentAudioDone"] - """ - Message type identifier indicating the agent has finished sending audio - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1agent_started_speaking.py b/src/deepgram/agent/v1/requests/agent_v1agent_started_speaking.py deleted file mode 100644 index 39861c94..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1agent_started_speaking.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1AgentStartedSpeakingParams(typing_extensions.TypedDict): - type: typing.Literal["AgentStartedSpeaking"] - """ - Message type identifier for agent started speaking - """ - - total_latency: float - """ - Seconds from receiving the user's utterance to producing the agent's reply - """ - - tts_latency: float - """ - The portion of total latency attributable to text-to-speech - """ - - ttt_latency: float - """ - The portion of total latency attributable to text-to-text (usually an LLM) - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1agent_thinking.py b/src/deepgram/agent/v1/requests/agent_v1agent_thinking.py deleted file mode 100644 index 13434cbc..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1agent_thinking.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1AgentThinkingParams(typing_extensions.TypedDict): - type: typing.Literal["AgentThinking"] - """ - Message type identifier for agent thinking - """ - - content: str - """ - The text of the agent's thought process - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1conversation_text.py b/src/deepgram/agent/v1/requests/agent_v1conversation_text.py deleted file mode 100644 index ea0601e3..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1conversation_text.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1conversation_text_role import AgentV1ConversationTextRole - - -class AgentV1ConversationTextParams(typing_extensions.TypedDict): - type: typing.Literal["ConversationText"] - """ - Message type identifier for conversation text - """ - - role: AgentV1ConversationTextRole - """ - Identifies who spoke the statement - """ - - content: str - """ - The actual statement that was spoken - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1error.py b/src/deepgram/agent/v1/requests/agent_v1error.py deleted file mode 100644 index 23547cb7..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1error.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1ErrorParams(typing_extensions.TypedDict): - type: typing.Literal["Error"] - """ - Message type identifier for error responses - """ - - description: str - """ - A description of what went wrong - """ - - code: str - """ - Error code identifying the type of error - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1function_call_request.py b/src/deepgram/agent/v1/requests/agent_v1function_call_request.py deleted file mode 100644 index b00cc6d4..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1function_call_request.py +++ /dev/null @@ -1,18 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItemParams - - -class AgentV1FunctionCallRequestParams(typing_extensions.TypedDict): - type: typing.Literal["FunctionCallRequest"] - """ - Message type identifier for function call requests - """ - - functions: typing.Sequence[AgentV1FunctionCallRequestFunctionsItemParams] - """ - Array of functions to be called - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1function_call_request_functions_item.py b/src/deepgram/agent/v1/requests/agent_v1function_call_request_functions_item.py deleted file mode 100644 index bdc26719..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1function_call_request_functions_item.py +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class AgentV1FunctionCallRequestFunctionsItemParams(typing_extensions.TypedDict): - id: str - """ - Unique identifier for the function call - """ - - name: str - """ - The name of the function to call - """ - - arguments: str - """ - JSON string containing the function arguments - """ - - client_side: bool - """ - Whether the function should be executed client-side - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1inject_agent_message.py b/src/deepgram/agent/v1/requests/agent_v1inject_agent_message.py deleted file mode 100644 index 8fb718bd..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1inject_agent_message.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1InjectAgentMessageParams(typing_extensions.TypedDict): - type: typing.Literal["InjectAgentMessage"] - """ - Message type identifier for injecting an agent message - """ - - message: str - """ - The statement that the agent should say - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1inject_user_message.py b/src/deepgram/agent/v1/requests/agent_v1inject_user_message.py deleted file mode 100644 index 86583a81..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1inject_user_message.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1InjectUserMessageParams(typing_extensions.TypedDict): - type: typing.Literal["InjectUserMessage"] - """ - Message type identifier for injecting a user message - """ - - content: str - """ - The specific phrase or statement the agent should respond to - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1injection_refused.py b/src/deepgram/agent/v1/requests/agent_v1injection_refused.py deleted file mode 100644 index e19f3241..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1injection_refused.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1InjectionRefusedParams(typing_extensions.TypedDict): - type: typing.Literal["InjectionRefused"] - """ - Message type identifier for injection refused - """ - - message: str - """ - Details about why the injection was refused - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1keep_alive.py b/src/deepgram/agent/v1/requests/agent_v1keep_alive.py deleted file mode 100644 index 125eb8ae..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1keep_alive.py +++ /dev/null @@ -1,16 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1KeepAliveParams(typing_extensions.TypedDict): - """ - Send a control message to the agent - """ - - type: typing.Literal["KeepAlive"] - """ - Message type identifier - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1prompt_updated.py b/src/deepgram/agent/v1/requests/agent_v1prompt_updated.py deleted file mode 100644 index 40d5a426..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1prompt_updated.py +++ /dev/null @@ -1,12 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1PromptUpdatedParams(typing_extensions.TypedDict): - type: typing.Literal["PromptUpdated"] - """ - Message type identifier for prompt update confirmation - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1receive_function_call_response.py b/src/deepgram/agent/v1/requests/agent_v1receive_function_call_response.py deleted file mode 100644 index f26fda70..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1receive_function_call_response.py +++ /dev/null @@ -1,44 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1ReceiveFunctionCallResponseParams(typing_extensions.TypedDict): - """ - Function call response message used bidirectionally: - - • **Client → Server**: Response after client executes a function - marked as client_side: true - • **Server → Client**: Response after server executes a function - marked as client_side: false - - The same message structure serves both directions, enabling a unified - interface for function call responses regardless of execution location. - """ - - type: typing.Literal["FunctionCallResponse"] - """ - Message type identifier for function call responses - """ - - id: typing_extensions.NotRequired[str] - """ - The unique identifier for the function call. - - • **Required for client responses**: Should match the id from - the corresponding `FunctionCallRequest` - • **Optional for server responses**: Server may omit when responding - to internal function executions - """ - - name: str - """ - The name of the function being called - """ - - content: str - """ - The content or result of the function call - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1send_function_call_response.py b/src/deepgram/agent/v1/requests/agent_v1send_function_call_response.py deleted file mode 100644 index 8d75edeb..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1send_function_call_response.py +++ /dev/null @@ -1,44 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1SendFunctionCallResponseParams(typing_extensions.TypedDict): - """ - Function call response message used bidirectionally: - - • **Client → Server**: Response after client executes a function - marked as client_side: true - • **Server → Client**: Response after server executes a function - marked as client_side: false - - The same message structure serves both directions, enabling a unified - interface for function call responses regardless of execution location. - """ - - type: typing.Literal["FunctionCallResponse"] - """ - Message type identifier for function call responses - """ - - id: typing_extensions.NotRequired[str] - """ - The unique identifier for the function call. - - • **Required for client responses**: Should match the id from - the corresponding `FunctionCallRequest` - • **Optional for server responses**: Server may omit when responding - to internal function executions - """ - - name: str - """ - The name of the function being called - """ - - content: str - """ - The content or result of the function call - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings.py b/src/deepgram/agent/v1/requests/agent_v1settings.py deleted file mode 100644 index 2f748dcd..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .agent_v1settings_agent import AgentV1SettingsAgentParams -from .agent_v1settings_audio import AgentV1SettingsAudioParams -from .agent_v1settings_flags import AgentV1SettingsFlagsParams - - -class AgentV1SettingsParams(typing_extensions.TypedDict): - type: typing.Literal["Settings"] - tags: typing_extensions.NotRequired[typing.Sequence[str]] - """ - Tags to associate with the request - """ - - experimental: typing_extensions.NotRequired[bool] - """ - To enable experimental features - """ - - flags: typing_extensions.NotRequired[AgentV1SettingsFlagsParams] - mip_opt_out: typing_extensions.NotRequired[bool] - """ - To opt out of Deepgram Model Improvement Program - """ - - audio: AgentV1SettingsAudioParams - agent: AgentV1SettingsAgentParams diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent.py deleted file mode 100644 index 01bffc21..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from .agent_v1settings_agent_context import AgentV1SettingsAgentContextParams -from .agent_v1settings_agent_listen import AgentV1SettingsAgentListenParams -from .agent_v1settings_agent_speak import AgentV1SettingsAgentSpeakParams -from .agent_v1settings_agent_think import AgentV1SettingsAgentThinkParams - - -class AgentV1SettingsAgentParams(typing_extensions.TypedDict): - language: typing_extensions.NotRequired[str] - """ - Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. - """ - - context: typing_extensions.NotRequired[AgentV1SettingsAgentContextParams] - """ - Conversation context including the history of messages and function calls - """ - - listen: typing_extensions.NotRequired[AgentV1SettingsAgentListenParams] - think: typing_extensions.NotRequired[AgentV1SettingsAgentThinkParams] - speak: typing_extensions.NotRequired[AgentV1SettingsAgentSpeakParams] - greeting: typing_extensions.NotRequired[str] - """ - Optional message that agent will speak at the start - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py deleted file mode 100644 index a27f848a..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItemParams - - -class AgentV1SettingsAgentContextParams(typing_extensions.TypedDict): - """ - Conversation context including the history of messages and function calls - """ - - messages: typing_extensions.NotRequired[typing.Sequence[AgentV1SettingsAgentContextMessagesItemParams]] - """ - Conversation history as a list of messages and function calls - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item.py deleted file mode 100644 index cf31d658..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item.py +++ /dev/null @@ -1,12 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContentParams -from .agent_v1settings_agent_context_messages_item_function_calls import ( - AgentV1SettingsAgentContextMessagesItemFunctionCallsParams, -) - -AgentV1SettingsAgentContextMessagesItemParams = typing.Union[ - AgentV1SettingsAgentContextMessagesItemContentParams, AgentV1SettingsAgentContextMessagesItemFunctionCallsParams -] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_content.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_content.py deleted file mode 100644 index 1a541ffc..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_content.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_context_messages_item_content_role import ( - AgentV1SettingsAgentContextMessagesItemContentRole, -) - - -class AgentV1SettingsAgentContextMessagesItemContentParams(typing_extensions.TypedDict): - """ - Conversation text as part of the conversation history - """ - - type: typing.Literal["History"] - """ - Message type identifier for conversation text - """ - - role: AgentV1SettingsAgentContextMessagesItemContentRole - """ - Identifies who spoke the statement - """ - - content: str - """ - The actual statement that was spoken - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_function_calls.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_function_calls.py deleted file mode 100644 index cdc5733c..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_function_calls.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import ( - AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams, -) - - -class AgentV1SettingsAgentContextMessagesItemFunctionCallsParams(typing_extensions.TypedDict): - """ - Client-side or server-side function call request and response as part of the conversation history - """ - - type: typing.Literal["History"] - function_calls: typing.Sequence[AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams] - """ - List of function call objects - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py deleted file mode 100644 index 9efeb23e..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItemParams(typing_extensions.TypedDict): - id: str - """ - Unique identifier for the function call - """ - - name: str - """ - Name of the function called - """ - - client_side: bool - """ - Indicates if the call was client-side or server-side - """ - - arguments: str - """ - Arguments passed to the function - """ - - response: str - """ - Response from the function call - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen.py deleted file mode 100644 index 3eb2aa41..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from .agent_v1settings_agent_listen_provider import AgentV1SettingsAgentListenProviderParams - - -class AgentV1SettingsAgentListenParams(typing_extensions.TypedDict): - provider: typing_extensions.NotRequired[AgentV1SettingsAgentListenProviderParams] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider.py deleted file mode 100644 index 1b5b47e8..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions - - -class AgentV1SettingsAgentListenProvider_V1Params(typing_extensions.TypedDict): - version: typing.Literal["v1"] - type: typing.Literal["deepgram"] - model: typing_extensions.NotRequired[str] - language: typing_extensions.NotRequired[str] - keyterms: typing_extensions.NotRequired[typing.Sequence[str]] - smart_format: typing_extensions.NotRequired[bool] - - -class AgentV1SettingsAgentListenProvider_V2Params(typing_extensions.TypedDict): - version: typing.Literal["v2"] - type: typing.Literal["deepgram"] - model: str - keyterms: typing_extensions.NotRequired[typing.Sequence[str]] - - -AgentV1SettingsAgentListenProviderParams = typing.Union[ - AgentV1SettingsAgentListenProvider_V1Params, AgentV1SettingsAgentListenProvider_V2Params -] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider_v1.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider_v1.py deleted file mode 100644 index 0fd4e61d..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider_v1.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1SettingsAgentListenProviderV1Params(typing_extensions.TypedDict): - type: typing.Literal["deepgram"] - """ - Provider type for speech-to-text - """ - - model: typing_extensions.NotRequired[str] - """ - Model to use for speech to text using the V1 API (e.g. Nova-3, Nova-2) - """ - - language: typing_extensions.NotRequired[str] - """ - Language code to use for speech-to-text. Can be a BCP-47 language tag (e.g. `en`), or `multi` for code-switching transcription - """ - - keyterms: typing_extensions.NotRequired[typing.Sequence[str]] - """ - Prompt keyterm recognition to improve Keyword Recall Rate - """ - - smart_format: typing_extensions.NotRequired[bool] - """ - Applies smart formatting to improve transcript readability - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider_v2.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider_v2.py deleted file mode 100644 index 0e0e5c5a..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_listen_provider_v2.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1SettingsAgentListenProviderV2Params(typing_extensions.TypedDict): - type: typing.Literal["deepgram"] - """ - Provider type for speech-to-text - """ - - model: str - """ - Model to use for speech to text using the V2 API (e.g. flux-general-en) - """ - - keyterms: typing_extensions.NotRequired[typing.Sequence[str]] - """ - Prompt keyterm recognition to improve Keyword Recall Rate - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak.py deleted file mode 100644 index 3ae1f7c6..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .agent_v1settings_agent_speak_endpoint import AgentV1SettingsAgentSpeakEndpointParams -from .agent_v1settings_agent_speak_one_item import AgentV1SettingsAgentSpeakOneItemParams - -AgentV1SettingsAgentSpeakParams = typing.Union[ - AgentV1SettingsAgentSpeakEndpointParams, typing.Sequence[AgentV1SettingsAgentSpeakOneItemParams] -] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint.py deleted file mode 100644 index d90614be..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint.py +++ /dev/null @@ -1,14 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from .agent_v1settings_agent_speak_endpoint_endpoint import AgentV1SettingsAgentSpeakEndpointEndpointParams -from .agent_v1settings_agent_speak_endpoint_provider import AgentV1SettingsAgentSpeakEndpointProviderParams - - -class AgentV1SettingsAgentSpeakEndpointParams(typing_extensions.TypedDict): - provider: AgentV1SettingsAgentSpeakEndpointProviderParams - endpoint: typing_extensions.NotRequired[AgentV1SettingsAgentSpeakEndpointEndpointParams] - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_endpoint.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_endpoint.py deleted file mode 100644 index 3bc9c86f..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_endpoint.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1SettingsAgentSpeakEndpointEndpointParams(typing_extensions.TypedDict): - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ - - url: typing_extensions.NotRequired[str] - """ - Custom TTS endpoint URL. Cannot contain `output_format` or `model_id` query - parameters when the provider is Eleven Labs. - """ - - headers: typing_extensions.NotRequired[typing.Dict[str, str]] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider.py deleted file mode 100644 index a826e227..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider.py +++ /dev/null @@ -1,81 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_speak_endpoint_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine, -) -from ..types.agent_v1settings_agent_speak_endpoint_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_cartesia_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_deepgram_model import ( - AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, -) -from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams, -) -from .agent_v1settings_agent_speak_one_item_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams, -) - - -class AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams(typing_extensions.TypedDict): - type: typing.Literal["deepgram"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model: AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel - - -class AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams(typing_extensions.TypedDict): - type: typing.Literal["eleven_labs"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model_id: AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId - language: typing_extensions.NotRequired[str] - language_code: typing_extensions.NotRequired[str] - - -class AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams(typing_extensions.TypedDict): - type: typing.Literal["cartesia"] - version: typing_extensions.NotRequired[typing.Literal["2025-03-17"]] - model_id: AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId - voice: AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams - language: typing_extensions.NotRequired[str] - - -class AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams(typing_extensions.TypedDict): - type: typing.Literal["open_ai"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model: AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel - voice: AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice - - -class AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams(typing_extensions.TypedDict): - type: typing.Literal["aws_polly"] - voice: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice - language: str - language_code: typing_extensions.NotRequired[str] - engine: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine - credentials: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams - - -AgentV1SettingsAgentSpeakEndpointProviderParams = typing.Union[ - AgentV1SettingsAgentSpeakEndpointProvider_DeepgramParams, - AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabsParams, - AgentV1SettingsAgentSpeakEndpointProvider_CartesiaParams, - AgentV1SettingsAgentSpeakEndpointProvider_OpenAiParams, - AgentV1SettingsAgentSpeakEndpointProvider_AwsPollyParams, -] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider_aws_polly.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider_aws_polly.py deleted file mode 100644 index 7e5c1ede..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider_aws_polly.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1settings_agent_speak_endpoint_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine, -) -from ..types.agent_v1settings_agent_speak_endpoint_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice, -) -from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams, -) - - -class AgentV1SettingsAgentSpeakEndpointProviderAwsPollyParams(typing_extensions.TypedDict): - voice: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice - """ - AWS Polly voice name - """ - - language: str - """ - Language to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the AWS Polly API - """ - - language_code: typing_extensions.NotRequired[str] - """ - Use the `language` field instead. - """ - - engine: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine - credentials: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials.py deleted file mode 100644 index 97ad74b1..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials_type import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType, -) - - -class AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsParams(typing_extensions.TypedDict): - type: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType - region: str - access_key_id: str - secret_access_key: str - session_token: typing_extensions.NotRequired[str] - """ - Required for STS only - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider_cartesia_voice.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider_cartesia_voice.py deleted file mode 100644 index 51bd279a..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_endpoint_provider_cartesia_voice.py +++ /dev/null @@ -1,15 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoiceParams(typing_extensions.TypedDict): - mode: str - """ - Cartesia voice mode - """ - - id: str - """ - Cartesia voice ID - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item.py deleted file mode 100644 index c892106c..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item.py +++ /dev/null @@ -1,14 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from .agent_v1settings_agent_speak_one_item_endpoint import AgentV1SettingsAgentSpeakOneItemEndpointParams -from .agent_v1settings_agent_speak_one_item_provider import AgentV1SettingsAgentSpeakOneItemProviderParams - - -class AgentV1SettingsAgentSpeakOneItemParams(typing_extensions.TypedDict): - provider: AgentV1SettingsAgentSpeakOneItemProviderParams - endpoint: typing_extensions.NotRequired[AgentV1SettingsAgentSpeakOneItemEndpointParams] - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_endpoint.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_endpoint.py deleted file mode 100644 index b7ff0269..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_endpoint.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1SettingsAgentSpeakOneItemEndpointParams(typing_extensions.TypedDict): - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ - - url: typing_extensions.NotRequired[str] - """ - Custom TTS endpoint URL. Cannot contain `output_format` or `model_id` query - parameters when the provider is Eleven Labs. - """ - - headers: typing_extensions.NotRequired[typing.Dict[str, str]] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider.py deleted file mode 100644 index f163893b..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider.py +++ /dev/null @@ -1,81 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_speak_one_item_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_cartesia_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_deepgram_model import ( - AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, -) -from .agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams, -) -from .agent_v1settings_agent_speak_one_item_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams, -) - - -class AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams(typing_extensions.TypedDict): - type: typing.Literal["deepgram"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model: AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel - - -class AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams(typing_extensions.TypedDict): - type: typing.Literal["eleven_labs"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model_id: AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId - language: typing_extensions.NotRequired[str] - language_code: typing_extensions.NotRequired[str] - - -class AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams(typing_extensions.TypedDict): - type: typing.Literal["cartesia"] - version: typing_extensions.NotRequired[typing.Literal["2025-03-17"]] - model_id: AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId - voice: AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams - language: typing_extensions.NotRequired[str] - - -class AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams(typing_extensions.TypedDict): - type: typing.Literal["open_ai"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model: AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel - voice: AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice - - -class AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams(typing_extensions.TypedDict): - type: typing.Literal["aws_polly"] - voice: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice - language: str - language_code: typing_extensions.NotRequired[str] - engine: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine - credentials: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams - - -AgentV1SettingsAgentSpeakOneItemProviderParams = typing.Union[ - AgentV1SettingsAgentSpeakOneItemProvider_DeepgramParams, - AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabsParams, - AgentV1SettingsAgentSpeakOneItemProvider_CartesiaParams, - AgentV1SettingsAgentSpeakOneItemProvider_OpenAiParams, - AgentV1SettingsAgentSpeakOneItemProvider_AwsPollyParams, -] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider_aws_polly.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider_aws_polly.py deleted file mode 100644 index 4e175186..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider_aws_polly.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1settings_agent_speak_one_item_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice, -) -from .agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams, -) - - -class AgentV1SettingsAgentSpeakOneItemProviderAwsPollyParams(typing_extensions.TypedDict): - voice: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice - """ - AWS Polly voice name - """ - - language: str - """ - Language code to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the AWS Polly API - """ - - language_code: typing_extensions.NotRequired[str] - """ - Use the `language` field instead. - """ - - engine: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine - credentials: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials.py deleted file mode 100644 index 7d94447a..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials_type import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType, -) - - -class AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsParams(typing_extensions.TypedDict): - type: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType - region: str - access_key_id: str - secret_access_key: str - session_token: typing_extensions.NotRequired[str] - """ - Required for STS only - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider_cartesia_voice.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider_cartesia_voice.py deleted file mode 100644 index b2765075..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_speak_one_item_provider_cartesia_voice.py +++ /dev/null @@ -1,15 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams(typing_extensions.TypedDict): - mode: str - """ - Cartesia voice mode - """ - - id: str - """ - Cartesia voice ID - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_think.py deleted file mode 100644 index 2d5d22c2..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think.py +++ /dev/null @@ -1,24 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .agent_v1settings_agent_think_context_length import AgentV1SettingsAgentThinkContextLengthParams -from .agent_v1settings_agent_think_endpoint import AgentV1SettingsAgentThinkEndpointParams -from .agent_v1settings_agent_think_functions_item import AgentV1SettingsAgentThinkFunctionsItemParams -from .agent_v1settings_agent_think_provider import AgentV1SettingsAgentThinkProviderParams - - -class AgentV1SettingsAgentThinkParams(typing_extensions.TypedDict): - provider: AgentV1SettingsAgentThinkProviderParams - endpoint: typing_extensions.NotRequired[AgentV1SettingsAgentThinkEndpointParams] - """ - Optional for non-Deepgram LLM providers. When present, must include url field and headers object - """ - - functions: typing_extensions.NotRequired[typing.Sequence[AgentV1SettingsAgentThinkFunctionsItemParams]] - prompt: typing_extensions.NotRequired[str] - context_length: typing_extensions.NotRequired[AgentV1SettingsAgentThinkContextLengthParams] - """ - Specifies the number of characters retained in context between user messages, agent responses, and function calls. This setting is only configurable when a custom think endpoint is used - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_context_length.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_context_length.py deleted file mode 100644 index f96cd4c3..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_context_length.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentThinkContextLengthParams = typing.Union[typing.Literal["max"], float] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_endpoint.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_endpoint.py deleted file mode 100644 index 396bbc07..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_endpoint.py +++ /dev/null @@ -1,21 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1SettingsAgentThinkEndpointParams(typing_extensions.TypedDict): - """ - Optional for non-Deepgram LLM providers. When present, must include url field and headers object - """ - - url: typing_extensions.NotRequired[str] - """ - Custom LLM endpoint URL - """ - - headers: typing_extensions.NotRequired[typing.Dict[str, str]] - """ - Custom headers for the endpoint - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_functions_item.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_functions_item.py deleted file mode 100644 index b316f5f0..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_functions_item.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .agent_v1settings_agent_think_functions_item_endpoint import AgentV1SettingsAgentThinkFunctionsItemEndpointParams - - -class AgentV1SettingsAgentThinkFunctionsItemParams(typing_extensions.TypedDict): - name: typing_extensions.NotRequired[str] - """ - Function name - """ - - description: typing_extensions.NotRequired[str] - """ - Function description - """ - - parameters: typing_extensions.NotRequired[typing.Dict[str, typing.Any]] - """ - Function parameters - """ - - endpoint: typing_extensions.NotRequired[AgentV1SettingsAgentThinkFunctionsItemEndpointParams] - """ - The Function endpoint to call. if not passed, function is called client-side - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_functions_item_endpoint.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_functions_item_endpoint.py deleted file mode 100644 index 19e76bdc..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_functions_item_endpoint.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1SettingsAgentThinkFunctionsItemEndpointParams(typing_extensions.TypedDict): - """ - The Function endpoint to call. if not passed, function is called client-side - """ - - url: typing_extensions.NotRequired[str] - """ - Endpoint URL - """ - - method: typing_extensions.NotRequired[str] - """ - HTTP method - """ - - headers: typing_extensions.NotRequired[typing.Dict[str, str]] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_provider.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_provider.py deleted file mode 100644 index 49e61c0f..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_provider.py +++ /dev/null @@ -1,67 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_speak_one_item_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, -) -from ..types.agent_v1settings_agent_think_provider_anthropic_model import ( - AgentV1SettingsAgentThinkProviderAnthropicModel, -) -from ..types.agent_v1settings_agent_think_provider_aws_bedrock_model import ( - AgentV1SettingsAgentThinkProviderAwsBedrockModel, -) -from ..types.agent_v1settings_agent_think_provider_google_model import AgentV1SettingsAgentThinkProviderGoogleModel -from .agent_v1settings_agent_think_provider_aws_bedrock_credentials import ( - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams, -) - - -class AgentV1SettingsAgentThinkProvider_OpenAiParams(typing_extensions.TypedDict): - type: typing.Literal["open_ai"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model: AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel - voice: AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice - - -class AgentV1SettingsAgentThinkProvider_AwsBedrockParams(typing_extensions.TypedDict): - type: typing.Literal["aws_bedrock"] - model: AgentV1SettingsAgentThinkProviderAwsBedrockModel - temperature: typing_extensions.NotRequired[float] - credentials: typing_extensions.NotRequired[AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams] - - -class AgentV1SettingsAgentThinkProvider_AnthropicParams(typing_extensions.TypedDict): - type: typing.Literal["anthropic"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model: AgentV1SettingsAgentThinkProviderAnthropicModel - temperature: typing_extensions.NotRequired[float] - - -class AgentV1SettingsAgentThinkProvider_GoogleParams(typing_extensions.TypedDict): - type: typing.Literal["google"] - version: typing_extensions.NotRequired[typing.Literal["v1beta"]] - model: AgentV1SettingsAgentThinkProviderGoogleModel - temperature: typing_extensions.NotRequired[float] - - -class AgentV1SettingsAgentThinkProvider_GroqParams(typing_extensions.TypedDict): - type: typing.Literal["groq"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model: typing.Literal["openai/gpt-oss-20b"] - temperature: typing_extensions.NotRequired[float] - - -AgentV1SettingsAgentThinkProviderParams = typing.Union[ - AgentV1SettingsAgentThinkProvider_OpenAiParams, - AgentV1SettingsAgentThinkProvider_AwsBedrockParams, - AgentV1SettingsAgentThinkProvider_AnthropicParams, - AgentV1SettingsAgentThinkProvider_GoogleParams, - AgentV1SettingsAgentThinkProvider_GroqParams, -] diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_provider_aws_bedrock.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_provider_aws_bedrock.py deleted file mode 100644 index bf1ebfea..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_provider_aws_bedrock.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1settings_agent_think_provider_aws_bedrock_model import ( - AgentV1SettingsAgentThinkProviderAwsBedrockModel, -) -from .agent_v1settings_agent_think_provider_aws_bedrock_credentials import ( - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams, -) - - -class AgentV1SettingsAgentThinkProviderAwsBedrockParams(typing_extensions.TypedDict): - model: AgentV1SettingsAgentThinkProviderAwsBedrockModel - """ - AWS Bedrock model to use - """ - - temperature: typing_extensions.NotRequired[float] - """ - AWS Bedrock temperature (0-2) - """ - - credentials: typing_extensions.NotRequired[AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams] - """ - AWS credentials type (STS short-lived or IAM long-lived) - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_provider_aws_bedrock_credentials.py b/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_provider_aws_bedrock_credentials.py deleted file mode 100644 index a76accbe..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_agent_think_provider_aws_bedrock_credentials.py +++ /dev/null @@ -1,37 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1settings_agent_think_provider_aws_bedrock_credentials_type import ( - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType, -) - - -class AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsParams(typing_extensions.TypedDict): - """ - AWS credentials type (STS short-lived or IAM long-lived) - """ - - type: typing_extensions.NotRequired[AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType] - """ - AWS credentials type (STS short-lived or IAM long-lived) - """ - - region: typing_extensions.NotRequired[str] - """ - AWS region - """ - - access_key_id: typing_extensions.NotRequired[str] - """ - AWS access key - """ - - secret_access_key: typing_extensions.NotRequired[str] - """ - AWS secret access key - """ - - session_token: typing_extensions.NotRequired[str] - """ - AWS session token (required for STS only) - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_applied.py b/src/deepgram/agent/v1/requests/agent_v1settings_applied.py deleted file mode 100644 index 32bca304..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_applied.py +++ /dev/null @@ -1,12 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1SettingsAppliedParams(typing_extensions.TypedDict): - type: typing.Literal["SettingsApplied"] - """ - Message type identifier for settings applied confirmation - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_audio.py b/src/deepgram/agent/v1/requests/agent_v1settings_audio.py deleted file mode 100644 index 0c09d60f..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_audio.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from .agent_v1settings_audio_input import AgentV1SettingsAudioInputParams -from .agent_v1settings_audio_output import AgentV1SettingsAudioOutputParams - - -class AgentV1SettingsAudioParams(typing_extensions.TypedDict): - input: typing_extensions.NotRequired[AgentV1SettingsAudioInputParams] - """ - Audio input configuration settings. If omitted, defaults to encoding=linear16 and sample_rate=24000. Higher sample rates like 44100 Hz provide better audio quality. - """ - - output: typing_extensions.NotRequired[AgentV1SettingsAudioOutputParams] - """ - Audio output configuration settings - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_audio_input.py b/src/deepgram/agent/v1/requests/agent_v1settings_audio_input.py deleted file mode 100644 index 91931180..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_audio_input.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1settings_audio_input_encoding import AgentV1SettingsAudioInputEncoding - - -class AgentV1SettingsAudioInputParams(typing_extensions.TypedDict): - """ - Audio input configuration settings. If omitted, defaults to encoding=linear16 and sample_rate=24000. Higher sample rates like 44100 Hz provide better audio quality. - """ - - encoding: AgentV1SettingsAudioInputEncoding - """ - Audio encoding format - """ - - sample_rate: float - """ - Sample rate in Hz. Common values are 16000, 24000, 44100, 48000 - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_audio_output.py b/src/deepgram/agent/v1/requests/agent_v1settings_audio_output.py deleted file mode 100644 index 32273699..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_audio_output.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1settings_audio_output_encoding import AgentV1SettingsAudioOutputEncoding - - -class AgentV1SettingsAudioOutputParams(typing_extensions.TypedDict): - """ - Audio output configuration settings - """ - - encoding: typing_extensions.NotRequired[AgentV1SettingsAudioOutputEncoding] - """ - Audio encoding format for streaming TTS output - """ - - sample_rate: typing_extensions.NotRequired[float] - """ - Sample rate in Hz - """ - - bitrate: typing_extensions.NotRequired[float] - """ - Audio bitrate in bits per second - """ - - container: typing_extensions.NotRequired[str] - """ - Audio container format. If omitted, defaults to 'none' - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1settings_flags.py b/src/deepgram/agent/v1/requests/agent_v1settings_flags.py deleted file mode 100644 index 737233a4..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1settings_flags.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class AgentV1SettingsFlagsParams(typing_extensions.TypedDict): - history: typing_extensions.NotRequired[bool] - """ - Enable or disable history message reporting - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1speak_updated.py b/src/deepgram/agent/v1/requests/agent_v1speak_updated.py deleted file mode 100644 index 908d6639..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1speak_updated.py +++ /dev/null @@ -1,12 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1SpeakUpdatedParams(typing_extensions.TypedDict): - type: typing.Literal["SpeakUpdated"] - """ - Message type identifier for speak update confirmation - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1update_prompt.py b/src/deepgram/agent/v1/requests/agent_v1update_prompt.py deleted file mode 100644 index 8f363a56..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_prompt.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1UpdatePromptParams(typing_extensions.TypedDict): - type: typing.Literal["UpdatePrompt"] - """ - Message type identifier for prompt update request - """ - - prompt: str - """ - The new system prompt to be used by the agent - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak.py b/src/deepgram/agent/v1/requests/agent_v1update_speak.py deleted file mode 100644 index b86d1240..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak.py +++ /dev/null @@ -1,18 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .agent_v1update_speak_speak import AgentV1UpdateSpeakSpeakParams - - -class AgentV1UpdateSpeakParams(typing_extensions.TypedDict): - type: typing.Literal["UpdateSpeak"] - """ - Message type identifier for updating the speak model - """ - - speak: AgentV1UpdateSpeakSpeakParams - """ - Configuration for the speak model. Optional, defaults to latest deepgram TTS model - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak.py deleted file mode 100644 index 16a16e01..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak.py +++ /dev/null @@ -1,18 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from .agent_v1update_speak_speak_endpoint import AgentV1UpdateSpeakSpeakEndpointParams -from .agent_v1update_speak_speak_provider import AgentV1UpdateSpeakSpeakProviderParams - - -class AgentV1UpdateSpeakSpeakParams(typing_extensions.TypedDict): - """ - Configuration for the speak model. Optional, defaults to latest deepgram TTS model - """ - - provider: AgentV1UpdateSpeakSpeakProviderParams - endpoint: typing_extensions.NotRequired[AgentV1UpdateSpeakSpeakEndpointParams] - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_endpoint.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_endpoint.py deleted file mode 100644 index 43cdb3af..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_endpoint.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1UpdateSpeakSpeakEndpointParams(typing_extensions.TypedDict): - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ - - url: typing_extensions.NotRequired[str] - """ - Custom TTS endpoint URL. Cannot contain `output_format` or `model_id` query - parameters when the provider is Eleven Labs. - """ - - headers: typing_extensions.NotRequired[typing.Dict[str, str]] diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider.py deleted file mode 100644 index 0817df32..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider.py +++ /dev/null @@ -1,67 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import typing_extensions -from ..types.agent_v1update_speak_speak_provider_aws_polly_engine import AgentV1UpdateSpeakSpeakProviderAwsPollyEngine -from ..types.agent_v1update_speak_speak_provider_aws_polly_voice import AgentV1UpdateSpeakSpeakProviderAwsPollyVoice -from ..types.agent_v1update_speak_speak_provider_cartesia_model_id import AgentV1UpdateSpeakSpeakProviderCartesiaModelId -from ..types.agent_v1update_speak_speak_provider_deepgram_model import AgentV1UpdateSpeakSpeakProviderDeepgramModel -from ..types.agent_v1update_speak_speak_provider_eleven_labs_model_id import ( - AgentV1UpdateSpeakSpeakProviderElevenLabsModelId, -) -from ..types.agent_v1update_speak_speak_provider_open_ai_model import AgentV1UpdateSpeakSpeakProviderOpenAiModel -from ..types.agent_v1update_speak_speak_provider_open_ai_voice import AgentV1UpdateSpeakSpeakProviderOpenAiVoice -from .agent_v1update_speak_speak_provider_aws_polly_credentials import ( - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams, -) -from .agent_v1update_speak_speak_provider_cartesia_voice import AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams - - -class AgentV1UpdateSpeakSpeakProvider_DeepgramParams(typing_extensions.TypedDict): - type: typing.Literal["deepgram"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model: AgentV1UpdateSpeakSpeakProviderDeepgramModel - - -class AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams(typing_extensions.TypedDict): - type: typing.Literal["eleven_labs"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model_id: AgentV1UpdateSpeakSpeakProviderElevenLabsModelId - language: typing_extensions.NotRequired[str] - language_code: typing_extensions.NotRequired[str] - - -class AgentV1UpdateSpeakSpeakProvider_CartesiaParams(typing_extensions.TypedDict): - type: typing.Literal["cartesia"] - version: typing_extensions.NotRequired[typing.Literal["2025-03-17"]] - model_id: AgentV1UpdateSpeakSpeakProviderCartesiaModelId - voice: AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams - language: typing_extensions.NotRequired[str] - - -class AgentV1UpdateSpeakSpeakProvider_OpenAiParams(typing_extensions.TypedDict): - type: typing.Literal["open_ai"] - version: typing_extensions.NotRequired[typing.Literal["v1"]] - model: AgentV1UpdateSpeakSpeakProviderOpenAiModel - voice: AgentV1UpdateSpeakSpeakProviderOpenAiVoice - - -class AgentV1UpdateSpeakSpeakProvider_AwsPollyParams(typing_extensions.TypedDict): - type: typing.Literal["aws_polly"] - voice: AgentV1UpdateSpeakSpeakProviderAwsPollyVoice - language: str - language_code: typing_extensions.NotRequired[str] - engine: AgentV1UpdateSpeakSpeakProviderAwsPollyEngine - credentials: AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams - - -AgentV1UpdateSpeakSpeakProviderParams = typing.Union[ - AgentV1UpdateSpeakSpeakProvider_DeepgramParams, - AgentV1UpdateSpeakSpeakProvider_ElevenLabsParams, - AgentV1UpdateSpeakSpeakProvider_CartesiaParams, - AgentV1UpdateSpeakSpeakProvider_OpenAiParams, - AgentV1UpdateSpeakSpeakProvider_AwsPollyParams, -] diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_aws_polly.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_aws_polly.py deleted file mode 100644 index adb96400..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_aws_polly.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1update_speak_speak_provider_aws_polly_engine import AgentV1UpdateSpeakSpeakProviderAwsPollyEngine -from ..types.agent_v1update_speak_speak_provider_aws_polly_voice import AgentV1UpdateSpeakSpeakProviderAwsPollyVoice -from .agent_v1update_speak_speak_provider_aws_polly_credentials import ( - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams, -) - - -class AgentV1UpdateSpeakSpeakProviderAwsPollyParams(typing_extensions.TypedDict): - voice: AgentV1UpdateSpeakSpeakProviderAwsPollyVoice - """ - AWS Polly voice name - """ - - language: str - """ - Language code to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the AWS Polly API - """ - - language_code: typing_extensions.NotRequired[str] - """ - Use the `language` field instead. - """ - - engine: AgentV1UpdateSpeakSpeakProviderAwsPollyEngine - credentials: AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_aws_polly_credentials.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_aws_polly_credentials.py deleted file mode 100644 index ff643278..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_aws_polly_credentials.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.agent_v1update_speak_speak_provider_aws_polly_credentials_type import ( - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType, -) - - -class AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsParams(typing_extensions.TypedDict): - type: AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType - region: str - access_key_id: str - secret_access_key: str - session_token: typing_extensions.NotRequired[str] - """ - Required for STS only - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_cartesia.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_cartesia.py deleted file mode 100644 index 72e6c4a4..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_cartesia.py +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1update_speak_speak_provider_cartesia_model_id import AgentV1UpdateSpeakSpeakProviderCartesiaModelId -from .agent_v1update_speak_speak_provider_cartesia_voice import AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams - - -class AgentV1UpdateSpeakSpeakProviderCartesiaParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["2025-03-17"]] - """ - The API version header for the Cartesia text-to-speech API - """ - - model_id: AgentV1UpdateSpeakSpeakProviderCartesiaModelId - """ - Cartesia model ID - """ - - voice: AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams - language: typing_extensions.NotRequired[str] - """ - Cartesia language code - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_cartesia_voice.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_cartesia_voice.py deleted file mode 100644 index 3ff2e8be..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_cartesia_voice.py +++ /dev/null @@ -1,15 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class AgentV1UpdateSpeakSpeakProviderCartesiaVoiceParams(typing_extensions.TypedDict): - mode: str - """ - Cartesia voice mode - """ - - id: str - """ - Cartesia voice ID - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_deepgram.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_deepgram.py deleted file mode 100644 index 54c067c7..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_deepgram.py +++ /dev/null @@ -1,18 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1update_speak_speak_provider_deepgram_model import AgentV1UpdateSpeakSpeakProviderDeepgramModel - - -class AgentV1UpdateSpeakSpeakProviderDeepgramParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["v1"]] - """ - The REST API version for the Deepgram text-to-speech API - """ - - model: AgentV1UpdateSpeakSpeakProviderDeepgramModel - """ - Deepgram TTS model - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_eleven_labs.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_eleven_labs.py deleted file mode 100644 index 9cd15531..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_eleven_labs.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1update_speak_speak_provider_eleven_labs_model_id import ( - AgentV1UpdateSpeakSpeakProviderElevenLabsModelId, -) - - -class AgentV1UpdateSpeakSpeakProviderElevenLabsParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["v1"]] - """ - The REST API version for the ElevenLabs text-to-speech API - """ - - model_id: AgentV1UpdateSpeakSpeakProviderElevenLabsModelId - """ - Eleven Labs model ID - """ - - language: typing_extensions.NotRequired[str] - """ - Language code to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the ElevenLabs API - """ - - language_code: typing_extensions.NotRequired[str] - """ - Use the `language` field instead. - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_open_ai.py b/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_open_ai.py deleted file mode 100644 index f12d8a7d..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1update_speak_speak_provider_open_ai.py +++ /dev/null @@ -1,24 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1update_speak_speak_provider_open_ai_model import AgentV1UpdateSpeakSpeakProviderOpenAiModel -from ..types.agent_v1update_speak_speak_provider_open_ai_voice import AgentV1UpdateSpeakSpeakProviderOpenAiVoice - - -class AgentV1UpdateSpeakSpeakProviderOpenAiParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["v1"]] - """ - The REST API version for the OpenAI text-to-speech API - """ - - model: AgentV1UpdateSpeakSpeakProviderOpenAiModel - """ - OpenAI TTS model - """ - - voice: AgentV1UpdateSpeakSpeakProviderOpenAiVoice - """ - OpenAI voice - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1user_started_speaking.py b/src/deepgram/agent/v1/requests/agent_v1user_started_speaking.py deleted file mode 100644 index c883119c..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1user_started_speaking.py +++ /dev/null @@ -1,12 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1UserStartedSpeakingParams(typing_extensions.TypedDict): - type: typing.Literal["UserStartedSpeaking"] - """ - Message type identifier indicating that the user has begun speaking - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1warning.py b/src/deepgram/agent/v1/requests/agent_v1warning.py deleted file mode 100644 index f1e75051..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1warning.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1WarningParams(typing_extensions.TypedDict): - """ - Notifies the client of non-fatal errors or warnings - """ - - type: typing.Literal["Warning"] - """ - Message type identifier for warnings - """ - - description: str - """ - Description of the warning - """ - - code: str - """ - Warning code identifier - """ diff --git a/src/deepgram/agent/v1/requests/agent_v1welcome.py b/src/deepgram/agent/v1/requests/agent_v1welcome.py deleted file mode 100644 index 5168a4f0..00000000 --- a/src/deepgram/agent/v1/requests/agent_v1welcome.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class AgentV1WelcomeParams(typing_extensions.TypedDict): - type: typing.Literal["Welcome"] - """ - Message type identifier for welcome message - """ - - request_id: str - """ - Unique identifier for the request - """ diff --git a/src/deepgram/agent/v1/requests/anthropic.py b/src/deepgram/agent/v1/requests/anthropic.py deleted file mode 100644 index 98ccdcba..00000000 --- a/src/deepgram/agent/v1/requests/anthropic.py +++ /dev/null @@ -1,25 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_think_provider_anthropic_model import ( - AgentV1SettingsAgentThinkProviderAnthropicModel, -) - - -class AnthropicParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["v1"]] - """ - The REST API version for the Anthropic Messages API - """ - - model: AgentV1SettingsAgentThinkProviderAnthropicModel - """ - Anthropic model to use - """ - - temperature: typing_extensions.NotRequired[float] - """ - Anthropic temperature (0-1) - """ diff --git a/src/deepgram/agent/v1/requests/cartesia.py b/src/deepgram/agent/v1/requests/cartesia.py deleted file mode 100644 index 0c85d598..00000000 --- a/src/deepgram/agent/v1/requests/cartesia.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_speak_one_item_provider_cartesia_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId, -) -from .agent_v1settings_agent_speak_one_item_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams, -) - - -class CartesiaParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["2025-03-17"]] - """ - The API version header for the Cartesia text-to-speech API - """ - - model_id: AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId - """ - Cartesia model ID - """ - - voice: AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoiceParams - language: typing_extensions.NotRequired[str] - """ - Cartesia language code - """ diff --git a/src/deepgram/agent/v1/requests/deepgram.py b/src/deepgram/agent/v1/requests/deepgram.py deleted file mode 100644 index add51c6b..00000000 --- a/src/deepgram/agent/v1/requests/deepgram.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_speak_one_item_provider_deepgram_model import ( - AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel, -) - - -class DeepgramParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["v1"]] - """ - The REST API version for the Deepgram text-to-speech API - """ - - model: AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel - """ - Deepgram TTS model - """ diff --git a/src/deepgram/agent/v1/requests/eleven_labs.py b/src/deepgram/agent/v1/requests/eleven_labs.py deleted file mode 100644 index 6ffb82cb..00000000 --- a/src/deepgram/agent/v1/requests/eleven_labs.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId, -) - - -class ElevenLabsParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["v1"]] - """ - The REST API version for the Deepgram text-to-speech API - """ - - model_id: AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId - """ - Eleven Labs model ID - """ - - language: typing_extensions.NotRequired[str] - """ - Optional language to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the ElevenLabs API - """ - - language_code: typing_extensions.NotRequired[str] - """ - Use the `language` field instead. - """ diff --git a/src/deepgram/agent/v1/requests/google.py b/src/deepgram/agent/v1/requests/google.py deleted file mode 100644 index 85883233..00000000 --- a/src/deepgram/agent/v1/requests/google.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_think_provider_google_model import AgentV1SettingsAgentThinkProviderGoogleModel - - -class GoogleParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["v1beta"]] - """ - The REST API version for the Google generative language API - """ - - model: AgentV1SettingsAgentThinkProviderGoogleModel - """ - Google model to use - """ - - temperature: typing_extensions.NotRequired[float] - """ - Google temperature (0-2) - """ diff --git a/src/deepgram/agent/v1/requests/groq.py b/src/deepgram/agent/v1/requests/groq.py deleted file mode 100644 index 526931f1..00000000 --- a/src/deepgram/agent/v1/requests/groq.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class GroqParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["v1"]] - """ - The REST API version for the Groq's chat completions API (mostly OpenAI-compatible) - """ - - model: typing.Literal["openai/gpt-oss-20b"] - """ - Groq model to use - """ - - temperature: typing_extensions.NotRequired[float] - """ - Groq temperature (0-2) - """ diff --git a/src/deepgram/agent/v1/requests/open_ai.py b/src/deepgram/agent/v1/requests/open_ai.py deleted file mode 100644 index 3726f5c3..00000000 --- a/src/deepgram/agent/v1/requests/open_ai.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.agent_v1settings_agent_speak_one_item_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, -) -from ..types.agent_v1settings_agent_speak_one_item_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, -) - - -class OpenAiParams(typing_extensions.TypedDict): - version: typing_extensions.NotRequired[typing.Literal["v1"]] - """ - The REST API version for the OpenAI text-to-speech API - """ - - model: AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel - """ - OpenAI TTS model - """ - - voice: AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice - """ - OpenAI voice - """ diff --git a/src/deepgram/agent/v1/settings/client.py b/src/deepgram/agent/v1/settings/client.py index a6641e53..00bf63ad 100644 --- a/src/deepgram/agent/v1/settings/client.py +++ b/src/deepgram/agent/v1/settings/client.py @@ -5,7 +5,6 @@ import typing from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawSettingsClient, RawSettingsClient if typing.TYPE_CHECKING: from .think.client import AsyncThinkClient, ThinkClient @@ -13,21 +12,9 @@ class SettingsClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawSettingsClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._think: typing.Optional[ThinkClient] = None - @property - def with_raw_response(self) -> RawSettingsClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawSettingsClient - """ - return self._raw_client - @property def think(self): if self._think is None: @@ -39,21 +26,9 @@ def think(self): class AsyncSettingsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawSettingsClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._think: typing.Optional[AsyncThinkClient] = None - @property - def with_raw_response(self) -> AsyncRawSettingsClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawSettingsClient - """ - return self._raw_client - @property def think(self): if self._think is None: diff --git a/src/deepgram/agent/v1/settings/raw_client.py b/src/deepgram/agent/v1/settings/raw_client.py deleted file mode 100644 index 491c155c..00000000 --- a/src/deepgram/agent/v1/settings/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawSettingsClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawSettingsClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/agent/v1/settings/think/client.py b/src/deepgram/agent/v1/settings/think/client.py index 6753cbfa..826eb080 100644 --- a/src/deepgram/agent/v1/settings/think/client.py +++ b/src/deepgram/agent/v1/settings/think/client.py @@ -5,7 +5,6 @@ import typing from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawThinkClient, RawThinkClient if typing.TYPE_CHECKING: from .models.client import AsyncModelsClient, ModelsClient @@ -13,21 +12,9 @@ class ThinkClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawThinkClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._models: typing.Optional[ModelsClient] = None - @property - def with_raw_response(self) -> RawThinkClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawThinkClient - """ - return self._raw_client - @property def models(self): if self._models is None: @@ -39,21 +26,9 @@ def models(self): class AsyncThinkClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawThinkClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._models: typing.Optional[AsyncModelsClient] = None - @property - def with_raw_response(self) -> AsyncRawThinkClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawThinkClient - """ - return self._raw_client - @property def models(self): if self._models is None: diff --git a/src/deepgram/agent/v1/settings/think/models/raw_client.py b/src/deepgram/agent/v1/settings/think/models/raw_client.py index a48447d8..1487cc0b 100644 --- a/src/deepgram/agent/v1/settings/think/models/raw_client.py +++ b/src/deepgram/agent/v1/settings/think/models/raw_client.py @@ -34,7 +34,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( "v1/agent/settings/think/models", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -87,7 +86,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( "v1/agent/settings/think/models", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) diff --git a/src/deepgram/agent/v1/settings/think/raw_client.py b/src/deepgram/agent/v1/settings/think/raw_client.py deleted file mode 100644 index 10962d70..00000000 --- a/src/deepgram/agent/v1/settings/think/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawThinkClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawThinkClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/agent/v1/socket_client.py b/src/deepgram/agent/v1/socket_client.py deleted file mode 100644 index 3c04e980..00000000 --- a/src/deepgram/agent/v1/socket_client.py +++ /dev/null @@ -1,288 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import json -import typing -from json.decoder import JSONDecodeError - -import websockets -import websockets.sync.connection as websockets_sync_connection -from ...core.events import EventEmitterMixin, EventType -from ...core.pydantic_utilities import parse_obj_as -from .types.agent_v1agent_audio_done import AgentV1AgentAudioDone -from .types.agent_v1agent_started_speaking import AgentV1AgentStartedSpeaking -from .types.agent_v1agent_thinking import AgentV1AgentThinking -from .types.agent_v1conversation_text import AgentV1ConversationText -from .types.agent_v1error import AgentV1Error -from .types.agent_v1function_call_request import AgentV1FunctionCallRequest -from .types.agent_v1inject_agent_message import AgentV1InjectAgentMessage -from .types.agent_v1inject_user_message import AgentV1InjectUserMessage -from .types.agent_v1injection_refused import AgentV1InjectionRefused -from .types.agent_v1keep_alive import AgentV1KeepAlive -from .types.agent_v1prompt_updated import AgentV1PromptUpdated -from .types.agent_v1receive_function_call_response import AgentV1ReceiveFunctionCallResponse -from .types.agent_v1send_function_call_response import AgentV1SendFunctionCallResponse -from .types.agent_v1settings import AgentV1Settings -from .types.agent_v1settings_applied import AgentV1SettingsApplied -from .types.agent_v1speak_updated import AgentV1SpeakUpdated -from .types.agent_v1update_prompt import AgentV1UpdatePrompt -from .types.agent_v1update_speak import AgentV1UpdateSpeak -from .types.agent_v1user_started_speaking import AgentV1UserStartedSpeaking -from .types.agent_v1warning import AgentV1Warning -from .types.agent_v1welcome import AgentV1Welcome - -try: - from websockets.legacy.client import WebSocketClientProtocol # type: ignore -except ImportError: - from websockets import WebSocketClientProtocol # type: ignore - -V1SocketClientResponse = typing.Union[ - AgentV1ReceiveFunctionCallResponse, - AgentV1PromptUpdated, - AgentV1SpeakUpdated, - AgentV1InjectionRefused, - AgentV1Welcome, - AgentV1SettingsApplied, - AgentV1ConversationText, - AgentV1UserStartedSpeaking, - AgentV1AgentThinking, - AgentV1FunctionCallRequest, - AgentV1AgentStartedSpeaking, - AgentV1AgentAudioDone, - AgentV1Error, - AgentV1Warning, - bytes, -] - - -class AsyncV1SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: WebSocketClientProtocol): - super().__init__() - self._websocket = websocket - - async def __aiter__(self): - async for message in self._websocket: - if isinstance(message, bytes): - yield message - else: - yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore - - async def start_listening(self): - """ - Start listening for messages on the websocket connection. - - Emits events in the following order: - - EventType.OPEN when connection is established - - EventType.MESSAGE for each message received - - EventType.ERROR if an error occurs - - EventType.CLOSE when connection is closed - """ - await self._emit_async(EventType.OPEN, None) - try: - async for raw_message in self._websocket: - if isinstance(raw_message, bytes): - await self._emit_async(EventType.MESSAGE, raw_message) - else: - json_data = json.loads(raw_message) - parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: - await self._emit_async(EventType.ERROR, exc) - finally: - await self._emit_async(EventType.CLOSE, None) - - async def send_settings(self, message: AgentV1Settings) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1Settings. - """ - await self._send_model(message) - - async def send_update_speak(self, message: AgentV1UpdateSpeak) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1UpdateSpeak. - """ - await self._send_model(message) - - async def send_inject_user_message(self, message: AgentV1InjectUserMessage) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1InjectUserMessage. - """ - await self._send_model(message) - - async def send_inject_agent_message(self, message: AgentV1InjectAgentMessage) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1InjectAgentMessage. - """ - await self._send_model(message) - - async def send_function_call_response(self, message: AgentV1SendFunctionCallResponse) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1SendFunctionCallResponse. - """ - await self._send_model(message) - - async def send_keep_alive(self, message: AgentV1KeepAlive) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1KeepAlive. - """ - await self._send_model(message) - - async def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1UpdatePrompt. - """ - await self._send_model(message) - - async def send_media(self, message: bytes) -> None: - """ - Send a message to the websocket connection. - The message will be sent as bytes. - """ - await self._send(message) - - async def recv(self) -> V1SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = await self._websocket.recv() - if isinstance(data, bytes): - return data # Binary audio data - json_data = json.loads(data) - return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - - async def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - await self._websocket.send(data) - - async def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - await self._send(data.dict()) - - -class V1SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: websockets_sync_connection.Connection): - super().__init__() - self._websocket = websocket - - def __iter__(self): - for message in self._websocket: - if isinstance(message, bytes): - yield message - else: - yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore - - def start_listening(self): - """ - Start listening for messages on the websocket connection. - - Emits events in the following order: - - EventType.OPEN when connection is established - - EventType.MESSAGE for each message received - - EventType.ERROR if an error occurs - - EventType.CLOSE when connection is closed - """ - self._emit(EventType.OPEN, None) - try: - for raw_message in self._websocket: - if isinstance(raw_message, bytes): - self._emit(EventType.MESSAGE, raw_message) - else: - json_data = json.loads(raw_message) - parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: - self._emit(EventType.ERROR, exc) - finally: - self._emit(EventType.CLOSE, None) - - def send_settings(self, message: AgentV1Settings) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1Settings. - """ - self._send_model(message) - - def send_update_speak(self, message: AgentV1UpdateSpeak) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1UpdateSpeak. - """ - self._send_model(message) - - def send_inject_user_message(self, message: AgentV1InjectUserMessage) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1InjectUserMessage. - """ - self._send_model(message) - - def send_inject_agent_message(self, message: AgentV1InjectAgentMessage) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1InjectAgentMessage. - """ - self._send_model(message) - - def send_function_call_response(self, message: AgentV1SendFunctionCallResponse) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1SendFunctionCallResponse. - """ - self._send_model(message) - - def send_keep_alive(self, message: AgentV1KeepAlive) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1KeepAlive. - """ - self._send_model(message) - - def send_update_prompt(self, message: AgentV1UpdatePrompt) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a AgentV1UpdatePrompt. - """ - self._send_model(message) - - def send_media(self, message: bytes) -> None: - """ - Send a message to the websocket connection. - The message will be sent as bytes. - """ - self._send(message) - - def recv(self) -> V1SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = self._websocket.recv() - if isinstance(data, bytes): - return data # Binary audio data - json_data = json.loads(data) - return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - - def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - self._websocket.send(data) - - def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - self._send(data.dict()) diff --git a/src/deepgram/agent/v1/types/__init__.py b/src/deepgram/agent/v1/types/__init__.py deleted file mode 100644 index 190b29a4..00000000 --- a/src/deepgram/agent/v1/types/__init__.py +++ /dev/null @@ -1,494 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .agent_v1agent_audio_done import AgentV1AgentAudioDone - from .agent_v1agent_started_speaking import AgentV1AgentStartedSpeaking - from .agent_v1agent_thinking import AgentV1AgentThinking - from .agent_v1conversation_text import AgentV1ConversationText - from .agent_v1conversation_text_role import AgentV1ConversationTextRole - from .agent_v1error import AgentV1Error - from .agent_v1function_call_request import AgentV1FunctionCallRequest - from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItem - from .agent_v1inject_agent_message import AgentV1InjectAgentMessage - from .agent_v1inject_user_message import AgentV1InjectUserMessage - from .agent_v1injection_refused import AgentV1InjectionRefused - from .agent_v1keep_alive import AgentV1KeepAlive - from .agent_v1prompt_updated import AgentV1PromptUpdated - from .agent_v1receive_function_call_response import AgentV1ReceiveFunctionCallResponse - from .agent_v1send_function_call_response import AgentV1SendFunctionCallResponse - from .agent_v1settings import AgentV1Settings - from .agent_v1settings_agent import AgentV1SettingsAgent - from .agent_v1settings_agent_context import AgentV1SettingsAgentContext - from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItem - from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContent - from .agent_v1settings_agent_context_messages_item_content_role import ( - AgentV1SettingsAgentContextMessagesItemContentRole, - ) - from .agent_v1settings_agent_context_messages_item_function_calls import ( - AgentV1SettingsAgentContextMessagesItemFunctionCalls, - ) - from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import ( - AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem, - ) - from .agent_v1settings_agent_listen import AgentV1SettingsAgentListen - from .agent_v1settings_agent_listen_provider import ( - AgentV1SettingsAgentListenProvider, - AgentV1SettingsAgentListenProvider_V1, - AgentV1SettingsAgentListenProvider_V2, - ) - from .agent_v1settings_agent_listen_provider_v1 import AgentV1SettingsAgentListenProviderV1 - from .agent_v1settings_agent_listen_provider_v2 import AgentV1SettingsAgentListenProviderV2 - from .agent_v1settings_agent_speak import AgentV1SettingsAgentSpeak - from .agent_v1settings_agent_speak_endpoint import AgentV1SettingsAgentSpeakEndpoint - from .agent_v1settings_agent_speak_endpoint_endpoint import AgentV1SettingsAgentSpeakEndpointEndpoint - from .agent_v1settings_agent_speak_endpoint_provider import ( - AgentV1SettingsAgentSpeakEndpointProvider, - AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly, - AgentV1SettingsAgentSpeakEndpointProvider_Cartesia, - AgentV1SettingsAgentSpeakEndpointProvider_Deepgram, - AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs, - AgentV1SettingsAgentSpeakEndpointProvider_OpenAi, - ) - from .agent_v1settings_agent_speak_endpoint_provider_aws_polly import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPolly, - ) - from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials, - ) - from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials_type import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType, - ) - from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine, - ) - from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice, - ) - from .agent_v1settings_agent_speak_endpoint_provider_cartesia_model_id import ( - AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId, - ) - from .agent_v1settings_agent_speak_endpoint_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice, - ) - from .agent_v1settings_agent_speak_endpoint_provider_deepgram_model import ( - AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel, - ) - from .agent_v1settings_agent_speak_endpoint_provider_eleven_labs_model_id import ( - AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId, - ) - from .agent_v1settings_agent_speak_endpoint_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel, - ) - from .agent_v1settings_agent_speak_endpoint_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice, - ) - from .agent_v1settings_agent_speak_one_item import AgentV1SettingsAgentSpeakOneItem - from .agent_v1settings_agent_speak_one_item_endpoint import AgentV1SettingsAgentSpeakOneItemEndpoint - from .agent_v1settings_agent_speak_one_item_provider import ( - AgentV1SettingsAgentSpeakOneItemProvider, - AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly, - AgentV1SettingsAgentSpeakOneItemProvider_Cartesia, - AgentV1SettingsAgentSpeakOneItemProvider_Deepgram, - AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs, - AgentV1SettingsAgentSpeakOneItemProvider_OpenAi, - ) - from .agent_v1settings_agent_speak_one_item_provider_aws_polly import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPolly, - ) - from .agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials, - ) - from .agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials_type import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType, - ) - from .agent_v1settings_agent_speak_one_item_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine, - ) - from .agent_v1settings_agent_speak_one_item_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice, - ) - from .agent_v1settings_agent_speak_one_item_provider_cartesia_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId, - ) - from .agent_v1settings_agent_speak_one_item_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice, - ) - from .agent_v1settings_agent_speak_one_item_provider_deepgram_model import ( - AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel, - ) - from .agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId, - ) - from .agent_v1settings_agent_speak_one_item_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, - ) - from .agent_v1settings_agent_speak_one_item_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, - ) - from .agent_v1settings_agent_think import AgentV1SettingsAgentThink - from .agent_v1settings_agent_think_context_length import AgentV1SettingsAgentThinkContextLength - from .agent_v1settings_agent_think_endpoint import AgentV1SettingsAgentThinkEndpoint - from .agent_v1settings_agent_think_functions_item import AgentV1SettingsAgentThinkFunctionsItem - from .agent_v1settings_agent_think_functions_item_endpoint import AgentV1SettingsAgentThinkFunctionsItemEndpoint - from .agent_v1settings_agent_think_provider import ( - AgentV1SettingsAgentThinkProvider, - AgentV1SettingsAgentThinkProvider_Anthropic, - AgentV1SettingsAgentThinkProvider_AwsBedrock, - AgentV1SettingsAgentThinkProvider_Google, - AgentV1SettingsAgentThinkProvider_Groq, - AgentV1SettingsAgentThinkProvider_OpenAi, - ) - from .agent_v1settings_agent_think_provider_anthropic_model import AgentV1SettingsAgentThinkProviderAnthropicModel - from .agent_v1settings_agent_think_provider_aws_bedrock import AgentV1SettingsAgentThinkProviderAwsBedrock - from .agent_v1settings_agent_think_provider_aws_bedrock_credentials import ( - AgentV1SettingsAgentThinkProviderAwsBedrockCredentials, - ) - from .agent_v1settings_agent_think_provider_aws_bedrock_credentials_type import ( - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType, - ) - from .agent_v1settings_agent_think_provider_aws_bedrock_model import ( - AgentV1SettingsAgentThinkProviderAwsBedrockModel, - ) - from .agent_v1settings_agent_think_provider_google_model import AgentV1SettingsAgentThinkProviderGoogleModel - from .agent_v1settings_agent_think_provider_open_ai_model import AgentV1SettingsAgentThinkProviderOpenAiModel - from .agent_v1settings_applied import AgentV1SettingsApplied - from .agent_v1settings_audio import AgentV1SettingsAudio - from .agent_v1settings_audio_input import AgentV1SettingsAudioInput - from .agent_v1settings_audio_input_encoding import AgentV1SettingsAudioInputEncoding - from .agent_v1settings_audio_output import AgentV1SettingsAudioOutput - from .agent_v1settings_audio_output_encoding import AgentV1SettingsAudioOutputEncoding - from .agent_v1settings_flags import AgentV1SettingsFlags - from .agent_v1speak_updated import AgentV1SpeakUpdated - from .agent_v1update_prompt import AgentV1UpdatePrompt - from .agent_v1update_speak import AgentV1UpdateSpeak - from .agent_v1update_speak_speak import AgentV1UpdateSpeakSpeak - from .agent_v1update_speak_speak_endpoint import AgentV1UpdateSpeakSpeakEndpoint - from .agent_v1update_speak_speak_provider import ( - AgentV1UpdateSpeakSpeakProvider, - AgentV1UpdateSpeakSpeakProvider_AwsPolly, - AgentV1UpdateSpeakSpeakProvider_Cartesia, - AgentV1UpdateSpeakSpeakProvider_Deepgram, - AgentV1UpdateSpeakSpeakProvider_ElevenLabs, - AgentV1UpdateSpeakSpeakProvider_OpenAi, - ) - from .agent_v1update_speak_speak_provider_aws_polly import AgentV1UpdateSpeakSpeakProviderAwsPolly - from .agent_v1update_speak_speak_provider_aws_polly_credentials import ( - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials, - ) - from .agent_v1update_speak_speak_provider_aws_polly_credentials_type import ( - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType, - ) - from .agent_v1update_speak_speak_provider_aws_polly_engine import AgentV1UpdateSpeakSpeakProviderAwsPollyEngine - from .agent_v1update_speak_speak_provider_aws_polly_voice import AgentV1UpdateSpeakSpeakProviderAwsPollyVoice - from .agent_v1update_speak_speak_provider_cartesia import AgentV1UpdateSpeakSpeakProviderCartesia - from .agent_v1update_speak_speak_provider_cartesia_model_id import AgentV1UpdateSpeakSpeakProviderCartesiaModelId - from .agent_v1update_speak_speak_provider_cartesia_voice import AgentV1UpdateSpeakSpeakProviderCartesiaVoice - from .agent_v1update_speak_speak_provider_deepgram import AgentV1UpdateSpeakSpeakProviderDeepgram - from .agent_v1update_speak_speak_provider_deepgram_model import AgentV1UpdateSpeakSpeakProviderDeepgramModel - from .agent_v1update_speak_speak_provider_eleven_labs import AgentV1UpdateSpeakSpeakProviderElevenLabs - from .agent_v1update_speak_speak_provider_eleven_labs_model_id import ( - AgentV1UpdateSpeakSpeakProviderElevenLabsModelId, - ) - from .agent_v1update_speak_speak_provider_open_ai import AgentV1UpdateSpeakSpeakProviderOpenAi - from .agent_v1update_speak_speak_provider_open_ai_model import AgentV1UpdateSpeakSpeakProviderOpenAiModel - from .agent_v1update_speak_speak_provider_open_ai_voice import AgentV1UpdateSpeakSpeakProviderOpenAiVoice - from .agent_v1user_started_speaking import AgentV1UserStartedSpeaking - from .agent_v1warning import AgentV1Warning - from .agent_v1welcome import AgentV1Welcome - from .anthropic import Anthropic - from .cartesia import Cartesia - from .deepgram import Deepgram - from .eleven_labs import ElevenLabs - from .google import Google - from .groq import Groq - from .open_ai import OpenAi -_dynamic_imports: typing.Dict[str, str] = { - "AgentV1AgentAudioDone": ".agent_v1agent_audio_done", - "AgentV1AgentStartedSpeaking": ".agent_v1agent_started_speaking", - "AgentV1AgentThinking": ".agent_v1agent_thinking", - "AgentV1ConversationText": ".agent_v1conversation_text", - "AgentV1ConversationTextRole": ".agent_v1conversation_text_role", - "AgentV1Error": ".agent_v1error", - "AgentV1FunctionCallRequest": ".agent_v1function_call_request", - "AgentV1FunctionCallRequestFunctionsItem": ".agent_v1function_call_request_functions_item", - "AgentV1InjectAgentMessage": ".agent_v1inject_agent_message", - "AgentV1InjectUserMessage": ".agent_v1inject_user_message", - "AgentV1InjectionRefused": ".agent_v1injection_refused", - "AgentV1KeepAlive": ".agent_v1keep_alive", - "AgentV1PromptUpdated": ".agent_v1prompt_updated", - "AgentV1ReceiveFunctionCallResponse": ".agent_v1receive_function_call_response", - "AgentV1SendFunctionCallResponse": ".agent_v1send_function_call_response", - "AgentV1Settings": ".agent_v1settings", - "AgentV1SettingsAgent": ".agent_v1settings_agent", - "AgentV1SettingsAgentContext": ".agent_v1settings_agent_context", - "AgentV1SettingsAgentContextMessagesItem": ".agent_v1settings_agent_context_messages_item", - "AgentV1SettingsAgentContextMessagesItemContent": ".agent_v1settings_agent_context_messages_item_content", - "AgentV1SettingsAgentContextMessagesItemContentRole": ".agent_v1settings_agent_context_messages_item_content_role", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls": ".agent_v1settings_agent_context_messages_item_function_calls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem": ".agent_v1settings_agent_context_messages_item_function_calls_function_calls_item", - "AgentV1SettingsAgentListen": ".agent_v1settings_agent_listen", - "AgentV1SettingsAgentListenProvider": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProviderV1": ".agent_v1settings_agent_listen_provider_v1", - "AgentV1SettingsAgentListenProviderV2": ".agent_v1settings_agent_listen_provider_v2", - "AgentV1SettingsAgentListenProvider_V1": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentListenProvider_V2": ".agent_v1settings_agent_listen_provider", - "AgentV1SettingsAgentSpeak": ".agent_v1settings_agent_speak", - "AgentV1SettingsAgentSpeakEndpoint": ".agent_v1settings_agent_speak_endpoint", - "AgentV1SettingsAgentSpeakEndpointEndpoint": ".agent_v1settings_agent_speak_endpoint_endpoint", - "AgentV1SettingsAgentSpeakEndpointProvider": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPolly": ".agent_v1settings_agent_speak_endpoint_provider_aws_polly", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials": ".agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType": ".agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials_type", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine": ".agent_v1settings_agent_speak_endpoint_provider_aws_polly_engine", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice": ".agent_v1settings_agent_speak_endpoint_provider_aws_polly_voice", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId": ".agent_v1settings_agent_speak_endpoint_provider_cartesia_model_id", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice": ".agent_v1settings_agent_speak_endpoint_provider_cartesia_voice", - "AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel": ".agent_v1settings_agent_speak_endpoint_provider_deepgram_model", - "AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId": ".agent_v1settings_agent_speak_endpoint_provider_eleven_labs_model_id", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel": ".agent_v1settings_agent_speak_endpoint_provider_open_ai_model", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice": ".agent_v1settings_agent_speak_endpoint_provider_open_ai_voice", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProvider_Cartesia": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProvider_Deepgram": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAi": ".agent_v1settings_agent_speak_endpoint_provider", - "AgentV1SettingsAgentSpeakOneItem": ".agent_v1settings_agent_speak_one_item", - "AgentV1SettingsAgentSpeakOneItemEndpoint": ".agent_v1settings_agent_speak_one_item_endpoint", - "AgentV1SettingsAgentSpeakOneItemProvider": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPolly": ".agent_v1settings_agent_speak_one_item_provider_aws_polly", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials": ".agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType": ".agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials_type", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine": ".agent_v1settings_agent_speak_one_item_provider_aws_polly_engine", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice": ".agent_v1settings_agent_speak_one_item_provider_aws_polly_voice", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId": ".agent_v1settings_agent_speak_one_item_provider_cartesia_model_id", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice": ".agent_v1settings_agent_speak_one_item_provider_cartesia_voice", - "AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel": ".agent_v1settings_agent_speak_one_item_provider_deepgram_model", - "AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId": ".agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel": ".agent_v1settings_agent_speak_one_item_provider_open_ai_model", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice": ".agent_v1settings_agent_speak_one_item_provider_open_ai_voice", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProvider_Cartesia": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProvider_Deepgram": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAi": ".agent_v1settings_agent_speak_one_item_provider", - "AgentV1SettingsAgentThink": ".agent_v1settings_agent_think", - "AgentV1SettingsAgentThinkContextLength": ".agent_v1settings_agent_think_context_length", - "AgentV1SettingsAgentThinkEndpoint": ".agent_v1settings_agent_think_endpoint", - "AgentV1SettingsAgentThinkFunctionsItem": ".agent_v1settings_agent_think_functions_item", - "AgentV1SettingsAgentThinkFunctionsItemEndpoint": ".agent_v1settings_agent_think_functions_item_endpoint", - "AgentV1SettingsAgentThinkProvider": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProviderAnthropicModel": ".agent_v1settings_agent_think_provider_anthropic_model", - "AgentV1SettingsAgentThinkProviderAwsBedrock": ".agent_v1settings_agent_think_provider_aws_bedrock", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentials": ".agent_v1settings_agent_think_provider_aws_bedrock_credentials", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType": ".agent_v1settings_agent_think_provider_aws_bedrock_credentials_type", - "AgentV1SettingsAgentThinkProviderAwsBedrockModel": ".agent_v1settings_agent_think_provider_aws_bedrock_model", - "AgentV1SettingsAgentThinkProviderGoogleModel": ".agent_v1settings_agent_think_provider_google_model", - "AgentV1SettingsAgentThinkProviderOpenAiModel": ".agent_v1settings_agent_think_provider_open_ai_model", - "AgentV1SettingsAgentThinkProvider_Anthropic": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProvider_AwsBedrock": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProvider_Google": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProvider_Groq": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsAgentThinkProvider_OpenAi": ".agent_v1settings_agent_think_provider", - "AgentV1SettingsApplied": ".agent_v1settings_applied", - "AgentV1SettingsAudio": ".agent_v1settings_audio", - "AgentV1SettingsAudioInput": ".agent_v1settings_audio_input", - "AgentV1SettingsAudioInputEncoding": ".agent_v1settings_audio_input_encoding", - "AgentV1SettingsAudioOutput": ".agent_v1settings_audio_output", - "AgentV1SettingsAudioOutputEncoding": ".agent_v1settings_audio_output_encoding", - "AgentV1SettingsFlags": ".agent_v1settings_flags", - "AgentV1SpeakUpdated": ".agent_v1speak_updated", - "AgentV1UpdatePrompt": ".agent_v1update_prompt", - "AgentV1UpdateSpeak": ".agent_v1update_speak", - "AgentV1UpdateSpeakSpeak": ".agent_v1update_speak_speak", - "AgentV1UpdateSpeakSpeakEndpoint": ".agent_v1update_speak_speak_endpoint", - "AgentV1UpdateSpeakSpeakProvider": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProviderAwsPolly": ".agent_v1update_speak_speak_provider_aws_polly", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials": ".agent_v1update_speak_speak_provider_aws_polly_credentials", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType": ".agent_v1update_speak_speak_provider_aws_polly_credentials_type", - "AgentV1UpdateSpeakSpeakProviderAwsPollyEngine": ".agent_v1update_speak_speak_provider_aws_polly_engine", - "AgentV1UpdateSpeakSpeakProviderAwsPollyVoice": ".agent_v1update_speak_speak_provider_aws_polly_voice", - "AgentV1UpdateSpeakSpeakProviderCartesia": ".agent_v1update_speak_speak_provider_cartesia", - "AgentV1UpdateSpeakSpeakProviderCartesiaModelId": ".agent_v1update_speak_speak_provider_cartesia_model_id", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoice": ".agent_v1update_speak_speak_provider_cartesia_voice", - "AgentV1UpdateSpeakSpeakProviderDeepgram": ".agent_v1update_speak_speak_provider_deepgram", - "AgentV1UpdateSpeakSpeakProviderDeepgramModel": ".agent_v1update_speak_speak_provider_deepgram_model", - "AgentV1UpdateSpeakSpeakProviderElevenLabs": ".agent_v1update_speak_speak_provider_eleven_labs", - "AgentV1UpdateSpeakSpeakProviderElevenLabsModelId": ".agent_v1update_speak_speak_provider_eleven_labs_model_id", - "AgentV1UpdateSpeakSpeakProviderOpenAi": ".agent_v1update_speak_speak_provider_open_ai", - "AgentV1UpdateSpeakSpeakProviderOpenAiModel": ".agent_v1update_speak_speak_provider_open_ai_model", - "AgentV1UpdateSpeakSpeakProviderOpenAiVoice": ".agent_v1update_speak_speak_provider_open_ai_voice", - "AgentV1UpdateSpeakSpeakProvider_AwsPolly": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProvider_Cartesia": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProvider_Deepgram": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabs": ".agent_v1update_speak_speak_provider", - "AgentV1UpdateSpeakSpeakProvider_OpenAi": ".agent_v1update_speak_speak_provider", - "AgentV1UserStartedSpeaking": ".agent_v1user_started_speaking", - "AgentV1Warning": ".agent_v1warning", - "AgentV1Welcome": ".agent_v1welcome", - "Anthropic": ".anthropic", - "Cartesia": ".cartesia", - "Deepgram": ".deepgram", - "ElevenLabs": ".eleven_labs", - "Google": ".google", - "Groq": ".groq", - "OpenAi": ".open_ai", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "AgentV1AgentAudioDone", - "AgentV1AgentStartedSpeaking", - "AgentV1AgentThinking", - "AgentV1ConversationText", - "AgentV1ConversationTextRole", - "AgentV1Error", - "AgentV1FunctionCallRequest", - "AgentV1FunctionCallRequestFunctionsItem", - "AgentV1InjectAgentMessage", - "AgentV1InjectUserMessage", - "AgentV1InjectionRefused", - "AgentV1KeepAlive", - "AgentV1PromptUpdated", - "AgentV1ReceiveFunctionCallResponse", - "AgentV1SendFunctionCallResponse", - "AgentV1Settings", - "AgentV1SettingsAgent", - "AgentV1SettingsAgentContext", - "AgentV1SettingsAgentContextMessagesItem", - "AgentV1SettingsAgentContextMessagesItemContent", - "AgentV1SettingsAgentContextMessagesItemContentRole", - "AgentV1SettingsAgentContextMessagesItemFunctionCalls", - "AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem", - "AgentV1SettingsAgentListen", - "AgentV1SettingsAgentListenProvider", - "AgentV1SettingsAgentListenProviderV1", - "AgentV1SettingsAgentListenProviderV2", - "AgentV1SettingsAgentListenProvider_V1", - "AgentV1SettingsAgentListenProvider_V2", - "AgentV1SettingsAgentSpeak", - "AgentV1SettingsAgentSpeakEndpoint", - "AgentV1SettingsAgentSpeakEndpointEndpoint", - "AgentV1SettingsAgentSpeakEndpointProvider", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPolly", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine", - "AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId", - "AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice", - "AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel", - "AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel", - "AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice", - "AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly", - "AgentV1SettingsAgentSpeakEndpointProvider_Cartesia", - "AgentV1SettingsAgentSpeakEndpointProvider_Deepgram", - "AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs", - "AgentV1SettingsAgentSpeakEndpointProvider_OpenAi", - "AgentV1SettingsAgentSpeakOneItem", - "AgentV1SettingsAgentSpeakOneItemEndpoint", - "AgentV1SettingsAgentSpeakOneItemProvider", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPolly", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine", - "AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId", - "AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice", - "AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel", - "AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel", - "AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice", - "AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly", - "AgentV1SettingsAgentSpeakOneItemProvider_Cartesia", - "AgentV1SettingsAgentSpeakOneItemProvider_Deepgram", - "AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs", - "AgentV1SettingsAgentSpeakOneItemProvider_OpenAi", - "AgentV1SettingsAgentThink", - "AgentV1SettingsAgentThinkContextLength", - "AgentV1SettingsAgentThinkEndpoint", - "AgentV1SettingsAgentThinkFunctionsItem", - "AgentV1SettingsAgentThinkFunctionsItemEndpoint", - "AgentV1SettingsAgentThinkProvider", - "AgentV1SettingsAgentThinkProviderAnthropicModel", - "AgentV1SettingsAgentThinkProviderAwsBedrock", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentials", - "AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType", - "AgentV1SettingsAgentThinkProviderAwsBedrockModel", - "AgentV1SettingsAgentThinkProviderGoogleModel", - "AgentV1SettingsAgentThinkProviderOpenAiModel", - "AgentV1SettingsAgentThinkProvider_Anthropic", - "AgentV1SettingsAgentThinkProvider_AwsBedrock", - "AgentV1SettingsAgentThinkProvider_Google", - "AgentV1SettingsAgentThinkProvider_Groq", - "AgentV1SettingsAgentThinkProvider_OpenAi", - "AgentV1SettingsApplied", - "AgentV1SettingsAudio", - "AgentV1SettingsAudioInput", - "AgentV1SettingsAudioInputEncoding", - "AgentV1SettingsAudioOutput", - "AgentV1SettingsAudioOutputEncoding", - "AgentV1SettingsFlags", - "AgentV1SpeakUpdated", - "AgentV1UpdatePrompt", - "AgentV1UpdateSpeak", - "AgentV1UpdateSpeakSpeak", - "AgentV1UpdateSpeakSpeakEndpoint", - "AgentV1UpdateSpeakSpeakProvider", - "AgentV1UpdateSpeakSpeakProviderAwsPolly", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials", - "AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType", - "AgentV1UpdateSpeakSpeakProviderAwsPollyEngine", - "AgentV1UpdateSpeakSpeakProviderAwsPollyVoice", - "AgentV1UpdateSpeakSpeakProviderCartesia", - "AgentV1UpdateSpeakSpeakProviderCartesiaModelId", - "AgentV1UpdateSpeakSpeakProviderCartesiaVoice", - "AgentV1UpdateSpeakSpeakProviderDeepgram", - "AgentV1UpdateSpeakSpeakProviderDeepgramModel", - "AgentV1UpdateSpeakSpeakProviderElevenLabs", - "AgentV1UpdateSpeakSpeakProviderElevenLabsModelId", - "AgentV1UpdateSpeakSpeakProviderOpenAi", - "AgentV1UpdateSpeakSpeakProviderOpenAiModel", - "AgentV1UpdateSpeakSpeakProviderOpenAiVoice", - "AgentV1UpdateSpeakSpeakProvider_AwsPolly", - "AgentV1UpdateSpeakSpeakProvider_Cartesia", - "AgentV1UpdateSpeakSpeakProvider_Deepgram", - "AgentV1UpdateSpeakSpeakProvider_ElevenLabs", - "AgentV1UpdateSpeakSpeakProvider_OpenAi", - "AgentV1UserStartedSpeaking", - "AgentV1Warning", - "AgentV1Welcome", - "Anthropic", - "Cartesia", - "Deepgram", - "ElevenLabs", - "Google", - "Groq", - "OpenAi", -] diff --git a/src/deepgram/agent/v1/types/agent_v1agent_audio_done.py b/src/deepgram/agent/v1/types/agent_v1agent_audio_done.py deleted file mode 100644 index 95f3f376..00000000 --- a/src/deepgram/agent/v1/types/agent_v1agent_audio_done.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1AgentAudioDone(UniversalBaseModel): - type: typing.Literal["AgentAudioDone"] = pydantic.Field(default="AgentAudioDone") - """ - Message type identifier indicating the agent has finished sending audio - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1agent_started_speaking.py b/src/deepgram/agent/v1/types/agent_v1agent_started_speaking.py deleted file mode 100644 index e6c47c6f..00000000 --- a/src/deepgram/agent/v1/types/agent_v1agent_started_speaking.py +++ /dev/null @@ -1,37 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1AgentStartedSpeaking(UniversalBaseModel): - type: typing.Literal["AgentStartedSpeaking"] = pydantic.Field(default="AgentStartedSpeaking") - """ - Message type identifier for agent started speaking - """ - - total_latency: float = pydantic.Field() - """ - Seconds from receiving the user's utterance to producing the agent's reply - """ - - tts_latency: float = pydantic.Field() - """ - The portion of total latency attributable to text-to-speech - """ - - ttt_latency: float = pydantic.Field() - """ - The portion of total latency attributable to text-to-text (usually an LLM) - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1agent_thinking.py b/src/deepgram/agent/v1/types/agent_v1agent_thinking.py deleted file mode 100644 index 4b63c92f..00000000 --- a/src/deepgram/agent/v1/types/agent_v1agent_thinking.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1AgentThinking(UniversalBaseModel): - type: typing.Literal["AgentThinking"] = pydantic.Field(default="AgentThinking") - """ - Message type identifier for agent thinking - """ - - content: str = pydantic.Field() - """ - The text of the agent's thought process - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1conversation_text.py b/src/deepgram/agent/v1/types/agent_v1conversation_text.py deleted file mode 100644 index 9888c93b..00000000 --- a/src/deepgram/agent/v1/types/agent_v1conversation_text.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1conversation_text_role import AgentV1ConversationTextRole - - -class AgentV1ConversationText(UniversalBaseModel): - type: typing.Literal["ConversationText"] = pydantic.Field(default="ConversationText") - """ - Message type identifier for conversation text - """ - - role: AgentV1ConversationTextRole = pydantic.Field() - """ - Identifies who spoke the statement - """ - - content: str = pydantic.Field() - """ - The actual statement that was spoken - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1conversation_text_role.py b/src/deepgram/agent/v1/types/agent_v1conversation_text_role.py deleted file mode 100644 index 785333dd..00000000 --- a/src/deepgram/agent/v1/types/agent_v1conversation_text_role.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1ConversationTextRole = typing.Union[typing.Literal["user", "assistant"], typing.Any] diff --git a/src/deepgram/agent/v1/types/agent_v1error.py b/src/deepgram/agent/v1/types/agent_v1error.py deleted file mode 100644 index e0c01466..00000000 --- a/src/deepgram/agent/v1/types/agent_v1error.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1Error(UniversalBaseModel): - type: typing.Literal["Error"] = pydantic.Field(default="Error") - """ - Message type identifier for error responses - """ - - description: str = pydantic.Field() - """ - A description of what went wrong - """ - - code: str = pydantic.Field() - """ - Error code identifying the type of error - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1function_call_request.py b/src/deepgram/agent/v1/types/agent_v1function_call_request.py deleted file mode 100644 index 4c5e7c4a..00000000 --- a/src/deepgram/agent/v1/types/agent_v1function_call_request.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1function_call_request_functions_item import AgentV1FunctionCallRequestFunctionsItem - - -class AgentV1FunctionCallRequest(UniversalBaseModel): - type: typing.Literal["FunctionCallRequest"] = pydantic.Field(default="FunctionCallRequest") - """ - Message type identifier for function call requests - """ - - functions: typing.List[AgentV1FunctionCallRequestFunctionsItem] = pydantic.Field() - """ - Array of functions to be called - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1function_call_request_functions_item.py b/src/deepgram/agent/v1/types/agent_v1function_call_request_functions_item.py deleted file mode 100644 index dcd75dd4..00000000 --- a/src/deepgram/agent/v1/types/agent_v1function_call_request_functions_item.py +++ /dev/null @@ -1,37 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1FunctionCallRequestFunctionsItem(UniversalBaseModel): - id: str = pydantic.Field() - """ - Unique identifier for the function call - """ - - name: str = pydantic.Field() - """ - The name of the function to call - """ - - arguments: str = pydantic.Field() - """ - JSON string containing the function arguments - """ - - client_side: bool = pydantic.Field() - """ - Whether the function should be executed client-side - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1inject_agent_message.py b/src/deepgram/agent/v1/types/agent_v1inject_agent_message.py deleted file mode 100644 index 6711f6dc..00000000 --- a/src/deepgram/agent/v1/types/agent_v1inject_agent_message.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1InjectAgentMessage(UniversalBaseModel): - type: typing.Literal["InjectAgentMessage"] = pydantic.Field(default="InjectAgentMessage") - """ - Message type identifier for injecting an agent message - """ - - message: str = pydantic.Field() - """ - The statement that the agent should say - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1inject_user_message.py b/src/deepgram/agent/v1/types/agent_v1inject_user_message.py deleted file mode 100644 index 78a3ebf9..00000000 --- a/src/deepgram/agent/v1/types/agent_v1inject_user_message.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1InjectUserMessage(UniversalBaseModel): - type: typing.Literal["InjectUserMessage"] = pydantic.Field(default="InjectUserMessage") - """ - Message type identifier for injecting a user message - """ - - content: str = pydantic.Field() - """ - The specific phrase or statement the agent should respond to - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1injection_refused.py b/src/deepgram/agent/v1/types/agent_v1injection_refused.py deleted file mode 100644 index b185fccc..00000000 --- a/src/deepgram/agent/v1/types/agent_v1injection_refused.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1InjectionRefused(UniversalBaseModel): - type: typing.Literal["InjectionRefused"] = pydantic.Field(default="InjectionRefused") - """ - Message type identifier for injection refused - """ - - message: str = pydantic.Field() - """ - Details about why the injection was refused - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1keep_alive.py b/src/deepgram/agent/v1/types/agent_v1keep_alive.py deleted file mode 100644 index 49266088..00000000 --- a/src/deepgram/agent/v1/types/agent_v1keep_alive.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1KeepAlive(UniversalBaseModel): - """ - Send a control message to the agent - """ - - type: typing.Literal["KeepAlive"] = pydantic.Field(default="KeepAlive") - """ - Message type identifier - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1prompt_updated.py b/src/deepgram/agent/v1/types/agent_v1prompt_updated.py deleted file mode 100644 index f4827a96..00000000 --- a/src/deepgram/agent/v1/types/agent_v1prompt_updated.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1PromptUpdated(UniversalBaseModel): - type: typing.Literal["PromptUpdated"] = pydantic.Field(default="PromptUpdated") - """ - Message type identifier for prompt update confirmation - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1receive_function_call_response.py b/src/deepgram/agent/v1/types/agent_v1receive_function_call_response.py deleted file mode 100644 index 852aec2b..00000000 --- a/src/deepgram/agent/v1/types/agent_v1receive_function_call_response.py +++ /dev/null @@ -1,54 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1ReceiveFunctionCallResponse(UniversalBaseModel): - """ - Function call response message used bidirectionally: - - • **Client → Server**: Response after client executes a function - marked as client_side: true - • **Server → Client**: Response after server executes a function - marked as client_side: false - - The same message structure serves both directions, enabling a unified - interface for function call responses regardless of execution location. - """ - - type: typing.Literal["FunctionCallResponse"] = pydantic.Field(default="FunctionCallResponse") - """ - Message type identifier for function call responses - """ - - id: typing.Optional[str] = pydantic.Field(default=None) - """ - The unique identifier for the function call. - - • **Required for client responses**: Should match the id from - the corresponding `FunctionCallRequest` - • **Optional for server responses**: Server may omit when responding - to internal function executions - """ - - name: str = pydantic.Field() - """ - The name of the function being called - """ - - content: str = pydantic.Field() - """ - The content or result of the function call - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1send_function_call_response.py b/src/deepgram/agent/v1/types/agent_v1send_function_call_response.py deleted file mode 100644 index 9366862f..00000000 --- a/src/deepgram/agent/v1/types/agent_v1send_function_call_response.py +++ /dev/null @@ -1,54 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SendFunctionCallResponse(UniversalBaseModel): - """ - Function call response message used bidirectionally: - - • **Client → Server**: Response after client executes a function - marked as client_side: true - • **Server → Client**: Response after server executes a function - marked as client_side: false - - The same message structure serves both directions, enabling a unified - interface for function call responses regardless of execution location. - """ - - type: typing.Literal["FunctionCallResponse"] = pydantic.Field(default="FunctionCallResponse") - """ - Message type identifier for function call responses - """ - - id: typing.Optional[str] = pydantic.Field(default=None) - """ - The unique identifier for the function call. - - • **Required for client responses**: Should match the id from - the corresponding `FunctionCallRequest` - • **Optional for server responses**: Server may omit when responding - to internal function executions - """ - - name: str = pydantic.Field() - """ - The name of the function being called - """ - - content: str = pydantic.Field() - """ - The content or result of the function call - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings.py b/src/deepgram/agent/v1/types/agent_v1settings.py deleted file mode 100644 index 201533d3..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings.py +++ /dev/null @@ -1,40 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent import AgentV1SettingsAgent -from .agent_v1settings_audio import AgentV1SettingsAudio -from .agent_v1settings_flags import AgentV1SettingsFlags - - -class AgentV1Settings(UniversalBaseModel): - type: typing.Literal["Settings"] = "Settings" - tags: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - Tags to associate with the request - """ - - experimental: typing.Optional[bool] = pydantic.Field(default=None) - """ - To enable experimental features - """ - - flags: typing.Optional[AgentV1SettingsFlags] = None - mip_opt_out: typing.Optional[bool] = pydantic.Field(default=None) - """ - To opt out of Deepgram Model Improvement Program - """ - - audio: AgentV1SettingsAudio - agent: AgentV1SettingsAgent - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent.py b/src/deepgram/agent/v1/types/agent_v1settings_agent.py deleted file mode 100644 index b51a0247..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent.py +++ /dev/null @@ -1,39 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_context import AgentV1SettingsAgentContext -from .agent_v1settings_agent_listen import AgentV1SettingsAgentListen -from .agent_v1settings_agent_speak import AgentV1SettingsAgentSpeak -from .agent_v1settings_agent_think import AgentV1SettingsAgentThink - - -class AgentV1SettingsAgent(UniversalBaseModel): - language: typing.Optional[str] = pydantic.Field(default=None) - """ - Deprecated. Use `listen.provider.language` and `speak.provider.language` fields instead. - """ - - context: typing.Optional[AgentV1SettingsAgentContext] = pydantic.Field(default=None) - """ - Conversation context including the history of messages and function calls - """ - - listen: typing.Optional[AgentV1SettingsAgentListen] = None - think: typing.Optional[AgentV1SettingsAgentThink] = None - speak: typing.Optional[AgentV1SettingsAgentSpeak] = None - greeting: typing.Optional[str] = pydantic.Field(default=None) - """ - Optional message that agent will speak at the start - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py deleted file mode 100644 index 635f68b5..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_context_messages_item import AgentV1SettingsAgentContextMessagesItem - - -class AgentV1SettingsAgentContext(UniversalBaseModel): - """ - Conversation context including the history of messages and function calls - """ - - messages: typing.Optional[typing.List[AgentV1SettingsAgentContextMessagesItem]] = pydantic.Field(default=None) - """ - Conversation history as a list of messages and function calls - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item.py deleted file mode 100644 index 2061fd2d..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item.py +++ /dev/null @@ -1,12 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .agent_v1settings_agent_context_messages_item_content import AgentV1SettingsAgentContextMessagesItemContent -from .agent_v1settings_agent_context_messages_item_function_calls import ( - AgentV1SettingsAgentContextMessagesItemFunctionCalls, -) - -AgentV1SettingsAgentContextMessagesItem = typing.Union[ - AgentV1SettingsAgentContextMessagesItemContent, AgentV1SettingsAgentContextMessagesItemFunctionCalls -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_content.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_content.py deleted file mode 100644 index 9bc207ab..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_content.py +++ /dev/null @@ -1,39 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_context_messages_item_content_role import ( - AgentV1SettingsAgentContextMessagesItemContentRole, -) - - -class AgentV1SettingsAgentContextMessagesItemContent(UniversalBaseModel): - """ - Conversation text as part of the conversation history - """ - - type: typing.Literal["History"] = pydantic.Field(default="History") - """ - Message type identifier for conversation text - """ - - role: AgentV1SettingsAgentContextMessagesItemContentRole = pydantic.Field() - """ - Identifies who spoke the statement - """ - - content: str = pydantic.Field() - """ - The actual statement that was spoken - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_content_role.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_content_role.py deleted file mode 100644 index 19a3bcc0..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_content_role.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentContextMessagesItemContentRole = typing.Union[typing.Literal["user", "assistant"], typing.Any] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_function_calls.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_function_calls.py deleted file mode 100644 index 6759f8b3..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_function_calls.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_context_messages_item_function_calls_function_calls_item import ( - AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem, -) - - -class AgentV1SettingsAgentContextMessagesItemFunctionCalls(UniversalBaseModel): - """ - Client-side or server-side function call request and response as part of the conversation history - """ - - type: typing.Literal["History"] = "History" - function_calls: typing.List[AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem] = ( - pydantic.Field() - ) - """ - List of function call objects - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py deleted file mode 100644 index 9fead900..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_context_messages_item_function_calls_function_calls_item.py +++ /dev/null @@ -1,42 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem(UniversalBaseModel): - id: str = pydantic.Field() - """ - Unique identifier for the function call - """ - - name: str = pydantic.Field() - """ - Name of the function called - """ - - client_side: bool = pydantic.Field() - """ - Indicates if the call was client-side or server-side - """ - - arguments: str = pydantic.Field() - """ - Arguments passed to the function - """ - - response: str = pydantic.Field() - """ - Response from the function call - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen.py deleted file mode 100644 index 22951f00..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_listen_provider import AgentV1SettingsAgentListenProvider - - -class AgentV1SettingsAgentListen(UniversalBaseModel): - provider: typing.Optional[AgentV1SettingsAgentListenProvider] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py deleted file mode 100644 index 273b3157..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider.py +++ /dev/null @@ -1,49 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import pydantic -import typing_extensions -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentListenProvider_V1(UniversalBaseModel): - version: typing.Literal["v1"] = "v1" - type: typing.Literal["deepgram"] = "deepgram" - model: typing.Optional[str] = None - language: typing.Optional[str] = None - keyterms: typing.Optional[typing.List[str]] = None - smart_format: typing.Optional[bool] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentListenProvider_V2(UniversalBaseModel): - version: typing.Literal["v2"] = "v2" - type: typing.Literal["deepgram"] = "deepgram" - model: str - keyterms: typing.Optional[typing.List[str]] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -AgentV1SettingsAgentListenProvider = typing_extensions.Annotated[ - typing.Union[AgentV1SettingsAgentListenProvider_V1, AgentV1SettingsAgentListenProvider_V2], - pydantic.Field(discriminator="version"), -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider_v1.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider_v1.py deleted file mode 100644 index 1012454d..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider_v1.py +++ /dev/null @@ -1,42 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentListenProviderV1(UniversalBaseModel): - type: typing.Literal["deepgram"] = pydantic.Field(default="deepgram") - """ - Provider type for speech-to-text - """ - - model: typing.Optional[str] = pydantic.Field(default=None) - """ - Model to use for speech to text using the V1 API (e.g. Nova-3, Nova-2) - """ - - language: typing.Optional[str] = pydantic.Field(default=None) - """ - Language code to use for speech-to-text. Can be a BCP-47 language tag (e.g. `en`), or `multi` for code-switching transcription - """ - - keyterms: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - Prompt keyterm recognition to improve Keyword Recall Rate - """ - - smart_format: typing.Optional[bool] = pydantic.Field(default=None) - """ - Applies smart formatting to improve transcript readability - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider_v2.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider_v2.py deleted file mode 100644 index cf33274f..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_listen_provider_v2.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentListenProviderV2(UniversalBaseModel): - type: typing.Literal["deepgram"] = pydantic.Field(default="deepgram") - """ - Provider type for speech-to-text - """ - - model: str = pydantic.Field() - """ - Model to use for speech to text using the V2 API (e.g. flux-general-en) - """ - - keyterms: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - Prompt keyterm recognition to improve Keyword Recall Rate - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak.py deleted file mode 100644 index 0ad6d1c5..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .agent_v1settings_agent_speak_endpoint import AgentV1SettingsAgentSpeakEndpoint -from .agent_v1settings_agent_speak_one_item import AgentV1SettingsAgentSpeakOneItem - -AgentV1SettingsAgentSpeak = typing.Union[ - AgentV1SettingsAgentSpeakEndpoint, typing.List[AgentV1SettingsAgentSpeakOneItem] -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint.py deleted file mode 100644 index e6647bee..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_endpoint_endpoint import AgentV1SettingsAgentSpeakEndpointEndpoint -from .agent_v1settings_agent_speak_endpoint_provider import AgentV1SettingsAgentSpeakEndpointProvider - - -class AgentV1SettingsAgentSpeakEndpoint(UniversalBaseModel): - provider: AgentV1SettingsAgentSpeakEndpointProvider - endpoint: typing.Optional[AgentV1SettingsAgentSpeakEndpointEndpoint] = pydantic.Field(default=None) - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_endpoint.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_endpoint.py deleted file mode 100644 index e4dfb433..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_endpoint.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentSpeakEndpointEndpoint(UniversalBaseModel): - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ - - url: typing.Optional[str] = pydantic.Field(default=None) - """ - Custom TTS endpoint URL. Cannot contain `output_format` or `model_id` query - parameters when the provider is Eleven Labs. - """ - - headers: typing.Optional[typing.Dict[str, str]] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider.py deleted file mode 100644 index 9f9a08ac..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider.py +++ /dev/null @@ -1,131 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import pydantic -import typing_extensions -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials, -) -from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine, -) -from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice, -) -from .agent_v1settings_agent_speak_one_item_provider_cartesia_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId, -) -from .agent_v1settings_agent_speak_one_item_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice, -) -from .agent_v1settings_agent_speak_one_item_provider_deepgram_model import ( - AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel, -) -from .agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId, -) -from .agent_v1settings_agent_speak_one_item_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, -) -from .agent_v1settings_agent_speak_one_item_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, -) - - -class AgentV1SettingsAgentSpeakEndpointProvider_Deepgram(UniversalBaseModel): - type: typing.Literal["deepgram"] = "deepgram" - version: typing.Optional[typing.Literal["v1"]] = None - model: AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs(UniversalBaseModel): - type: typing.Literal["eleven_labs"] = "eleven_labs" - version: typing.Optional[typing.Literal["v1"]] = None - model_id: AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId - language: typing.Optional[str] = None - language_code: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentSpeakEndpointProvider_Cartesia(UniversalBaseModel): - type: typing.Literal["cartesia"] = "cartesia" - version: typing.Optional[typing.Literal["2025-03-17"]] = None - model_id: AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId - voice: AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice - language: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentSpeakEndpointProvider_OpenAi(UniversalBaseModel): - type: typing.Literal["open_ai"] = "open_ai" - version: typing.Optional[typing.Literal["v1"]] = None - model: AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel - voice: AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly(UniversalBaseModel): - type: typing.Literal["aws_polly"] = "aws_polly" - voice: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice - language: str - language_code: typing.Optional[str] = None - engine: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine - credentials: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -AgentV1SettingsAgentSpeakEndpointProvider = typing_extensions.Annotated[ - typing.Union[ - AgentV1SettingsAgentSpeakEndpointProvider_Deepgram, - AgentV1SettingsAgentSpeakEndpointProvider_ElevenLabs, - AgentV1SettingsAgentSpeakEndpointProvider_Cartesia, - AgentV1SettingsAgentSpeakEndpointProvider_OpenAi, - AgentV1SettingsAgentSpeakEndpointProvider_AwsPolly, - ], - pydantic.Field(discriminator="type"), -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly.py deleted file mode 100644 index 60126fc6..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly.py +++ /dev/null @@ -1,44 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials, -) -from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine, -) -from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice, -) - - -class AgentV1SettingsAgentSpeakEndpointProviderAwsPolly(UniversalBaseModel): - voice: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice = pydantic.Field() - """ - AWS Polly voice name - """ - - language: str = pydantic.Field() - """ - Language to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the AWS Polly API - """ - - language_code: typing.Optional[str] = pydantic.Field(default=None) - """ - Use the `language` field instead. - """ - - engine: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine - credentials: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials.py deleted file mode 100644 index 3aef30ab..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials_type import ( - AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType, -) - - -class AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials(UniversalBaseModel): - type: AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType - region: str - access_key_id: str - secret_access_key: str - session_token: typing.Optional[str] = pydantic.Field(default=None) - """ - Required for STS only - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials_type.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials_type.py deleted file mode 100644 index 515f0617..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_credentials_type.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType = typing.Union[ - typing.Literal["sts", "iam"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_engine.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_engine.py deleted file mode 100644 index 2f182419..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_engine.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine = typing.Union[ - typing.Literal["generative", "long-form", "standard", "neural"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_voice.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_voice.py deleted file mode 100644 index 0079e7b3..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_aws_polly_voice.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice = typing.Union[ - typing.Literal["Matthew", "Joanna", "Amy", "Emma", "Brian", "Arthur", "Aria", "Ayanda"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_cartesia_model_id.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_cartesia_model_id.py deleted file mode 100644 index b81e30b3..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_cartesia_model_id.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId = typing.Union[ - typing.Literal["sonic-2", "sonic-multilingual"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_cartesia_voice.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_cartesia_voice.py deleted file mode 100644 index 52d23801..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_cartesia_voice.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice(UniversalBaseModel): - mode: str = pydantic.Field() - """ - Cartesia voice mode - """ - - id: str = pydantic.Field() - """ - Cartesia voice ID - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_deepgram_model.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_deepgram_model.py deleted file mode 100644 index 161119d8..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_deepgram_model.py +++ /dev/null @@ -1,72 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel = typing.Union[ - typing.Literal[ - "aura-asteria-en", - "aura-luna-en", - "aura-stella-en", - "aura-athena-en", - "aura-hera-en", - "aura-orion-en", - "aura-arcas-en", - "aura-perseus-en", - "aura-angus-en", - "aura-orpheus-en", - "aura-helios-en", - "aura-zeus-en", - "aura-2-amalthea-en", - "aura-2-andromeda-en", - "aura-2-apollo-en", - "aura-2-arcas-en", - "aura-2-aries-en", - "aura-2-asteria-en", - "aura-2-athena-en", - "aura-2-atlas-en", - "aura-2-aurora-en", - "aura-2-callista-en", - "aura-2-cora-en", - "aura-2-cordelia-en", - "aura-2-delia-en", - "aura-2-draco-en", - "aura-2-electra-en", - "aura-2-harmonia-en", - "aura-2-helena-en", - "aura-2-hera-en", - "aura-2-hermes-en", - "aura-2-hyperion-en", - "aura-2-iris-en", - "aura-2-janus-en", - "aura-2-juno-en", - "aura-2-jupiter-en", - "aura-2-luna-en", - "aura-2-mars-en", - "aura-2-minerva-en", - "aura-2-neptune-en", - "aura-2-odysseus-en", - "aura-2-ophelia-en", - "aura-2-orion-en", - "aura-2-orpheus-en", - "aura-2-pandora-en", - "aura-2-phoebe-en", - "aura-2-pluto-en", - "aura-2-saturn-en", - "aura-2-selene-en", - "aura-2-thalia-en", - "aura-2-theia-en", - "aura-2-vesta-en", - "aura-2-zeus-en", - "aura-2-sirio-es", - "aura-2-nestor-es", - "aura-2-carina-es", - "aura-2-celeste-es", - "aura-2-alvaro-es", - "aura-2-diana-es", - "aura-2-aquila-es", - "aura-2-selena-es", - "aura-2-estrella-es", - "aura-2-javier-es", - ], - typing.Any, -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_eleven_labs_model_id.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_eleven_labs_model_id.py deleted file mode 100644 index 4ed8c7e8..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_eleven_labs_model_id.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId = typing.Union[ - typing.Literal["eleven_turbo_v2_5", "eleven_monolingual_v1", "eleven_multilingual_v2"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_open_ai_model.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_open_ai_model.py deleted file mode 100644 index f83a1943..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_open_ai_model.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel = typing.Union[typing.Literal["tts-1", "tts-1-hd"], typing.Any] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_open_ai_voice.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_open_ai_voice.py deleted file mode 100644 index 0e8a10eb..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_endpoint_provider_open_ai_voice.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice = typing.Union[ - typing.Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item.py deleted file mode 100644 index 5b98ebe9..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_one_item_endpoint import AgentV1SettingsAgentSpeakOneItemEndpoint -from .agent_v1settings_agent_speak_one_item_provider import AgentV1SettingsAgentSpeakOneItemProvider - - -class AgentV1SettingsAgentSpeakOneItem(UniversalBaseModel): - provider: AgentV1SettingsAgentSpeakOneItemProvider - endpoint: typing.Optional[AgentV1SettingsAgentSpeakOneItemEndpoint] = pydantic.Field(default=None) - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_endpoint.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_endpoint.py deleted file mode 100644 index 80057ae3..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_endpoint.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentSpeakOneItemEndpoint(UniversalBaseModel): - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ - - url: typing.Optional[str] = pydantic.Field(default=None) - """ - Custom TTS endpoint URL. Cannot contain `output_format` or `model_id` query - parameters when the provider is Eleven Labs. - """ - - headers: typing.Optional[typing.Dict[str, str]] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider.py deleted file mode 100644 index 5a1ae21d..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider.py +++ /dev/null @@ -1,131 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import pydantic -import typing_extensions -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials, -) -from .agent_v1settings_agent_speak_one_item_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine, -) -from .agent_v1settings_agent_speak_one_item_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice, -) -from .agent_v1settings_agent_speak_one_item_provider_cartesia_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId, -) -from .agent_v1settings_agent_speak_one_item_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice, -) -from .agent_v1settings_agent_speak_one_item_provider_deepgram_model import ( - AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel, -) -from .agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId, -) -from .agent_v1settings_agent_speak_one_item_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, -) -from .agent_v1settings_agent_speak_one_item_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, -) - - -class AgentV1SettingsAgentSpeakOneItemProvider_Deepgram(UniversalBaseModel): - type: typing.Literal["deepgram"] = "deepgram" - version: typing.Optional[typing.Literal["v1"]] = None - model: AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs(UniversalBaseModel): - type: typing.Literal["eleven_labs"] = "eleven_labs" - version: typing.Optional[typing.Literal["v1"]] = None - model_id: AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId - language: typing.Optional[str] = None - language_code: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentSpeakOneItemProvider_Cartesia(UniversalBaseModel): - type: typing.Literal["cartesia"] = "cartesia" - version: typing.Optional[typing.Literal["2025-03-17"]] = None - model_id: AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId - voice: AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice - language: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentSpeakOneItemProvider_OpenAi(UniversalBaseModel): - type: typing.Literal["open_ai"] = "open_ai" - version: typing.Optional[typing.Literal["v1"]] = None - model: AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel - voice: AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly(UniversalBaseModel): - type: typing.Literal["aws_polly"] = "aws_polly" - voice: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice - language: str - language_code: typing.Optional[str] = None - engine: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine - credentials: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -AgentV1SettingsAgentSpeakOneItemProvider = typing_extensions.Annotated[ - typing.Union[ - AgentV1SettingsAgentSpeakOneItemProvider_Deepgram, - AgentV1SettingsAgentSpeakOneItemProvider_ElevenLabs, - AgentV1SettingsAgentSpeakOneItemProvider_Cartesia, - AgentV1SettingsAgentSpeakOneItemProvider_OpenAi, - AgentV1SettingsAgentSpeakOneItemProvider_AwsPolly, - ], - pydantic.Field(discriminator="type"), -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly.py deleted file mode 100644 index b1745b2a..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly.py +++ /dev/null @@ -1,44 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials, -) -from .agent_v1settings_agent_speak_one_item_provider_aws_polly_engine import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine, -) -from .agent_v1settings_agent_speak_one_item_provider_aws_polly_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice, -) - - -class AgentV1SettingsAgentSpeakOneItemProviderAwsPolly(UniversalBaseModel): - voice: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice = pydantic.Field() - """ - AWS Polly voice name - """ - - language: str = pydantic.Field() - """ - Language code to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the AWS Polly API - """ - - language_code: typing.Optional[str] = pydantic.Field(default=None) - """ - Use the `language` field instead. - """ - - engine: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine - credentials: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials.py deleted file mode 100644 index a2ff5808..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials_type import ( - AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType, -) - - -class AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials(UniversalBaseModel): - type: AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType - region: str - access_key_id: str - secret_access_key: str - session_token: typing.Optional[str] = pydantic.Field(default=None) - """ - Required for STS only - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials_type.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials_type.py deleted file mode 100644 index 3cd1c64f..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_credentials_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType = typing.Union[typing.Literal["sts", "iam"], typing.Any] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_engine.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_engine.py deleted file mode 100644 index 7313bd82..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_engine.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine = typing.Union[ - typing.Literal["generative", "long-form", "standard", "neural"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_voice.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_voice.py deleted file mode 100644 index ad77ee0f..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_aws_polly_voice.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice = typing.Union[ - typing.Literal["Matthew", "Joanna", "Amy", "Emma", "Brian", "Arthur", "Aria", "Ayanda"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_cartesia_model_id.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_cartesia_model_id.py deleted file mode 100644 index 8d062938..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_cartesia_model_id.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId = typing.Union[ - typing.Literal["sonic-2", "sonic-multilingual"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_cartesia_voice.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_cartesia_voice.py deleted file mode 100644 index 58197431..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_cartesia_voice.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice(UniversalBaseModel): - mode: str = pydantic.Field() - """ - Cartesia voice mode - """ - - id: str = pydantic.Field() - """ - Cartesia voice ID - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_deepgram_model.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_deepgram_model.py deleted file mode 100644 index 2c896d8d..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_deepgram_model.py +++ /dev/null @@ -1,72 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel = typing.Union[ - typing.Literal[ - "aura-asteria-en", - "aura-luna-en", - "aura-stella-en", - "aura-athena-en", - "aura-hera-en", - "aura-orion-en", - "aura-arcas-en", - "aura-perseus-en", - "aura-angus-en", - "aura-orpheus-en", - "aura-helios-en", - "aura-zeus-en", - "aura-2-amalthea-en", - "aura-2-andromeda-en", - "aura-2-apollo-en", - "aura-2-arcas-en", - "aura-2-aries-en", - "aura-2-asteria-en", - "aura-2-athena-en", - "aura-2-atlas-en", - "aura-2-aurora-en", - "aura-2-callista-en", - "aura-2-cora-en", - "aura-2-cordelia-en", - "aura-2-delia-en", - "aura-2-draco-en", - "aura-2-electra-en", - "aura-2-harmonia-en", - "aura-2-helena-en", - "aura-2-hera-en", - "aura-2-hermes-en", - "aura-2-hyperion-en", - "aura-2-iris-en", - "aura-2-janus-en", - "aura-2-juno-en", - "aura-2-jupiter-en", - "aura-2-luna-en", - "aura-2-mars-en", - "aura-2-minerva-en", - "aura-2-neptune-en", - "aura-2-odysseus-en", - "aura-2-ophelia-en", - "aura-2-orion-en", - "aura-2-orpheus-en", - "aura-2-pandora-en", - "aura-2-phoebe-en", - "aura-2-pluto-en", - "aura-2-saturn-en", - "aura-2-selene-en", - "aura-2-thalia-en", - "aura-2-theia-en", - "aura-2-vesta-en", - "aura-2-zeus-en", - "aura-2-sirio-es", - "aura-2-nestor-es", - "aura-2-carina-es", - "aura-2-celeste-es", - "aura-2-alvaro-es", - "aura-2-diana-es", - "aura-2-aquila-es", - "aura-2-selena-es", - "aura-2-estrella-es", - "aura-2-javier-es", - ], - typing.Any, -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id.py deleted file mode 100644 index f2bbee02..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId = typing.Union[ - typing.Literal["eleven_turbo_v2_5", "eleven_monolingual_v1", "eleven_multilingual_v2"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_open_ai_model.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_open_ai_model.py deleted file mode 100644 index 21ea5697..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_open_ai_model.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel = typing.Union[typing.Literal["tts-1", "tts-1-hd"], typing.Any] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_open_ai_voice.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_open_ai_voice.py deleted file mode 100644 index 7e4bc122..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_speak_one_item_provider_open_ai_voice.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice = typing.Union[ - typing.Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think.py deleted file mode 100644 index 7247b0ea..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_think_context_length import AgentV1SettingsAgentThinkContextLength -from .agent_v1settings_agent_think_endpoint import AgentV1SettingsAgentThinkEndpoint -from .agent_v1settings_agent_think_functions_item import AgentV1SettingsAgentThinkFunctionsItem -from .agent_v1settings_agent_think_provider import AgentV1SettingsAgentThinkProvider - - -class AgentV1SettingsAgentThink(UniversalBaseModel): - provider: AgentV1SettingsAgentThinkProvider - endpoint: typing.Optional[AgentV1SettingsAgentThinkEndpoint] = pydantic.Field(default=None) - """ - Optional for non-Deepgram LLM providers. When present, must include url field and headers object - """ - - functions: typing.Optional[typing.List[AgentV1SettingsAgentThinkFunctionsItem]] = None - prompt: typing.Optional[str] = None - context_length: typing.Optional[AgentV1SettingsAgentThinkContextLength] = pydantic.Field(default=None) - """ - Specifies the number of characters retained in context between user messages, agent responses, and function calls. This setting is only configurable when a custom think endpoint is used - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_context_length.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_context_length.py deleted file mode 100644 index daac7703..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_context_length.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentThinkContextLength = typing.Union[typing.Literal["max"], float] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_endpoint.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_endpoint.py deleted file mode 100644 index 1e17900b..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_endpoint.py +++ /dev/null @@ -1,31 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentThinkEndpoint(UniversalBaseModel): - """ - Optional for non-Deepgram LLM providers. When present, must include url field and headers object - """ - - url: typing.Optional[str] = pydantic.Field(default=None) - """ - Custom LLM endpoint URL - """ - - headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) - """ - Custom headers for the endpoint - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_functions_item.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_functions_item.py deleted file mode 100644 index 05a77bba..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_functions_item.py +++ /dev/null @@ -1,38 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_think_functions_item_endpoint import AgentV1SettingsAgentThinkFunctionsItemEndpoint - - -class AgentV1SettingsAgentThinkFunctionsItem(UniversalBaseModel): - name: typing.Optional[str] = pydantic.Field(default=None) - """ - Function name - """ - - description: typing.Optional[str] = pydantic.Field(default=None) - """ - Function description - """ - - parameters: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) - """ - Function parameters - """ - - endpoint: typing.Optional[AgentV1SettingsAgentThinkFunctionsItemEndpoint] = pydantic.Field(default=None) - """ - The Function endpoint to call. if not passed, function is called client-side - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_functions_item_endpoint.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_functions_item_endpoint.py deleted file mode 100644 index e8e48f39..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_functions_item_endpoint.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsAgentThinkFunctionsItemEndpoint(UniversalBaseModel): - """ - The Function endpoint to call. if not passed, function is called client-side - """ - - url: typing.Optional[str] = pydantic.Field(default=None) - """ - Endpoint URL - """ - - method: typing.Optional[str] = pydantic.Field(default=None) - """ - HTTP method - """ - - headers: typing.Optional[typing.Dict[str, str]] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider.py deleted file mode 100644 index 44fe4418..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider.py +++ /dev/null @@ -1,113 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import pydantic -import typing_extensions -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_one_item_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, -) -from .agent_v1settings_agent_speak_one_item_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, -) -from .agent_v1settings_agent_think_provider_anthropic_model import AgentV1SettingsAgentThinkProviderAnthropicModel -from .agent_v1settings_agent_think_provider_aws_bedrock_credentials import ( - AgentV1SettingsAgentThinkProviderAwsBedrockCredentials, -) -from .agent_v1settings_agent_think_provider_aws_bedrock_model import AgentV1SettingsAgentThinkProviderAwsBedrockModel -from .agent_v1settings_agent_think_provider_google_model import AgentV1SettingsAgentThinkProviderGoogleModel - - -class AgentV1SettingsAgentThinkProvider_OpenAi(UniversalBaseModel): - type: typing.Literal["open_ai"] = "open_ai" - version: typing.Optional[typing.Literal["v1"]] = None - model: AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel - voice: AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentThinkProvider_AwsBedrock(UniversalBaseModel): - type: typing.Literal["aws_bedrock"] = "aws_bedrock" - model: AgentV1SettingsAgentThinkProviderAwsBedrockModel - temperature: typing.Optional[float] = None - credentials: typing.Optional[AgentV1SettingsAgentThinkProviderAwsBedrockCredentials] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentThinkProvider_Anthropic(UniversalBaseModel): - type: typing.Literal["anthropic"] = "anthropic" - version: typing.Optional[typing.Literal["v1"]] = None - model: AgentV1SettingsAgentThinkProviderAnthropicModel - temperature: typing.Optional[float] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentThinkProvider_Google(UniversalBaseModel): - type: typing.Literal["google"] = "google" - version: typing.Optional[typing.Literal["v1beta"]] = None - model: AgentV1SettingsAgentThinkProviderGoogleModel - temperature: typing.Optional[float] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1SettingsAgentThinkProvider_Groq(UniversalBaseModel): - type: typing.Literal["groq"] = "groq" - version: typing.Optional[typing.Literal["v1"]] = None - model: typing.Literal["openai/gpt-oss-20b"] = "openai/gpt-oss-20b" - temperature: typing.Optional[float] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -AgentV1SettingsAgentThinkProvider = typing_extensions.Annotated[ - typing.Union[ - AgentV1SettingsAgentThinkProvider_OpenAi, - AgentV1SettingsAgentThinkProvider_AwsBedrock, - AgentV1SettingsAgentThinkProvider_Anthropic, - AgentV1SettingsAgentThinkProvider_Google, - AgentV1SettingsAgentThinkProvider_Groq, - ], - pydantic.Field(discriminator="type"), -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_anthropic_model.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_anthropic_model.py deleted file mode 100644 index 5fdf5752..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_anthropic_model.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentThinkProviderAnthropicModel = typing.Union[ - typing.Literal["claude-3-5-haiku-latest", "claude-sonnet-4-20250514"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock.py deleted file mode 100644 index d83d33cc..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock.py +++ /dev/null @@ -1,36 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_think_provider_aws_bedrock_credentials import ( - AgentV1SettingsAgentThinkProviderAwsBedrockCredentials, -) -from .agent_v1settings_agent_think_provider_aws_bedrock_model import AgentV1SettingsAgentThinkProviderAwsBedrockModel - - -class AgentV1SettingsAgentThinkProviderAwsBedrock(UniversalBaseModel): - model: AgentV1SettingsAgentThinkProviderAwsBedrockModel = pydantic.Field() - """ - AWS Bedrock model to use - """ - - temperature: typing.Optional[float] = pydantic.Field(default=None) - """ - AWS Bedrock temperature (0-2) - """ - - credentials: typing.Optional[AgentV1SettingsAgentThinkProviderAwsBedrockCredentials] = pydantic.Field(default=None) - """ - AWS credentials type (STS short-lived or IAM long-lived) - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock_credentials.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock_credentials.py deleted file mode 100644 index a990a383..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock_credentials.py +++ /dev/null @@ -1,49 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_think_provider_aws_bedrock_credentials_type import ( - AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType, -) - - -class AgentV1SettingsAgentThinkProviderAwsBedrockCredentials(UniversalBaseModel): - """ - AWS credentials type (STS short-lived or IAM long-lived) - """ - - type: typing.Optional[AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType] = pydantic.Field(default=None) - """ - AWS credentials type (STS short-lived or IAM long-lived) - """ - - region: typing.Optional[str] = pydantic.Field(default=None) - """ - AWS region - """ - - access_key_id: typing.Optional[str] = pydantic.Field(default=None) - """ - AWS access key - """ - - secret_access_key: typing.Optional[str] = pydantic.Field(default=None) - """ - AWS secret access key - """ - - session_token: typing.Optional[str] = pydantic.Field(default=None) - """ - AWS session token (required for STS only) - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock_credentials_type.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock_credentials_type.py deleted file mode 100644 index 4e684119..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock_credentials_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentThinkProviderAwsBedrockCredentialsType = typing.Union[typing.Literal["sts", "iam"], typing.Any] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock_model.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock_model.py deleted file mode 100644 index 6f65754b..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_aws_bedrock_model.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentThinkProviderAwsBedrockModel = typing.Union[ - typing.Literal["anthropic/claude-3-5-sonnet-20240620-v1:0", "anthropic/claude-3-5-haiku-20240307-v1:0"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_google_model.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_google_model.py deleted file mode 100644 index 5a73f7cb..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_google_model.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentThinkProviderGoogleModel = typing.Union[ - typing.Literal["gemini-2.0-flash", "gemini-2.0-flash-lite", "gemini-2.5-flash"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_open_ai_model.py b/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_open_ai_model.py deleted file mode 100644 index d124ae22..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_agent_think_provider_open_ai_model.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAgentThinkProviderOpenAiModel = typing.Union[ - typing.Literal[ - "gpt-5", "gpt-5-mini", "gpt-5-nano", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4o", "gpt-4o-mini" - ], - typing.Any, -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_applied.py b/src/deepgram/agent/v1/types/agent_v1settings_applied.py deleted file mode 100644 index a17ad602..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_applied.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsApplied(UniversalBaseModel): - type: typing.Literal["SettingsApplied"] = pydantic.Field(default="SettingsApplied") - """ - Message type identifier for settings applied confirmation - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_audio.py b/src/deepgram/agent/v1/types/agent_v1settings_audio.py deleted file mode 100644 index 29350538..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_audio.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_audio_input import AgentV1SettingsAudioInput -from .agent_v1settings_audio_output import AgentV1SettingsAudioOutput - - -class AgentV1SettingsAudio(UniversalBaseModel): - input: typing.Optional[AgentV1SettingsAudioInput] = pydantic.Field(default=None) - """ - Audio input configuration settings. If omitted, defaults to encoding=linear16 and sample_rate=24000. Higher sample rates like 44100 Hz provide better audio quality. - """ - - output: typing.Optional[AgentV1SettingsAudioOutput] = pydantic.Field(default=None) - """ - Audio output configuration settings - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_audio_input.py b/src/deepgram/agent/v1/types/agent_v1settings_audio_input.py deleted file mode 100644 index 8b9cae76..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_audio_input.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_audio_input_encoding import AgentV1SettingsAudioInputEncoding - - -class AgentV1SettingsAudioInput(UniversalBaseModel): - """ - Audio input configuration settings. If omitted, defaults to encoding=linear16 and sample_rate=24000. Higher sample rates like 44100 Hz provide better audio quality. - """ - - encoding: AgentV1SettingsAudioInputEncoding = pydantic.Field() - """ - Audio encoding format - """ - - sample_rate: float = pydantic.Field() - """ - Sample rate in Hz. Common values are 16000, 24000, 44100, 48000 - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_audio_input_encoding.py b/src/deepgram/agent/v1/types/agent_v1settings_audio_input_encoding.py deleted file mode 100644 index 232072d3..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_audio_input_encoding.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAudioInputEncoding = typing.Union[ - typing.Literal[ - "linear16", "linear32", "flac", "alaw", "mulaw", "amr-nb", "amr-wb", "opus", "ogg-opus", "speex", "g729" - ], - typing.Any, -] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_audio_output.py b/src/deepgram/agent/v1/types/agent_v1settings_audio_output.py deleted file mode 100644 index e0c0efc8..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_audio_output.py +++ /dev/null @@ -1,42 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_audio_output_encoding import AgentV1SettingsAudioOutputEncoding - - -class AgentV1SettingsAudioOutput(UniversalBaseModel): - """ - Audio output configuration settings - """ - - encoding: typing.Optional[AgentV1SettingsAudioOutputEncoding] = pydantic.Field(default=None) - """ - Audio encoding format for streaming TTS output - """ - - sample_rate: typing.Optional[float] = pydantic.Field(default=None) - """ - Sample rate in Hz - """ - - bitrate: typing.Optional[float] = pydantic.Field(default=None) - """ - Audio bitrate in bits per second - """ - - container: typing.Optional[str] = pydantic.Field(default=None) - """ - Audio container format. If omitted, defaults to 'none' - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1settings_audio_output_encoding.py b/src/deepgram/agent/v1/types/agent_v1settings_audio_output_encoding.py deleted file mode 100644 index f4b7ca42..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_audio_output_encoding.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1SettingsAudioOutputEncoding = typing.Union[typing.Literal["linear16", "mulaw", "alaw"], typing.Any] diff --git a/src/deepgram/agent/v1/types/agent_v1settings_flags.py b/src/deepgram/agent/v1/types/agent_v1settings_flags.py deleted file mode 100644 index db3e96cd..00000000 --- a/src/deepgram/agent/v1/types/agent_v1settings_flags.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SettingsFlags(UniversalBaseModel): - history: typing.Optional[bool] = pydantic.Field(default=None) - """ - Enable or disable history message reporting - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1speak_updated.py b/src/deepgram/agent/v1/types/agent_v1speak_updated.py deleted file mode 100644 index aeba09d8..00000000 --- a/src/deepgram/agent/v1/types/agent_v1speak_updated.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1SpeakUpdated(UniversalBaseModel): - type: typing.Literal["SpeakUpdated"] = pydantic.Field(default="SpeakUpdated") - """ - Message type identifier for speak update confirmation - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_prompt.py b/src/deepgram/agent/v1/types/agent_v1update_prompt.py deleted file mode 100644 index a479b01b..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_prompt.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1UpdatePrompt(UniversalBaseModel): - type: typing.Literal["UpdatePrompt"] = pydantic.Field(default="UpdatePrompt") - """ - Message type identifier for prompt update request - """ - - prompt: str = pydantic.Field() - """ - The new system prompt to be used by the agent - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak.py b/src/deepgram/agent/v1/types/agent_v1update_speak.py deleted file mode 100644 index f776f945..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1update_speak_speak import AgentV1UpdateSpeakSpeak - - -class AgentV1UpdateSpeak(UniversalBaseModel): - type: typing.Literal["UpdateSpeak"] = pydantic.Field(default="UpdateSpeak") - """ - Message type identifier for updating the speak model - """ - - speak: AgentV1UpdateSpeakSpeak = pydantic.Field() - """ - Configuration for the speak model. Optional, defaults to latest deepgram TTS model - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak.py deleted file mode 100644 index 3ad7b53a..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1update_speak_speak_endpoint import AgentV1UpdateSpeakSpeakEndpoint -from .agent_v1update_speak_speak_provider import AgentV1UpdateSpeakSpeakProvider - - -class AgentV1UpdateSpeakSpeak(UniversalBaseModel): - """ - Configuration for the speak model. Optional, defaults to latest deepgram TTS model - """ - - provider: AgentV1UpdateSpeakSpeakProvider - endpoint: typing.Optional[AgentV1UpdateSpeakSpeakEndpoint] = pydantic.Field(default=None) - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_endpoint.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_endpoint.py deleted file mode 100644 index 2c65c454..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_endpoint.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1UpdateSpeakSpeakEndpoint(UniversalBaseModel): - """ - Optional if provider is Deepgram. Required for non-Deepgram TTS providers. - When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. - """ - - url: typing.Optional[str] = pydantic.Field(default=None) - """ - Custom TTS endpoint URL. Cannot contain `output_format` or `model_id` query - parameters when the provider is Eleven Labs. - """ - - headers: typing.Optional[typing.Dict[str, str]] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider.py deleted file mode 100644 index 606ae9ce..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider.py +++ /dev/null @@ -1,115 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from __future__ import annotations - -import typing - -import pydantic -import typing_extensions -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1update_speak_speak_provider_aws_polly_credentials import ( - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials, -) -from .agent_v1update_speak_speak_provider_aws_polly_engine import AgentV1UpdateSpeakSpeakProviderAwsPollyEngine -from .agent_v1update_speak_speak_provider_aws_polly_voice import AgentV1UpdateSpeakSpeakProviderAwsPollyVoice -from .agent_v1update_speak_speak_provider_cartesia_model_id import AgentV1UpdateSpeakSpeakProviderCartesiaModelId -from .agent_v1update_speak_speak_provider_cartesia_voice import AgentV1UpdateSpeakSpeakProviderCartesiaVoice -from .agent_v1update_speak_speak_provider_deepgram_model import AgentV1UpdateSpeakSpeakProviderDeepgramModel -from .agent_v1update_speak_speak_provider_eleven_labs_model_id import AgentV1UpdateSpeakSpeakProviderElevenLabsModelId -from .agent_v1update_speak_speak_provider_open_ai_model import AgentV1UpdateSpeakSpeakProviderOpenAiModel -from .agent_v1update_speak_speak_provider_open_ai_voice import AgentV1UpdateSpeakSpeakProviderOpenAiVoice - - -class AgentV1UpdateSpeakSpeakProvider_Deepgram(UniversalBaseModel): - type: typing.Literal["deepgram"] = "deepgram" - version: typing.Optional[typing.Literal["v1"]] = None - model: AgentV1UpdateSpeakSpeakProviderDeepgramModel - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1UpdateSpeakSpeakProvider_ElevenLabs(UniversalBaseModel): - type: typing.Literal["eleven_labs"] = "eleven_labs" - version: typing.Optional[typing.Literal["v1"]] = None - model_id: AgentV1UpdateSpeakSpeakProviderElevenLabsModelId - language: typing.Optional[str] = None - language_code: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1UpdateSpeakSpeakProvider_Cartesia(UniversalBaseModel): - type: typing.Literal["cartesia"] = "cartesia" - version: typing.Optional[typing.Literal["2025-03-17"]] = None - model_id: AgentV1UpdateSpeakSpeakProviderCartesiaModelId - voice: AgentV1UpdateSpeakSpeakProviderCartesiaVoice - language: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1UpdateSpeakSpeakProvider_OpenAi(UniversalBaseModel): - type: typing.Literal["open_ai"] = "open_ai" - version: typing.Optional[typing.Literal["v1"]] = None - model: AgentV1UpdateSpeakSpeakProviderOpenAiModel - voice: AgentV1UpdateSpeakSpeakProviderOpenAiVoice - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -class AgentV1UpdateSpeakSpeakProvider_AwsPolly(UniversalBaseModel): - type: typing.Literal["aws_polly"] = "aws_polly" - voice: AgentV1UpdateSpeakSpeakProviderAwsPollyVoice - language: str - language_code: typing.Optional[str] = None - engine: AgentV1UpdateSpeakSpeakProviderAwsPollyEngine - credentials: AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow - - -AgentV1UpdateSpeakSpeakProvider = typing_extensions.Annotated[ - typing.Union[ - AgentV1UpdateSpeakSpeakProvider_Deepgram, - AgentV1UpdateSpeakSpeakProvider_ElevenLabs, - AgentV1UpdateSpeakSpeakProvider_Cartesia, - AgentV1UpdateSpeakSpeakProvider_OpenAi, - AgentV1UpdateSpeakSpeakProvider_AwsPolly, - ], - pydantic.Field(discriminator="type"), -] diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly.py deleted file mode 100644 index 73970576..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly.py +++ /dev/null @@ -1,40 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1update_speak_speak_provider_aws_polly_credentials import ( - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials, -) -from .agent_v1update_speak_speak_provider_aws_polly_engine import AgentV1UpdateSpeakSpeakProviderAwsPollyEngine -from .agent_v1update_speak_speak_provider_aws_polly_voice import AgentV1UpdateSpeakSpeakProviderAwsPollyVoice - - -class AgentV1UpdateSpeakSpeakProviderAwsPolly(UniversalBaseModel): - voice: AgentV1UpdateSpeakSpeakProviderAwsPollyVoice = pydantic.Field() - """ - AWS Polly voice name - """ - - language: str = pydantic.Field() - """ - Language code to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the AWS Polly API - """ - - language_code: typing.Optional[str] = pydantic.Field(default=None) - """ - Use the `language` field instead. - """ - - engine: AgentV1UpdateSpeakSpeakProviderAwsPollyEngine - credentials: AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_credentials.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_credentials.py deleted file mode 100644 index 0ec682b2..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_credentials.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1update_speak_speak_provider_aws_polly_credentials_type import ( - AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType, -) - - -class AgentV1UpdateSpeakSpeakProviderAwsPollyCredentials(UniversalBaseModel): - type: AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType - region: str - access_key_id: str - secret_access_key: str - session_token: typing.Optional[str] = pydantic.Field(default=None) - """ - Required for STS only - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_credentials_type.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_credentials_type.py deleted file mode 100644 index 984051d8..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_credentials_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1UpdateSpeakSpeakProviderAwsPollyCredentialsType = typing.Union[typing.Literal["sts", "iam"], typing.Any] diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_engine.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_engine.py deleted file mode 100644 index 2a641f24..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_engine.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1UpdateSpeakSpeakProviderAwsPollyEngine = typing.Union[ - typing.Literal["generative", "long-form", "standard", "neural"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_voice.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_voice.py deleted file mode 100644 index 2be92987..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_aws_polly_voice.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1UpdateSpeakSpeakProviderAwsPollyVoice = typing.Union[ - typing.Literal["Matthew", "Joanna", "Amy", "Emma", "Brian", "Arthur", "Aria", "Ayanda"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_cartesia.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_cartesia.py deleted file mode 100644 index c52aa44f..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_cartesia.py +++ /dev/null @@ -1,35 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1update_speak_speak_provider_cartesia_model_id import AgentV1UpdateSpeakSpeakProviderCartesiaModelId -from .agent_v1update_speak_speak_provider_cartesia_voice import AgentV1UpdateSpeakSpeakProviderCartesiaVoice - - -class AgentV1UpdateSpeakSpeakProviderCartesia(UniversalBaseModel): - version: typing.Optional[typing.Literal["2025-03-17"]] = pydantic.Field(default=None) - """ - The API version header for the Cartesia text-to-speech API - """ - - model_id: AgentV1UpdateSpeakSpeakProviderCartesiaModelId = pydantic.Field() - """ - Cartesia model ID - """ - - voice: AgentV1UpdateSpeakSpeakProviderCartesiaVoice - language: typing.Optional[str] = pydantic.Field(default=None) - """ - Cartesia language code - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_cartesia_model_id.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_cartesia_model_id.py deleted file mode 100644 index 0cee24cd..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_cartesia_model_id.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1UpdateSpeakSpeakProviderCartesiaModelId = typing.Union[ - typing.Literal["sonic-2", "sonic-multilingual"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_cartesia_voice.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_cartesia_voice.py deleted file mode 100644 index 2a6a918f..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_cartesia_voice.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1UpdateSpeakSpeakProviderCartesiaVoice(UniversalBaseModel): - mode: str = pydantic.Field() - """ - Cartesia voice mode - """ - - id: str = pydantic.Field() - """ - Cartesia voice ID - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_deepgram.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_deepgram.py deleted file mode 100644 index c6648566..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_deepgram.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1update_speak_speak_provider_deepgram_model import AgentV1UpdateSpeakSpeakProviderDeepgramModel - - -class AgentV1UpdateSpeakSpeakProviderDeepgram(UniversalBaseModel): - version: typing.Optional[typing.Literal["v1"]] = pydantic.Field(default=None) - """ - The REST API version for the Deepgram text-to-speech API - """ - - model: AgentV1UpdateSpeakSpeakProviderDeepgramModel = pydantic.Field() - """ - Deepgram TTS model - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_deepgram_model.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_deepgram_model.py deleted file mode 100644 index 2e0a9ab9..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_deepgram_model.py +++ /dev/null @@ -1,72 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1UpdateSpeakSpeakProviderDeepgramModel = typing.Union[ - typing.Literal[ - "aura-asteria-en", - "aura-luna-en", - "aura-stella-en", - "aura-athena-en", - "aura-hera-en", - "aura-orion-en", - "aura-arcas-en", - "aura-perseus-en", - "aura-angus-en", - "aura-orpheus-en", - "aura-helios-en", - "aura-zeus-en", - "aura-2-amalthea-en", - "aura-2-andromeda-en", - "aura-2-apollo-en", - "aura-2-arcas-en", - "aura-2-aries-en", - "aura-2-asteria-en", - "aura-2-athena-en", - "aura-2-atlas-en", - "aura-2-aurora-en", - "aura-2-callista-en", - "aura-2-cora-en", - "aura-2-cordelia-en", - "aura-2-delia-en", - "aura-2-draco-en", - "aura-2-electra-en", - "aura-2-harmonia-en", - "aura-2-helena-en", - "aura-2-hera-en", - "aura-2-hermes-en", - "aura-2-hyperion-en", - "aura-2-iris-en", - "aura-2-janus-en", - "aura-2-juno-en", - "aura-2-jupiter-en", - "aura-2-luna-en", - "aura-2-mars-en", - "aura-2-minerva-en", - "aura-2-neptune-en", - "aura-2-odysseus-en", - "aura-2-ophelia-en", - "aura-2-orion-en", - "aura-2-orpheus-en", - "aura-2-pandora-en", - "aura-2-phoebe-en", - "aura-2-pluto-en", - "aura-2-saturn-en", - "aura-2-selene-en", - "aura-2-thalia-en", - "aura-2-theia-en", - "aura-2-vesta-en", - "aura-2-zeus-en", - "aura-2-sirio-es", - "aura-2-nestor-es", - "aura-2-carina-es", - "aura-2-celeste-es", - "aura-2-alvaro-es", - "aura-2-diana-es", - "aura-2-aquila-es", - "aura-2-selena-es", - "aura-2-estrella-es", - "aura-2-javier-es", - ], - typing.Any, -] diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_eleven_labs.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_eleven_labs.py deleted file mode 100644 index 91f1edeb..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_eleven_labs.py +++ /dev/null @@ -1,38 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1update_speak_speak_provider_eleven_labs_model_id import AgentV1UpdateSpeakSpeakProviderElevenLabsModelId - - -class AgentV1UpdateSpeakSpeakProviderElevenLabs(UniversalBaseModel): - version: typing.Optional[typing.Literal["v1"]] = pydantic.Field(default=None) - """ - The REST API version for the ElevenLabs text-to-speech API - """ - - model_id: AgentV1UpdateSpeakSpeakProviderElevenLabsModelId = pydantic.Field() - """ - Eleven Labs model ID - """ - - language: typing.Optional[str] = pydantic.Field(default=None) - """ - Language code to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the ElevenLabs API - """ - - language_code: typing.Optional[str] = pydantic.Field(default=None) - """ - Use the `language` field instead. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_eleven_labs_model_id.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_eleven_labs_model_id.py deleted file mode 100644 index fdbba96c..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_eleven_labs_model_id.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1UpdateSpeakSpeakProviderElevenLabsModelId = typing.Union[ - typing.Literal["eleven_turbo_v2_5", "eleven_monolingual_v1", "eleven_multilingual_v2"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_open_ai.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_open_ai.py deleted file mode 100644 index c05301fa..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_open_ai.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1update_speak_speak_provider_open_ai_model import AgentV1UpdateSpeakSpeakProviderOpenAiModel -from .agent_v1update_speak_speak_provider_open_ai_voice import AgentV1UpdateSpeakSpeakProviderOpenAiVoice - - -class AgentV1UpdateSpeakSpeakProviderOpenAi(UniversalBaseModel): - version: typing.Optional[typing.Literal["v1"]] = pydantic.Field(default=None) - """ - The REST API version for the OpenAI text-to-speech API - """ - - model: AgentV1UpdateSpeakSpeakProviderOpenAiModel = pydantic.Field() - """ - OpenAI TTS model - """ - - voice: AgentV1UpdateSpeakSpeakProviderOpenAiVoice = pydantic.Field() - """ - OpenAI voice - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_open_ai_model.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_open_ai_model.py deleted file mode 100644 index 94c2069a..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_open_ai_model.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1UpdateSpeakSpeakProviderOpenAiModel = typing.Union[typing.Literal["tts-1", "tts-1-hd"], typing.Any] diff --git a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_open_ai_voice.py b/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_open_ai_voice.py deleted file mode 100644 index bc5fdeb9..00000000 --- a/src/deepgram/agent/v1/types/agent_v1update_speak_speak_provider_open_ai_voice.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -AgentV1UpdateSpeakSpeakProviderOpenAiVoice = typing.Union[ - typing.Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"], typing.Any -] diff --git a/src/deepgram/agent/v1/types/agent_v1user_started_speaking.py b/src/deepgram/agent/v1/types/agent_v1user_started_speaking.py deleted file mode 100644 index ac4d838a..00000000 --- a/src/deepgram/agent/v1/types/agent_v1user_started_speaking.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1UserStartedSpeaking(UniversalBaseModel): - type: typing.Literal["UserStartedSpeaking"] = pydantic.Field(default="UserStartedSpeaking") - """ - Message type identifier indicating that the user has begun speaking - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1warning.py b/src/deepgram/agent/v1/types/agent_v1warning.py deleted file mode 100644 index cdfacea7..00000000 --- a/src/deepgram/agent/v1/types/agent_v1warning.py +++ /dev/null @@ -1,36 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1Warning(UniversalBaseModel): - """ - Notifies the client of non-fatal errors or warnings - """ - - type: typing.Literal["Warning"] = pydantic.Field(default="Warning") - """ - Message type identifier for warnings - """ - - description: str = pydantic.Field() - """ - Description of the warning - """ - - code: str = pydantic.Field() - """ - Warning code identifier - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/agent_v1welcome.py b/src/deepgram/agent/v1/types/agent_v1welcome.py deleted file mode 100644 index 972f8104..00000000 --- a/src/deepgram/agent/v1/types/agent_v1welcome.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class AgentV1Welcome(UniversalBaseModel): - type: typing.Literal["Welcome"] = pydantic.Field(default="Welcome") - """ - Message type identifier for welcome message - """ - - request_id: str = pydantic.Field() - """ - Unique identifier for the request - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/anthropic.py b/src/deepgram/agent/v1/types/anthropic.py deleted file mode 100644 index ba7cf771..00000000 --- a/src/deepgram/agent/v1/types/anthropic.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_think_provider_anthropic_model import AgentV1SettingsAgentThinkProviderAnthropicModel - - -class Anthropic(UniversalBaseModel): - version: typing.Optional[typing.Literal["v1"]] = pydantic.Field(default=None) - """ - The REST API version for the Anthropic Messages API - """ - - model: AgentV1SettingsAgentThinkProviderAnthropicModel = pydantic.Field() - """ - Anthropic model to use - """ - - temperature: typing.Optional[float] = pydantic.Field(default=None) - """ - Anthropic temperature (0-1) - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/cartesia.py b/src/deepgram/agent/v1/types/cartesia.py deleted file mode 100644 index 6511e77d..00000000 --- a/src/deepgram/agent/v1/types/cartesia.py +++ /dev/null @@ -1,39 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_one_item_provider_cartesia_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId, -) -from .agent_v1settings_agent_speak_one_item_provider_cartesia_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice, -) - - -class Cartesia(UniversalBaseModel): - version: typing.Optional[typing.Literal["2025-03-17"]] = pydantic.Field(default=None) - """ - The API version header for the Cartesia text-to-speech API - """ - - model_id: AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId = pydantic.Field() - """ - Cartesia model ID - """ - - voice: AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice - language: typing.Optional[str] = pydantic.Field(default=None) - """ - Cartesia language code - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/deepgram.py b/src/deepgram/agent/v1/types/deepgram.py deleted file mode 100644 index c259f057..00000000 --- a/src/deepgram/agent/v1/types/deepgram.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_one_item_provider_deepgram_model import ( - AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel, -) - - -class Deepgram(UniversalBaseModel): - version: typing.Optional[typing.Literal["v1"]] = pydantic.Field(default=None) - """ - The REST API version for the Deepgram text-to-speech API - """ - - model: AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel = pydantic.Field() - """ - Deepgram TTS model - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/eleven_labs.py b/src/deepgram/agent/v1/types/eleven_labs.py deleted file mode 100644 index 9c10bed4..00000000 --- a/src/deepgram/agent/v1/types/eleven_labs.py +++ /dev/null @@ -1,40 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_one_item_provider_eleven_labs_model_id import ( - AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId, -) - - -class ElevenLabs(UniversalBaseModel): - version: typing.Optional[typing.Literal["v1"]] = pydantic.Field(default=None) - """ - The REST API version for the Deepgram text-to-speech API - """ - - model_id: AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId = pydantic.Field() - """ - Eleven Labs model ID - """ - - language: typing.Optional[str] = pydantic.Field(default=None) - """ - Optional language to use, e.g. 'en-US'. Corresponds to the `language_code` parameter in the ElevenLabs API - """ - - language_code: typing.Optional[str] = pydantic.Field(default=None) - """ - Use the `language` field instead. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/google.py b/src/deepgram/agent/v1/types/google.py deleted file mode 100644 index 0c1e7a05..00000000 --- a/src/deepgram/agent/v1/types/google.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_think_provider_google_model import AgentV1SettingsAgentThinkProviderGoogleModel - - -class Google(UniversalBaseModel): - version: typing.Optional[typing.Literal["v1beta"]] = pydantic.Field(default=None) - """ - The REST API version for the Google generative language API - """ - - model: AgentV1SettingsAgentThinkProviderGoogleModel = pydantic.Field() - """ - Google model to use - """ - - temperature: typing.Optional[float] = pydantic.Field(default=None) - """ - Google temperature (0-2) - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/groq.py b/src/deepgram/agent/v1/types/groq.py deleted file mode 100644 index 34ba97dd..00000000 --- a/src/deepgram/agent/v1/types/groq.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class Groq(UniversalBaseModel): - version: typing.Optional[typing.Literal["v1"]] = pydantic.Field(default=None) - """ - The REST API version for the Groq's chat completions API (mostly OpenAI-compatible) - """ - - model: typing.Literal["openai/gpt-oss-20b"] = pydantic.Field(default="openai/gpt-oss-20b") - """ - Groq model to use - """ - - temperature: typing.Optional[float] = pydantic.Field(default=None) - """ - Groq temperature (0-2) - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/agent/v1/types/open_ai.py b/src/deepgram/agent/v1/types/open_ai.py deleted file mode 100644 index 5837c0cc..00000000 --- a/src/deepgram/agent/v1/types/open_ai.py +++ /dev/null @@ -1,38 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .agent_v1settings_agent_speak_one_item_provider_open_ai_model import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel, -) -from .agent_v1settings_agent_speak_one_item_provider_open_ai_voice import ( - AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice, -) - - -class OpenAi(UniversalBaseModel): - version: typing.Optional[typing.Literal["v1"]] = pydantic.Field(default=None) - """ - The REST API version for the OpenAI text-to-speech API - """ - - model: AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel = pydantic.Field() - """ - OpenAI TTS model - """ - - voice: AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice = pydantic.Field() - """ - OpenAI voice - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/auth/client.py b/src/deepgram/auth/client.py index 16bb2f0b..8398ddf4 100644 --- a/src/deepgram/auth/client.py +++ b/src/deepgram/auth/client.py @@ -5,7 +5,6 @@ import typing from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawAuthClient, RawAuthClient if typing.TYPE_CHECKING: from .v1.client import AsyncV1Client, V1Client @@ -13,21 +12,9 @@ class AuthClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawAuthClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[V1Client] = None - @property - def with_raw_response(self) -> RawAuthClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawAuthClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: @@ -39,21 +26,9 @@ def v1(self): class AsyncAuthClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawAuthClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[AsyncV1Client] = None - @property - def with_raw_response(self) -> AsyncRawAuthClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawAuthClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: diff --git a/src/deepgram/auth/raw_client.py b/src/deepgram/auth/raw_client.py deleted file mode 100644 index 69030705..00000000 --- a/src/deepgram/auth/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawAuthClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawAuthClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/auth/v1/client.py b/src/deepgram/auth/v1/client.py index 563a0d0b..cf3c1acd 100644 --- a/src/deepgram/auth/v1/client.py +++ b/src/deepgram/auth/v1/client.py @@ -5,7 +5,6 @@ import typing from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawV1Client, RawV1Client if typing.TYPE_CHECKING: from .tokens.client import AsyncTokensClient, TokensClient @@ -13,21 +12,9 @@ class V1Client: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._tokens: typing.Optional[TokensClient] = None - @property - def with_raw_response(self) -> RawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawV1Client - """ - return self._raw_client - @property def tokens(self): if self._tokens is None: @@ -39,21 +26,9 @@ def tokens(self): class AsyncV1Client: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._tokens: typing.Optional[AsyncTokensClient] = None - @property - def with_raw_response(self) -> AsyncRawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawV1Client - """ - return self._raw_client - @property def tokens(self): if self._tokens is None: diff --git a/src/deepgram/auth/v1/raw_client.py b/src/deepgram/auth/v1/raw_client.py deleted file mode 100644 index 82da8718..00000000 --- a/src/deepgram/auth/v1/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawV1Client: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawV1Client: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/auth/v1/tokens/raw_client.py b/src/deepgram/auth/v1/tokens/raw_client.py index b8d45f79..634d5fd6 100644 --- a/src/deepgram/auth/v1/tokens/raw_client.py +++ b/src/deepgram/auth/v1/tokens/raw_client.py @@ -40,7 +40,6 @@ def grant( """ _response = self._client_wrapper.httpx_client.request( "v1/auth/grant", - base_url=self._client_wrapper.get_environment().base, method="POST", json={ "ttl_seconds": ttl_seconds, @@ -103,7 +102,6 @@ async def grant( """ _response = await self._client_wrapper.httpx_client.request( "v1/auth/grant", - base_url=self._client_wrapper.get_environment().base, method="POST", json={ "ttl_seconds": ttl_seconds, diff --git a/src/deepgram/base_client.py b/src/deepgram/base_client.py index 34261bc6..bccc83c8 100644 --- a/src/deepgram/base_client.py +++ b/src/deepgram/base_client.py @@ -26,6 +26,9 @@ class BaseClient: Parameters ---------- + base_url : typing.Optional[str] + The base url to use for requests from the client. + environment : DeepgramClientEnvironment The environment to use for requests from the client. from .environment import DeepgramClientEnvironment @@ -60,6 +63,7 @@ class BaseClient: def __init__( self, *, + base_url: typing.Optional[str] = None, environment: DeepgramClientEnvironment = DeepgramClientEnvironment.PRODUCTION, api_key: typing.Optional[str] = os.getenv("DEEPGRAM_API_KEY"), headers: typing.Optional[typing.Dict[str, str]] = None, @@ -75,7 +79,7 @@ def __init__( body="The client must be instantiated be either passing in api_key or setting DEEPGRAM_API_KEY" ) self._client_wrapper = SyncClientWrapper( - environment=environment, + base_url=_get_base_url(base_url=base_url, environment=environment), api_key=api_key, headers=headers, httpx_client=httpx_client @@ -156,6 +160,9 @@ class AsyncBaseClient: Parameters ---------- + base_url : typing.Optional[str] + The base url to use for requests from the client. + environment : DeepgramClientEnvironment The environment to use for requests from the client. from .environment import DeepgramClientEnvironment @@ -190,6 +197,7 @@ class AsyncBaseClient: def __init__( self, *, + base_url: typing.Optional[str] = None, environment: DeepgramClientEnvironment = DeepgramClientEnvironment.PRODUCTION, api_key: typing.Optional[str] = os.getenv("DEEPGRAM_API_KEY"), headers: typing.Optional[typing.Dict[str, str]] = None, @@ -205,7 +213,7 @@ def __init__( body="The client must be instantiated be either passing in api_key or setting DEEPGRAM_API_KEY" ) self._client_wrapper = AsyncClientWrapper( - environment=environment, + base_url=_get_base_url(base_url=base_url, environment=environment), api_key=api_key, headers=headers, httpx_client=httpx_client @@ -278,3 +286,12 @@ def speak(self): self._speak = AsyncSpeakClient(client_wrapper=self._client_wrapper) return self._speak + + +def _get_base_url(*, base_url: typing.Optional[str] = None, environment: DeepgramClientEnvironment) -> str: + if base_url is not None: + return base_url + elif environment is not None: + return environment.value + else: + raise Exception("Please pass in either base_url or environment to construct the client") diff --git a/src/deepgram/core/client_wrapper.py b/src/deepgram/core/client_wrapper.py index bafd1b0e..c0bc4101 100644 --- a/src/deepgram/core/client_wrapper.py +++ b/src/deepgram/core/client_wrapper.py @@ -3,7 +3,6 @@ import typing import httpx -from ..environment import DeepgramClientEnvironment from .http_client import AsyncHttpClient, HttpClient @@ -13,20 +12,24 @@ def __init__( *, api_key: str, headers: typing.Optional[typing.Dict[str, str]] = None, - environment: DeepgramClientEnvironment, + base_url: str, timeout: typing.Optional[float] = None, ): self.api_key = api_key self._headers = headers - self._environment = environment + self._base_url = base_url self._timeout = timeout def get_headers(self) -> typing.Dict[str, str]: + import platform + headers: typing.Dict[str, str] = { - "User-Agent": "deepgram-sdk/6.0.0-beta.3", + "User-Agent": "deepgram-sdk/5.3.2", "X-Fern-Language": "Python", + "X-Fern-Runtime": f"python/{platform.python_version()}", + "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", "X-Fern-SDK-Name": "deepgram-sdk", - "X-Fern-SDK-Version": "6.0.0-beta.3", + "X-Fern-SDK-Version": "5.3.2", **(self.get_custom_headers() or {}), } headers["Authorization"] = f"Token {self.api_key}" @@ -35,8 +38,8 @@ def get_headers(self) -> typing.Dict[str, str]: def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]: return self._headers - def get_environment(self) -> DeepgramClientEnvironment: - return self._environment + def get_base_url(self) -> str: + return self._base_url def get_timeout(self) -> typing.Optional[float]: return self._timeout @@ -48,13 +51,16 @@ def __init__( *, api_key: str, headers: typing.Optional[typing.Dict[str, str]] = None, - environment: DeepgramClientEnvironment, + base_url: str, timeout: typing.Optional[float] = None, httpx_client: httpx.Client, ): - super().__init__(api_key=api_key, headers=headers, environment=environment, timeout=timeout) + super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout) self.httpx_client = HttpClient( - httpx_client=httpx_client, base_headers=self.get_headers, base_timeout=self.get_timeout + httpx_client=httpx_client, + base_headers=self.get_headers, + base_timeout=self.get_timeout, + base_url=self.get_base_url, ) @@ -64,17 +70,18 @@ def __init__( *, api_key: str, headers: typing.Optional[typing.Dict[str, str]] = None, - environment: DeepgramClientEnvironment, + base_url: str, timeout: typing.Optional[float] = None, async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None, httpx_client: httpx.AsyncClient, ): - super().__init__(api_key=api_key, headers=headers, environment=environment, timeout=timeout) + super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout) self._async_token = async_token self.httpx_client = AsyncHttpClient( httpx_client=httpx_client, base_headers=self.get_headers, base_timeout=self.get_timeout, + base_url=self.get_base_url, async_base_headers=self.async_get_headers, ) diff --git a/src/deepgram/core/pydantic_utilities.py b/src/deepgram/core/pydantic_utilities.py index 12dc057b..789081b0 100644 --- a/src/deepgram/core/pydantic_utilities.py +++ b/src/deepgram/core/pydantic_utilities.py @@ -3,10 +3,34 @@ # nopycln: file import datetime as dt import inspect +import json +import logging from collections import defaultdict -from typing import Any, Callable, ClassVar, Dict, List, Mapping, Optional, Set, Tuple, Type, TypeVar, Union, cast +from dataclasses import asdict +from typing import ( + TYPE_CHECKING, + Any, + Callable, + ClassVar, + Dict, + List, + Mapping, + Optional, + Set, + Tuple, + Type, + TypeVar, + Union, + cast, +) import pydantic +import typing_extensions + +_logger = logging.getLogger(__name__) + +if TYPE_CHECKING: + from .http_sse._models import ServerSentEvent IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.") @@ -37,6 +61,181 @@ Model = TypeVar("Model", bound=pydantic.BaseModel) +def _get_discriminator_and_variants(type_: Type[Any]) -> Tuple[Optional[str], Optional[List[Type[Any]]]]: + """ + Extract the discriminator field name and union variants from a discriminated union type. + Supports Annotated[Union[...], Field(discriminator=...)] patterns. + Returns (discriminator, variants) or (None, None) if not a discriminated union. + """ + origin = typing_extensions.get_origin(type_) + + if origin is typing_extensions.Annotated: + args = typing_extensions.get_args(type_) + if len(args) >= 2: + inner_type = args[0] + # Check annotations for discriminator + discriminator = None + for annotation in args[1:]: + if hasattr(annotation, "discriminator"): + discriminator = getattr(annotation, "discriminator", None) + break + + if discriminator: + inner_origin = typing_extensions.get_origin(inner_type) + if inner_origin is Union: + variants = list(typing_extensions.get_args(inner_type)) + return discriminator, variants + return None, None + + +def _get_field_annotation(model: Type[Any], field_name: str) -> Optional[Type[Any]]: + """Get the type annotation of a field from a Pydantic model.""" + if IS_PYDANTIC_V2: + fields = getattr(model, "model_fields", {}) + field_info = fields.get(field_name) + if field_info: + return cast(Optional[Type[Any]], field_info.annotation) + else: + fields = getattr(model, "__fields__", {}) + field_info = fields.get(field_name) + if field_info: + return cast(Optional[Type[Any]], field_info.outer_type_) + return None + + +def _find_variant_by_discriminator( + variants: List[Type[Any]], + discriminator: str, + discriminator_value: Any, +) -> Optional[Type[Any]]: + """Find the union variant that matches the discriminator value.""" + for variant in variants: + if not (inspect.isclass(variant) and issubclass(variant, pydantic.BaseModel)): + continue + + disc_annotation = _get_field_annotation(variant, discriminator) + if disc_annotation and is_literal_type(disc_annotation): + literal_args = get_args(disc_annotation) + if literal_args and literal_args[0] == discriminator_value: + return variant + return None + + +def _is_string_type(type_: Type[Any]) -> bool: + """Check if a type is str or Optional[str].""" + if type_ is str: + return True + + origin = typing_extensions.get_origin(type_) + if origin is Union: + args = typing_extensions.get_args(type_) + # Optional[str] = Union[str, None] + non_none_args = [a for a in args if a is not type(None)] + if len(non_none_args) == 1 and non_none_args[0] is str: + return True + + return False + + +def parse_sse_obj(sse: "ServerSentEvent", type_: Type[T]) -> T: + """ + Parse a ServerSentEvent into the appropriate type. + + Handles two scenarios based on where the discriminator field is located: + + 1. Data-level discrimination: The discriminator (e.g., 'type') is inside the 'data' payload. + The union describes the data content, not the SSE envelope. + -> Returns: json.loads(data) parsed into the type + + Example: ChatStreamResponse with discriminator='type' + Input: ServerSentEvent(event="message", data='{"type": "content-delta", ...}', id="") + Output: ContentDeltaEvent (parsed from data, SSE envelope stripped) + + 2. Event-level discrimination: The discriminator (e.g., 'event') is at the SSE event level. + The union describes the full SSE event structure. + -> Returns: SSE envelope with 'data' field JSON-parsed only if the variant expects non-string + + Example: JobStreamResponse with discriminator='event' + Input: ServerSentEvent(event="ERROR", data='{"code": "FAILED", ...}', id="123") + Output: JobStreamResponse_Error with data as ErrorData object + + But for variants where data is str (like STATUS_UPDATE): + Input: ServerSentEvent(event="STATUS_UPDATE", data='{"status": "processing"}', id="1") + Output: JobStreamResponse_StatusUpdate with data as string (not parsed) + + Args: + sse: The ServerSentEvent object to parse + type_: The target discriminated union type + + Returns: + The parsed object of type T + + Note: + This function is only available in SDK contexts where http_sse module exists. + """ + sse_event = asdict(sse) + discriminator, variants = _get_discriminator_and_variants(type_) + + if discriminator is None or variants is None: + # Not a discriminated union - parse the data field as JSON + data_value = sse_event.get("data") + if isinstance(data_value, str) and data_value: + try: + parsed_data = json.loads(data_value) + return parse_obj_as(type_, parsed_data) + except json.JSONDecodeError as e: + _logger.warning( + "Failed to parse SSE data field as JSON: %s, data: %s", + e, + data_value[:100] if len(data_value) > 100 else data_value, + ) + return parse_obj_as(type_, sse_event) + + data_value = sse_event.get("data") + + # Check if discriminator is at the top level (event-level discrimination) + if discriminator in sse_event: + # Case 2: Event-level discrimination + # Find the matching variant to check if 'data' field needs JSON parsing + disc_value = sse_event.get(discriminator) + matching_variant = _find_variant_by_discriminator(variants, discriminator, disc_value) + + if matching_variant is not None: + # Check what type the variant expects for 'data' + data_type = _get_field_annotation(matching_variant, "data") + if data_type is not None and not _is_string_type(data_type): + # Variant expects non-string data - parse JSON + if isinstance(data_value, str) and data_value: + try: + parsed_data = json.loads(data_value) + new_object = dict(sse_event) + new_object["data"] = parsed_data + return parse_obj_as(type_, new_object) + except json.JSONDecodeError as e: + _logger.warning( + "Failed to parse SSE data field as JSON for event-level discrimination: %s, data: %s", + e, + data_value[:100] if len(data_value) > 100 else data_value, + ) + # Either no matching variant, data is string type, or JSON parse failed + return parse_obj_as(type_, sse_event) + + else: + # Case 1: Data-level discrimination + # The discriminator is inside the data payload - extract and parse data only + if isinstance(data_value, str) and data_value: + try: + parsed_data = json.loads(data_value) + return parse_obj_as(type_, parsed_data) + except json.JSONDecodeError as e: + _logger.warning( + "Failed to parse SSE data field as JSON for data-level discrimination: %s, data: %s", + e, + data_value[:100] if len(data_value) > 100 else data_value, + ) + return parse_obj_as(type_, sse_event) + + def parse_obj_as(type_: Type[T], object_: Any) -> T: # convert_and_respect_annotation_metadata is required for TypedDict aliasing. # diff --git a/src/deepgram/environment.py b/src/deepgram/environment.py index 240d7ca4..2bcf431b 100644 --- a/src/deepgram/environment.py +++ b/src/deepgram/environment.py @@ -1,21 +1,8 @@ # This file was auto-generated by Fern from our API Definition. -from __future__ import annotations +import enum -class DeepgramClientEnvironment: - PRODUCTION: DeepgramClientEnvironment - AGENT: DeepgramClientEnvironment - - def __init__(self, *, base: str, production: str, agent: str): - self.base = base - self.production = production - self.agent = agent - - -DeepgramClientEnvironment.PRODUCTION = DeepgramClientEnvironment( - base="https://api.deepgram.com", production="wss://api.deepgram.com", agent="wss://agent.deepgram.com" -) -DeepgramClientEnvironment.AGENT = DeepgramClientEnvironment( - base="https://agent.deepgram.com", production="wss://api.deepgram.com", agent="wss://agent.deepgram.com" -) +class DeepgramClientEnvironment(enum.Enum): + PRODUCTION = "https://api.deepgram.com" + AGENT = "https://agent.deepgram.com" diff --git a/src/deepgram/listen/__init__.py b/src/deepgram/listen/__init__.py index 42a8267f..148ad154 100644 --- a/src/deepgram/listen/__init__.py +++ b/src/deepgram/listen/__init__.py @@ -6,97 +6,8 @@ from importlib import import_module if typing.TYPE_CHECKING: - from . import v1, v2 - from .v1 import ( - ListenV1CloseStream, - ListenV1CloseStreamParams, - ListenV1CloseStreamType, - ListenV1Finalize, - ListenV1FinalizeParams, - ListenV1FinalizeType, - ListenV1KeepAlive, - ListenV1KeepAliveParams, - ListenV1KeepAliveType, - ListenV1Metadata, - ListenV1MetadataParams, - ListenV1Results, - ListenV1ResultsChannel, - ListenV1ResultsChannelAlternativesItem, - ListenV1ResultsChannelAlternativesItemParams, - ListenV1ResultsChannelAlternativesItemWordsItem, - ListenV1ResultsChannelAlternativesItemWordsItemParams, - ListenV1ResultsChannelParams, - ListenV1ResultsEntitiesItem, - ListenV1ResultsEntitiesItemParams, - ListenV1ResultsMetadata, - ListenV1ResultsMetadataModelInfo, - ListenV1ResultsMetadataModelInfoParams, - ListenV1ResultsMetadataParams, - ListenV1ResultsParams, - ListenV1SpeechStarted, - ListenV1SpeechStartedParams, - ListenV1UtteranceEnd, - ListenV1UtteranceEndParams, - ) - from .v2 import ( - ListenV2CloseStream, - ListenV2CloseStreamParams, - ListenV2CloseStreamType, - ListenV2Connected, - ListenV2ConnectedParams, - ListenV2FatalError, - ListenV2FatalErrorParams, - ListenV2TurnInfo, - ListenV2TurnInfoEvent, - ListenV2TurnInfoParams, - ListenV2TurnInfoWordsItem, - ListenV2TurnInfoWordsItemParams, - ) -_dynamic_imports: typing.Dict[str, str] = { - "ListenV1CloseStream": ".v1", - "ListenV1CloseStreamParams": ".v1", - "ListenV1CloseStreamType": ".v1", - "ListenV1Finalize": ".v1", - "ListenV1FinalizeParams": ".v1", - "ListenV1FinalizeType": ".v1", - "ListenV1KeepAlive": ".v1", - "ListenV1KeepAliveParams": ".v1", - "ListenV1KeepAliveType": ".v1", - "ListenV1Metadata": ".v1", - "ListenV1MetadataParams": ".v1", - "ListenV1Results": ".v1", - "ListenV1ResultsChannel": ".v1", - "ListenV1ResultsChannelAlternativesItem": ".v1", - "ListenV1ResultsChannelAlternativesItemParams": ".v1", - "ListenV1ResultsChannelAlternativesItemWordsItem": ".v1", - "ListenV1ResultsChannelAlternativesItemWordsItemParams": ".v1", - "ListenV1ResultsChannelParams": ".v1", - "ListenV1ResultsEntitiesItem": ".v1", - "ListenV1ResultsEntitiesItemParams": ".v1", - "ListenV1ResultsMetadata": ".v1", - "ListenV1ResultsMetadataModelInfo": ".v1", - "ListenV1ResultsMetadataModelInfoParams": ".v1", - "ListenV1ResultsMetadataParams": ".v1", - "ListenV1ResultsParams": ".v1", - "ListenV1SpeechStarted": ".v1", - "ListenV1SpeechStartedParams": ".v1", - "ListenV1UtteranceEnd": ".v1", - "ListenV1UtteranceEndParams": ".v1", - "ListenV2CloseStream": ".v2", - "ListenV2CloseStreamParams": ".v2", - "ListenV2CloseStreamType": ".v2", - "ListenV2Connected": ".v2", - "ListenV2ConnectedParams": ".v2", - "ListenV2FatalError": ".v2", - "ListenV2FatalErrorParams": ".v2", - "ListenV2TurnInfo": ".v2", - "ListenV2TurnInfoEvent": ".v2", - "ListenV2TurnInfoParams": ".v2", - "ListenV2TurnInfoWordsItem": ".v2", - "ListenV2TurnInfoWordsItemParams": ".v2", - "v1": ".v1", - "v2": ".v2", -} + from . import v1 +_dynamic_imports: typing.Dict[str, str] = {"v1": ".v1"} def __getattr__(attr_name: str) -> typing.Any: @@ -120,48 +31,4 @@ def __dir__(): return sorted(lazy_attrs) -__all__ = [ - "ListenV1CloseStream", - "ListenV1CloseStreamParams", - "ListenV1CloseStreamType", - "ListenV1Finalize", - "ListenV1FinalizeParams", - "ListenV1FinalizeType", - "ListenV1KeepAlive", - "ListenV1KeepAliveParams", - "ListenV1KeepAliveType", - "ListenV1Metadata", - "ListenV1MetadataParams", - "ListenV1Results", - "ListenV1ResultsChannel", - "ListenV1ResultsChannelAlternativesItem", - "ListenV1ResultsChannelAlternativesItemParams", - "ListenV1ResultsChannelAlternativesItemWordsItem", - "ListenV1ResultsChannelAlternativesItemWordsItemParams", - "ListenV1ResultsChannelParams", - "ListenV1ResultsEntitiesItem", - "ListenV1ResultsEntitiesItemParams", - "ListenV1ResultsMetadata", - "ListenV1ResultsMetadataModelInfo", - "ListenV1ResultsMetadataModelInfoParams", - "ListenV1ResultsMetadataParams", - "ListenV1ResultsParams", - "ListenV1SpeechStarted", - "ListenV1SpeechStartedParams", - "ListenV1UtteranceEnd", - "ListenV1UtteranceEndParams", - "ListenV2CloseStream", - "ListenV2CloseStreamParams", - "ListenV2CloseStreamType", - "ListenV2Connected", - "ListenV2ConnectedParams", - "ListenV2FatalError", - "ListenV2FatalErrorParams", - "ListenV2TurnInfo", - "ListenV2TurnInfoEvent", - "ListenV2TurnInfoParams", - "ListenV2TurnInfoWordsItem", - "ListenV2TurnInfoWordsItemParams", - "v1", - "v2", -] +__all__ = ["v1"] diff --git a/src/deepgram/listen/client.py b/src/deepgram/listen/client.py index ce389108..fb835380 100644 --- a/src/deepgram/listen/client.py +++ b/src/deepgram/listen/client.py @@ -5,30 +5,15 @@ import typing from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawListenClient, RawListenClient if typing.TYPE_CHECKING: from .v1.client import AsyncV1Client, V1Client - from .v2.client import AsyncV2Client, V2Client class ListenClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawListenClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[V1Client] = None - self._v2: typing.Optional[V2Client] = None - - @property - def with_raw_response(self) -> RawListenClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawListenClient - """ - return self._raw_client @property def v1(self): @@ -38,32 +23,11 @@ def v1(self): self._v1 = V1Client(client_wrapper=self._client_wrapper) return self._v1 - @property - def v2(self): - if self._v2 is None: - from .v2.client import V2Client # noqa: E402 - - self._v2 = V2Client(client_wrapper=self._client_wrapper) - return self._v2 - class AsyncListenClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawListenClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[AsyncV1Client] = None - self._v2: typing.Optional[AsyncV2Client] = None - - @property - def with_raw_response(self) -> AsyncRawListenClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawListenClient - """ - return self._raw_client @property def v1(self): @@ -72,11 +36,3 @@ def v1(self): self._v1 = AsyncV1Client(client_wrapper=self._client_wrapper) return self._v1 - - @property - def v2(self): - if self._v2 is None: - from .v2.client import AsyncV2Client # noqa: E402 - - self._v2 = AsyncV2Client(client_wrapper=self._client_wrapper) - return self._v2 diff --git a/src/deepgram/listen/raw_client.py b/src/deepgram/listen/raw_client.py deleted file mode 100644 index f5712d87..00000000 --- a/src/deepgram/listen/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawListenClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawListenClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/listen/v1/__init__.py b/src/deepgram/listen/v1/__init__.py index 8b43c4ff..a3dcf43f 100644 --- a/src/deepgram/listen/v1/__init__.py +++ b/src/deepgram/listen/v1/__init__.py @@ -6,24 +6,6 @@ from importlib import import_module if typing.TYPE_CHECKING: - from .types import ( - ListenV1CloseStream, - ListenV1CloseStreamType, - ListenV1Finalize, - ListenV1FinalizeType, - ListenV1KeepAlive, - ListenV1KeepAliveType, - ListenV1Metadata, - ListenV1Results, - ListenV1ResultsChannel, - ListenV1ResultsChannelAlternativesItem, - ListenV1ResultsChannelAlternativesItemWordsItem, - ListenV1ResultsEntitiesItem, - ListenV1ResultsMetadata, - ListenV1ResultsMetadataModelInfo, - ListenV1SpeechStarted, - ListenV1UtteranceEnd, - ) from . import media from .media import ( MediaTranscribeRequestCallbackMethod, @@ -36,51 +18,7 @@ MediaTranscribeResponse, MediaTranscribeResponseParams, ) - from .requests import ( - ListenV1CloseStreamParams, - ListenV1FinalizeParams, - ListenV1KeepAliveParams, - ListenV1MetadataParams, - ListenV1ResultsChannelAlternativesItemParams, - ListenV1ResultsChannelAlternativesItemWordsItemParams, - ListenV1ResultsChannelParams, - ListenV1ResultsEntitiesItemParams, - ListenV1ResultsMetadataModelInfoParams, - ListenV1ResultsMetadataParams, - ListenV1ResultsParams, - ListenV1SpeechStartedParams, - ListenV1UtteranceEndParams, - ) _dynamic_imports: typing.Dict[str, str] = { - "ListenV1CloseStream": ".types", - "ListenV1CloseStreamParams": ".requests", - "ListenV1CloseStreamType": ".types", - "ListenV1Finalize": ".types", - "ListenV1FinalizeParams": ".requests", - "ListenV1FinalizeType": ".types", - "ListenV1KeepAlive": ".types", - "ListenV1KeepAliveParams": ".requests", - "ListenV1KeepAliveType": ".types", - "ListenV1Metadata": ".types", - "ListenV1MetadataParams": ".requests", - "ListenV1Results": ".types", - "ListenV1ResultsChannel": ".types", - "ListenV1ResultsChannelAlternativesItem": ".types", - "ListenV1ResultsChannelAlternativesItemParams": ".requests", - "ListenV1ResultsChannelAlternativesItemWordsItem": ".types", - "ListenV1ResultsChannelAlternativesItemWordsItemParams": ".requests", - "ListenV1ResultsChannelParams": ".requests", - "ListenV1ResultsEntitiesItem": ".types", - "ListenV1ResultsEntitiesItemParams": ".requests", - "ListenV1ResultsMetadata": ".types", - "ListenV1ResultsMetadataModelInfo": ".types", - "ListenV1ResultsMetadataModelInfoParams": ".requests", - "ListenV1ResultsMetadataParams": ".requests", - "ListenV1ResultsParams": ".requests", - "ListenV1SpeechStarted": ".types", - "ListenV1SpeechStartedParams": ".requests", - "ListenV1UtteranceEnd": ".types", - "ListenV1UtteranceEndParams": ".requests", "MediaTranscribeRequestCallbackMethod": ".media", "MediaTranscribeRequestCustomIntentMode": ".media", "MediaTranscribeRequestCustomTopicMode": ".media", @@ -116,35 +54,6 @@ def __dir__(): __all__ = [ - "ListenV1CloseStream", - "ListenV1CloseStreamParams", - "ListenV1CloseStreamType", - "ListenV1Finalize", - "ListenV1FinalizeParams", - "ListenV1FinalizeType", - "ListenV1KeepAlive", - "ListenV1KeepAliveParams", - "ListenV1KeepAliveType", - "ListenV1Metadata", - "ListenV1MetadataParams", - "ListenV1Results", - "ListenV1ResultsChannel", - "ListenV1ResultsChannelAlternativesItem", - "ListenV1ResultsChannelAlternativesItemParams", - "ListenV1ResultsChannelAlternativesItemWordsItem", - "ListenV1ResultsChannelAlternativesItemWordsItemParams", - "ListenV1ResultsChannelParams", - "ListenV1ResultsEntitiesItem", - "ListenV1ResultsEntitiesItemParams", - "ListenV1ResultsMetadata", - "ListenV1ResultsMetadataModelInfo", - "ListenV1ResultsMetadataModelInfoParams", - "ListenV1ResultsMetadataParams", - "ListenV1ResultsParams", - "ListenV1SpeechStarted", - "ListenV1SpeechStartedParams", - "ListenV1UtteranceEnd", - "ListenV1UtteranceEndParams", "MediaTranscribeRequestCallbackMethod", "MediaTranscribeRequestCustomIntentMode", "MediaTranscribeRequestCustomTopicMode", diff --git a/src/deepgram/listen/v1/client.py b/src/deepgram/listen/v1/client.py index f9aea635..efb93c41 100644 --- a/src/deepgram/listen/v1/client.py +++ b/src/deepgram/listen/v1/client.py @@ -3,233 +3,18 @@ from __future__ import annotations import typing -from contextlib import asynccontextmanager, contextmanager -import httpx -import websockets.exceptions -import websockets.sync.client as websockets_sync_client -from ...core.api_error import ApiError from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.request_options import RequestOptions -from .raw_client import AsyncRawV1Client, RawV1Client -from .socket_client import AsyncV1SocketClient, V1SocketClient if typing.TYPE_CHECKING: from .media.client import AsyncMediaClient, MediaClient -try: - from websockets.legacy.client import connect as websockets_client_connect # type: ignore -except ImportError: - from websockets import connect as websockets_client_connect # type: ignore - class V1Client: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._media: typing.Optional[MediaClient] = None - @property - def with_raw_response(self) -> RawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawV1Client - """ - return self._raw_client - - @contextmanager - def connect( - self, - *, - callback: typing.Optional[str] = None, - callback_method: typing.Optional[str] = None, - channels: typing.Optional[str] = None, - detect_entities: typing.Optional[str] = None, - diarize: typing.Optional[str] = None, - dictation: typing.Optional[str] = None, - encoding: typing.Optional[str] = None, - endpointing: typing.Optional[str] = None, - extra: typing.Optional[str] = None, - interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - keywords: typing.Optional[str] = None, - language: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - model: str, - multichannel: typing.Optional[str] = None, - numerals: typing.Optional[str] = None, - profanity_filter: typing.Optional[str] = None, - punctuate: typing.Optional[str] = None, - redact: typing.Optional[str] = None, - replace: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - search: typing.Optional[str] = None, - smart_format: typing.Optional[str] = None, - tag: typing.Optional[str] = None, - utterance_end_ms: typing.Optional[str] = None, - vad_events: typing.Optional[str] = None, - version: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Iterator[V1SocketClient]: - """ - Transcribe audio and video using Deepgram's speech-to-text WebSocket - - Parameters - ---------- - callback : typing.Optional[str] - - callback_method : typing.Optional[str] - - channels : typing.Optional[str] - - detect_entities : typing.Optional[str] - - diarize : typing.Optional[str] - - dictation : typing.Optional[str] - - encoding : typing.Optional[str] - - endpointing : typing.Optional[str] - - extra : typing.Optional[str] - - interim_results : typing.Optional[str] - - keyterm : typing.Optional[str] - - keywords : typing.Optional[str] - - language : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - model : str - AI model to use for the transcription - - multichannel : typing.Optional[str] - - numerals : typing.Optional[str] - - profanity_filter : typing.Optional[str] - - punctuate : typing.Optional[str] - - redact : typing.Optional[str] - - replace : typing.Optional[str] - - sample_rate : typing.Optional[str] - - search : typing.Optional[str] - - smart_format : typing.Optional[str] - - tag : typing.Optional[str] - - utterance_end_ms : typing.Optional[str] - - vad_events : typing.Optional[str] - - version : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - V1SocketClient - """ - ws_url = self._raw_client._client_wrapper.get_environment().production + "/v1/listen" - query_params = httpx.QueryParams() - if callback is not None: - query_params = query_params.add("callback", callback) - if callback_method is not None: - query_params = query_params.add("callback_method", callback_method) - if channels is not None: - query_params = query_params.add("channels", channels) - if detect_entities is not None: - query_params = query_params.add("detect_entities", detect_entities) - if diarize is not None: - query_params = query_params.add("diarize", diarize) - if dictation is not None: - query_params = query_params.add("dictation", dictation) - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if endpointing is not None: - query_params = query_params.add("endpointing", endpointing) - if extra is not None: - query_params = query_params.add("extra", extra) - if interim_results is not None: - query_params = query_params.add("interim_results", interim_results) - if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) - if keywords is not None: - query_params = query_params.add("keywords", keywords) - if language is not None: - query_params = query_params.add("language", language) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if model is not None: - query_params = query_params.add("model", model) - if multichannel is not None: - query_params = query_params.add("multichannel", multichannel) - if numerals is not None: - query_params = query_params.add("numerals", numerals) - if profanity_filter is not None: - query_params = query_params.add("profanity_filter", profanity_filter) - if punctuate is not None: - query_params = query_params.add("punctuate", punctuate) - if redact is not None: - query_params = query_params.add("redact", redact) - if replace is not None: - query_params = query_params.add("replace", replace) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - if search is not None: - query_params = query_params.add("search", search) - if smart_format is not None: - query_params = query_params.add("smart_format", smart_format) - if tag is not None: - query_params = query_params.add("tag", tag) - if utterance_end_ms is not None: - query_params = query_params.add("utterance_end_ms", utterance_end_ms) - if vad_events is not None: - query_params = query_params.add("vad_events", vad_events) - if version is not None: - query_params = query_params.add("version", version) - ws_url = ws_url + f"?{query_params}" - headers = self._raw_client._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - with websockets_sync_client.connect(ws_url, additional_headers=headers) as protocol: - yield V1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - @property def media(self): if self._media is None: @@ -241,211 +26,9 @@ def media(self): class AsyncV1Client: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._media: typing.Optional[AsyncMediaClient] = None - @property - def with_raw_response(self) -> AsyncRawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawV1Client - """ - return self._raw_client - - @asynccontextmanager - async def connect( - self, - *, - callback: typing.Optional[str] = None, - callback_method: typing.Optional[str] = None, - channels: typing.Optional[str] = None, - detect_entities: typing.Optional[str] = None, - diarize: typing.Optional[str] = None, - dictation: typing.Optional[str] = None, - encoding: typing.Optional[str] = None, - endpointing: typing.Optional[str] = None, - extra: typing.Optional[str] = None, - interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - keywords: typing.Optional[str] = None, - language: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - model: str, - multichannel: typing.Optional[str] = None, - numerals: typing.Optional[str] = None, - profanity_filter: typing.Optional[str] = None, - punctuate: typing.Optional[str] = None, - redact: typing.Optional[str] = None, - replace: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - search: typing.Optional[str] = None, - smart_format: typing.Optional[str] = None, - tag: typing.Optional[str] = None, - utterance_end_ms: typing.Optional[str] = None, - vad_events: typing.Optional[str] = None, - version: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.AsyncIterator[AsyncV1SocketClient]: - """ - Transcribe audio and video using Deepgram's speech-to-text WebSocket - - Parameters - ---------- - callback : typing.Optional[str] - - callback_method : typing.Optional[str] - - channels : typing.Optional[str] - - detect_entities : typing.Optional[str] - - diarize : typing.Optional[str] - - dictation : typing.Optional[str] - - encoding : typing.Optional[str] - - endpointing : typing.Optional[str] - - extra : typing.Optional[str] - - interim_results : typing.Optional[str] - - keyterm : typing.Optional[str] - - keywords : typing.Optional[str] - - language : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - model : str - AI model to use for the transcription - - multichannel : typing.Optional[str] - - numerals : typing.Optional[str] - - profanity_filter : typing.Optional[str] - - punctuate : typing.Optional[str] - - redact : typing.Optional[str] - - replace : typing.Optional[str] - - sample_rate : typing.Optional[str] - - search : typing.Optional[str] - - smart_format : typing.Optional[str] - - tag : typing.Optional[str] - - utterance_end_ms : typing.Optional[str] - - vad_events : typing.Optional[str] - - version : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncV1SocketClient - """ - ws_url = self._raw_client._client_wrapper.get_environment().production + "/v1/listen" - query_params = httpx.QueryParams() - if callback is not None: - query_params = query_params.add("callback", callback) - if callback_method is not None: - query_params = query_params.add("callback_method", callback_method) - if channels is not None: - query_params = query_params.add("channels", channels) - if detect_entities is not None: - query_params = query_params.add("detect_entities", detect_entities) - if diarize is not None: - query_params = query_params.add("diarize", diarize) - if dictation is not None: - query_params = query_params.add("dictation", dictation) - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if endpointing is not None: - query_params = query_params.add("endpointing", endpointing) - if extra is not None: - query_params = query_params.add("extra", extra) - if interim_results is not None: - query_params = query_params.add("interim_results", interim_results) - if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) - if keywords is not None: - query_params = query_params.add("keywords", keywords) - if language is not None: - query_params = query_params.add("language", language) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if model is not None: - query_params = query_params.add("model", model) - if multichannel is not None: - query_params = query_params.add("multichannel", multichannel) - if numerals is not None: - query_params = query_params.add("numerals", numerals) - if profanity_filter is not None: - query_params = query_params.add("profanity_filter", profanity_filter) - if punctuate is not None: - query_params = query_params.add("punctuate", punctuate) - if redact is not None: - query_params = query_params.add("redact", redact) - if replace is not None: - query_params = query_params.add("replace", replace) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - if search is not None: - query_params = query_params.add("search", search) - if smart_format is not None: - query_params = query_params.add("smart_format", smart_format) - if tag is not None: - query_params = query_params.add("tag", tag) - if utterance_end_ms is not None: - query_params = query_params.add("utterance_end_ms", utterance_end_ms) - if vad_events is not None: - query_params = query_params.add("vad_events", vad_events) - if version is not None: - query_params = query_params.add("version", version) - ws_url = ws_url + f"?{query_params}" - headers = self._raw_client._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - async with websockets_client_connect(ws_url, extra_headers=headers) as protocol: - yield AsyncV1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - @property def media(self): if self._media is None: diff --git a/src/deepgram/listen/v1/media/raw_client.py b/src/deepgram/listen/v1/media/raw_client.py index d1c7d675..f3690a14 100644 --- a/src/deepgram/listen/v1/media/raw_client.py +++ b/src/deepgram/listen/v1/media/raw_client.py @@ -193,7 +193,6 @@ def transcribe_url( """ _response = self._client_wrapper.httpx_client.request( "v1/listen", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "callback": callback, @@ -435,7 +434,6 @@ def transcribe_file( """ _response = self._client_wrapper.httpx_client.request( "v1/listen", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "callback": callback, @@ -680,7 +678,6 @@ async def transcribe_url( """ _response = await self._client_wrapper.httpx_client.request( "v1/listen", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "callback": callback, @@ -922,7 +919,6 @@ async def transcribe_file( """ _response = await self._client_wrapper.httpx_client.request( "v1/listen", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "callback": callback, diff --git a/src/deepgram/listen/v1/raw_client.py b/src/deepgram/listen/v1/raw_client.py deleted file mode 100644 index c6768c52..00000000 --- a/src/deepgram/listen/v1/raw_client.py +++ /dev/null @@ -1,407 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -from contextlib import asynccontextmanager, contextmanager - -import httpx -import websockets.exceptions -import websockets.sync.client as websockets_sync_client -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.request_options import RequestOptions -from .socket_client import AsyncV1SocketClient, V1SocketClient - -try: - from websockets.legacy.client import connect as websockets_client_connect # type: ignore -except ImportError: - from websockets import connect as websockets_client_connect # type: ignore - - -class RawV1Client: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - @contextmanager - def connect( - self, - *, - callback: typing.Optional[str] = None, - callback_method: typing.Optional[str] = None, - channels: typing.Optional[str] = None, - detect_entities: typing.Optional[str] = None, - diarize: typing.Optional[str] = None, - dictation: typing.Optional[str] = None, - encoding: typing.Optional[str] = None, - endpointing: typing.Optional[str] = None, - extra: typing.Optional[str] = None, - interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - keywords: typing.Optional[str] = None, - language: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - model: str, - multichannel: typing.Optional[str] = None, - numerals: typing.Optional[str] = None, - profanity_filter: typing.Optional[str] = None, - punctuate: typing.Optional[str] = None, - redact: typing.Optional[str] = None, - replace: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - search: typing.Optional[str] = None, - smart_format: typing.Optional[str] = None, - tag: typing.Optional[str] = None, - utterance_end_ms: typing.Optional[str] = None, - vad_events: typing.Optional[str] = None, - version: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Iterator[V1SocketClient]: - """ - Transcribe audio and video using Deepgram's speech-to-text WebSocket - - Parameters - ---------- - callback : typing.Optional[str] - - callback_method : typing.Optional[str] - - channels : typing.Optional[str] - - detect_entities : typing.Optional[str] - - diarize : typing.Optional[str] - - dictation : typing.Optional[str] - - encoding : typing.Optional[str] - - endpointing : typing.Optional[str] - - extra : typing.Optional[str] - - interim_results : typing.Optional[str] - - keyterm : typing.Optional[str] - - keywords : typing.Optional[str] - - language : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - model : str - AI model to use for the transcription - - multichannel : typing.Optional[str] - - numerals : typing.Optional[str] - - profanity_filter : typing.Optional[str] - - punctuate : typing.Optional[str] - - redact : typing.Optional[str] - - replace : typing.Optional[str] - - sample_rate : typing.Optional[str] - - search : typing.Optional[str] - - smart_format : typing.Optional[str] - - tag : typing.Optional[str] - - utterance_end_ms : typing.Optional[str] - - vad_events : typing.Optional[str] - - version : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - V1SocketClient - """ - ws_url = self._client_wrapper.get_environment().production + "/v1/listen" - query_params = httpx.QueryParams() - if callback is not None: - query_params = query_params.add("callback", callback) - if callback_method is not None: - query_params = query_params.add("callback_method", callback_method) - if channels is not None: - query_params = query_params.add("channels", channels) - if detect_entities is not None: - query_params = query_params.add("detect_entities", detect_entities) - if diarize is not None: - query_params = query_params.add("diarize", diarize) - if dictation is not None: - query_params = query_params.add("dictation", dictation) - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if endpointing is not None: - query_params = query_params.add("endpointing", endpointing) - if extra is not None: - query_params = query_params.add("extra", extra) - if interim_results is not None: - query_params = query_params.add("interim_results", interim_results) - if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) - if keywords is not None: - query_params = query_params.add("keywords", keywords) - if language is not None: - query_params = query_params.add("language", language) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if model is not None: - query_params = query_params.add("model", model) - if multichannel is not None: - query_params = query_params.add("multichannel", multichannel) - if numerals is not None: - query_params = query_params.add("numerals", numerals) - if profanity_filter is not None: - query_params = query_params.add("profanity_filter", profanity_filter) - if punctuate is not None: - query_params = query_params.add("punctuate", punctuate) - if redact is not None: - query_params = query_params.add("redact", redact) - if replace is not None: - query_params = query_params.add("replace", replace) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - if search is not None: - query_params = query_params.add("search", search) - if smart_format is not None: - query_params = query_params.add("smart_format", smart_format) - if tag is not None: - query_params = query_params.add("tag", tag) - if utterance_end_ms is not None: - query_params = query_params.add("utterance_end_ms", utterance_end_ms) - if vad_events is not None: - query_params = query_params.add("vad_events", vad_events) - if version is not None: - query_params = query_params.add("version", version) - ws_url = ws_url + f"?{query_params}" - headers = self._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - with websockets_sync_client.connect(ws_url, additional_headers=headers) as protocol: - yield V1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - - -class AsyncRawV1Client: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - @asynccontextmanager - async def connect( - self, - *, - callback: typing.Optional[str] = None, - callback_method: typing.Optional[str] = None, - channels: typing.Optional[str] = None, - detect_entities: typing.Optional[str] = None, - diarize: typing.Optional[str] = None, - dictation: typing.Optional[str] = None, - encoding: typing.Optional[str] = None, - endpointing: typing.Optional[str] = None, - extra: typing.Optional[str] = None, - interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - keywords: typing.Optional[str] = None, - language: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - model: str, - multichannel: typing.Optional[str] = None, - numerals: typing.Optional[str] = None, - profanity_filter: typing.Optional[str] = None, - punctuate: typing.Optional[str] = None, - redact: typing.Optional[str] = None, - replace: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - search: typing.Optional[str] = None, - smart_format: typing.Optional[str] = None, - tag: typing.Optional[str] = None, - utterance_end_ms: typing.Optional[str] = None, - vad_events: typing.Optional[str] = None, - version: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.AsyncIterator[AsyncV1SocketClient]: - """ - Transcribe audio and video using Deepgram's speech-to-text WebSocket - - Parameters - ---------- - callback : typing.Optional[str] - - callback_method : typing.Optional[str] - - channels : typing.Optional[str] - - detect_entities : typing.Optional[str] - - diarize : typing.Optional[str] - - dictation : typing.Optional[str] - - encoding : typing.Optional[str] - - endpointing : typing.Optional[str] - - extra : typing.Optional[str] - - interim_results : typing.Optional[str] - - keyterm : typing.Optional[str] - - keywords : typing.Optional[str] - - language : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - model : str - AI model to use for the transcription - - multichannel : typing.Optional[str] - - numerals : typing.Optional[str] - - profanity_filter : typing.Optional[str] - - punctuate : typing.Optional[str] - - redact : typing.Optional[str] - - replace : typing.Optional[str] - - sample_rate : typing.Optional[str] - - search : typing.Optional[str] - - smart_format : typing.Optional[str] - - tag : typing.Optional[str] - - utterance_end_ms : typing.Optional[str] - - vad_events : typing.Optional[str] - - version : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncV1SocketClient - """ - ws_url = self._client_wrapper.get_environment().production + "/v1/listen" - query_params = httpx.QueryParams() - if callback is not None: - query_params = query_params.add("callback", callback) - if callback_method is not None: - query_params = query_params.add("callback_method", callback_method) - if channels is not None: - query_params = query_params.add("channels", channels) - if detect_entities is not None: - query_params = query_params.add("detect_entities", detect_entities) - if diarize is not None: - query_params = query_params.add("diarize", diarize) - if dictation is not None: - query_params = query_params.add("dictation", dictation) - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if endpointing is not None: - query_params = query_params.add("endpointing", endpointing) - if extra is not None: - query_params = query_params.add("extra", extra) - if interim_results is not None: - query_params = query_params.add("interim_results", interim_results) - if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) - if keywords is not None: - query_params = query_params.add("keywords", keywords) - if language is not None: - query_params = query_params.add("language", language) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if model is not None: - query_params = query_params.add("model", model) - if multichannel is not None: - query_params = query_params.add("multichannel", multichannel) - if numerals is not None: - query_params = query_params.add("numerals", numerals) - if profanity_filter is not None: - query_params = query_params.add("profanity_filter", profanity_filter) - if punctuate is not None: - query_params = query_params.add("punctuate", punctuate) - if redact is not None: - query_params = query_params.add("redact", redact) - if replace is not None: - query_params = query_params.add("replace", replace) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - if search is not None: - query_params = query_params.add("search", search) - if smart_format is not None: - query_params = query_params.add("smart_format", smart_format) - if tag is not None: - query_params = query_params.add("tag", tag) - if utterance_end_ms is not None: - query_params = query_params.add("utterance_end_ms", utterance_end_ms) - if vad_events is not None: - query_params = query_params.add("vad_events", vad_events) - if version is not None: - query_params = query_params.add("version", version) - ws_url = ws_url + f"?{query_params}" - headers = self._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - async with websockets_client_connect(ws_url, extra_headers=headers) as protocol: - yield AsyncV1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) diff --git a/src/deepgram/listen/v1/requests/__init__.py b/src/deepgram/listen/v1/requests/__init__.py deleted file mode 100644 index 828c41d2..00000000 --- a/src/deepgram/listen/v1/requests/__init__.py +++ /dev/null @@ -1,76 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .listen_v1close_stream import ListenV1CloseStreamParams - from .listen_v1finalize import ListenV1FinalizeParams - from .listen_v1keep_alive import ListenV1KeepAliveParams - from .listen_v1metadata import ListenV1MetadataParams - from .listen_v1results import ListenV1ResultsParams - from .listen_v1results_channel import ListenV1ResultsChannelParams - from .listen_v1results_channel_alternatives_item import ListenV1ResultsChannelAlternativesItemParams - from .listen_v1results_channel_alternatives_item_words_item import ( - ListenV1ResultsChannelAlternativesItemWordsItemParams, - ) - from .listen_v1results_entities_item import ListenV1ResultsEntitiesItemParams - from .listen_v1results_metadata import ListenV1ResultsMetadataParams - from .listen_v1results_metadata_model_info import ListenV1ResultsMetadataModelInfoParams - from .listen_v1speech_started import ListenV1SpeechStartedParams - from .listen_v1utterance_end import ListenV1UtteranceEndParams -_dynamic_imports: typing.Dict[str, str] = { - "ListenV1CloseStreamParams": ".listen_v1close_stream", - "ListenV1FinalizeParams": ".listen_v1finalize", - "ListenV1KeepAliveParams": ".listen_v1keep_alive", - "ListenV1MetadataParams": ".listen_v1metadata", - "ListenV1ResultsChannelAlternativesItemParams": ".listen_v1results_channel_alternatives_item", - "ListenV1ResultsChannelAlternativesItemWordsItemParams": ".listen_v1results_channel_alternatives_item_words_item", - "ListenV1ResultsChannelParams": ".listen_v1results_channel", - "ListenV1ResultsEntitiesItemParams": ".listen_v1results_entities_item", - "ListenV1ResultsMetadataModelInfoParams": ".listen_v1results_metadata_model_info", - "ListenV1ResultsMetadataParams": ".listen_v1results_metadata", - "ListenV1ResultsParams": ".listen_v1results", - "ListenV1SpeechStartedParams": ".listen_v1speech_started", - "ListenV1UtteranceEndParams": ".listen_v1utterance_end", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "ListenV1CloseStreamParams", - "ListenV1FinalizeParams", - "ListenV1KeepAliveParams", - "ListenV1MetadataParams", - "ListenV1ResultsChannelAlternativesItemParams", - "ListenV1ResultsChannelAlternativesItemWordsItemParams", - "ListenV1ResultsChannelParams", - "ListenV1ResultsEntitiesItemParams", - "ListenV1ResultsMetadataModelInfoParams", - "ListenV1ResultsMetadataParams", - "ListenV1ResultsParams", - "ListenV1SpeechStartedParams", - "ListenV1UtteranceEndParams", -] diff --git a/src/deepgram/listen/v1/requests/listen_v1close_stream.py b/src/deepgram/listen/v1/requests/listen_v1close_stream.py deleted file mode 100644 index c75ad0e1..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1close_stream.py +++ /dev/null @@ -1,11 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.listen_v1close_stream_type import ListenV1CloseStreamType - - -class ListenV1CloseStreamParams(typing_extensions.TypedDict): - type: ListenV1CloseStreamType - """ - Message type identifier - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1finalize.py b/src/deepgram/listen/v1/requests/listen_v1finalize.py deleted file mode 100644 index 8dd6d16e..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1finalize.py +++ /dev/null @@ -1,11 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.listen_v1finalize_type import ListenV1FinalizeType - - -class ListenV1FinalizeParams(typing_extensions.TypedDict): - type: ListenV1FinalizeType - """ - Message type identifier - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1keep_alive.py b/src/deepgram/listen/v1/requests/listen_v1keep_alive.py deleted file mode 100644 index b40242bd..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1keep_alive.py +++ /dev/null @@ -1,11 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.listen_v1keep_alive_type import ListenV1KeepAliveType - - -class ListenV1KeepAliveParams(typing_extensions.TypedDict): - type: ListenV1KeepAliveType - """ - Message type identifier - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1metadata.py b/src/deepgram/listen/v1/requests/listen_v1metadata.py deleted file mode 100644 index 2b648b48..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1metadata.py +++ /dev/null @@ -1,42 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class ListenV1MetadataParams(typing_extensions.TypedDict): - type: typing.Literal["Metadata"] - """ - Message type identifier - """ - - transaction_key: str - """ - The transaction key - """ - - request_id: str - """ - The request ID - """ - - sha256: str - """ - The sha256 - """ - - created: str - """ - The created - """ - - duration: float - """ - The duration - """ - - channels: float - """ - The channels - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1results.py b/src/deepgram/listen/v1/requests/listen_v1results.py deleted file mode 100644 index 96e152f0..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1results.py +++ /dev/null @@ -1,52 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .listen_v1results_channel import ListenV1ResultsChannelParams -from .listen_v1results_entities_item import ListenV1ResultsEntitiesItemParams -from .listen_v1results_metadata import ListenV1ResultsMetadataParams - - -class ListenV1ResultsParams(typing_extensions.TypedDict): - type: typing.Literal["Results"] - """ - Message type identifier - """ - - channel_index: typing.Sequence[float] - """ - The index of the channel - """ - - duration: float - """ - The duration of the transcription - """ - - start: float - """ - The start time of the transcription - """ - - is_final: typing_extensions.NotRequired[bool] - """ - Whether the transcription is final - """ - - speech_final: typing_extensions.NotRequired[bool] - """ - Whether the transcription is speech final - """ - - channel: ListenV1ResultsChannelParams - metadata: ListenV1ResultsMetadataParams - from_finalize: typing_extensions.NotRequired[bool] - """ - Whether the transcription is from a finalize message - """ - - entities: typing_extensions.NotRequired[typing.Sequence[ListenV1ResultsEntitiesItemParams]] - """ - Extracted entities from the audio when detect_entities is enabled. Only present in is_final messages. Returns an empty array if no entities are detected - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1results_channel.py b/src/deepgram/listen/v1/requests/listen_v1results_channel.py deleted file mode 100644 index f27e364d..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1results_channel.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .listen_v1results_channel_alternatives_item import ListenV1ResultsChannelAlternativesItemParams - - -class ListenV1ResultsChannelParams(typing_extensions.TypedDict): - alternatives: typing.Sequence[ListenV1ResultsChannelAlternativesItemParams] diff --git a/src/deepgram/listen/v1/requests/listen_v1results_channel_alternatives_item.py b/src/deepgram/listen/v1/requests/listen_v1results_channel_alternatives_item.py deleted file mode 100644 index c603e8f5..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1results_channel_alternatives_item.py +++ /dev/null @@ -1,21 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .listen_v1results_channel_alternatives_item_words_item import ListenV1ResultsChannelAlternativesItemWordsItemParams - - -class ListenV1ResultsChannelAlternativesItemParams(typing_extensions.TypedDict): - transcript: str - """ - The transcript of the transcription - """ - - confidence: float - """ - The confidence of the transcription - """ - - languages: typing_extensions.NotRequired[typing.Sequence[str]] - words: typing.Sequence[ListenV1ResultsChannelAlternativesItemWordsItemParams] diff --git a/src/deepgram/listen/v1/requests/listen_v1results_channel_alternatives_item_words_item.py b/src/deepgram/listen/v1/requests/listen_v1results_channel_alternatives_item_words_item.py deleted file mode 100644 index c28d5979..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1results_channel_alternatives_item_words_item.py +++ /dev/null @@ -1,40 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class ListenV1ResultsChannelAlternativesItemWordsItemParams(typing_extensions.TypedDict): - word: str - """ - The word of the transcription - """ - - start: float - """ - The start time of the word - """ - - end: float - """ - The end time of the word - """ - - confidence: float - """ - The confidence of the word - """ - - language: typing_extensions.NotRequired[str] - """ - The language of the word - """ - - punctuated_word: typing_extensions.NotRequired[str] - """ - The punctuated word of the word - """ - - speaker: typing_extensions.NotRequired[float] - """ - The speaker of the word - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1results_entities_item.py b/src/deepgram/listen/v1/requests/listen_v1results_entities_item.py deleted file mode 100644 index 6caf7899..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1results_entities_item.py +++ /dev/null @@ -1,35 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class ListenV1ResultsEntitiesItemParams(typing_extensions.TypedDict): - label: str - """ - The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, CARDINAL) - """ - - value: str - """ - The formatted text representation of the entity - """ - - raw_value: str - """ - The original spoken text of the entity (present when formatting is enabled) - """ - - confidence: float - """ - The confidence score of the entity detection - """ - - start_word: int - """ - The index of the first word of the entity in the transcript (inclusive) - """ - - end_word: int - """ - The index of the last word of the entity in the transcript (exclusive) - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1results_metadata.py b/src/deepgram/listen/v1/requests/listen_v1results_metadata.py deleted file mode 100644 index fb5037c8..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1results_metadata.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from .listen_v1results_metadata_model_info import ListenV1ResultsMetadataModelInfoParams - - -class ListenV1ResultsMetadataParams(typing_extensions.TypedDict): - request_id: str - """ - The request ID - """ - - model_info: ListenV1ResultsMetadataModelInfoParams - model_uuid: str - """ - The model UUID - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1results_metadata_model_info.py b/src/deepgram/listen/v1/requests/listen_v1results_metadata_model_info.py deleted file mode 100644 index f953fdce..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1results_metadata_model_info.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class ListenV1ResultsMetadataModelInfoParams(typing_extensions.TypedDict): - name: str - """ - The name of the model - """ - - version: str - """ - The version of the model - """ - - arch: str - """ - The arch of the model - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1speech_started.py b/src/deepgram/listen/v1/requests/listen_v1speech_started.py deleted file mode 100644 index 1cc1dcfa..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1speech_started.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class ListenV1SpeechStartedParams(typing_extensions.TypedDict): - type: typing.Literal["SpeechStarted"] - """ - Message type identifier - """ - - channel: typing.Sequence[float] - """ - The channel - """ - - timestamp: float - """ - The timestamp - """ diff --git a/src/deepgram/listen/v1/requests/listen_v1utterance_end.py b/src/deepgram/listen/v1/requests/listen_v1utterance_end.py deleted file mode 100644 index 37ae57b8..00000000 --- a/src/deepgram/listen/v1/requests/listen_v1utterance_end.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class ListenV1UtteranceEndParams(typing_extensions.TypedDict): - type: typing.Literal["UtteranceEnd"] - """ - Message type identifier - """ - - channel: typing.Sequence[float] - """ - The channel - """ - - last_word_end: float - """ - The last word end - """ diff --git a/src/deepgram/listen/v1/socket_client.py b/src/deepgram/listen/v1/socket_client.py deleted file mode 100644 index f99009de..00000000 --- a/src/deepgram/listen/v1/socket_client.py +++ /dev/null @@ -1,186 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import json -import typing -from json.decoder import JSONDecodeError - -import websockets -import websockets.sync.connection as websockets_sync_connection -from ...core.events import EventEmitterMixin, EventType -from ...core.pydantic_utilities import parse_obj_as -from .types.listen_v1close_stream import ListenV1CloseStream -from .types.listen_v1finalize import ListenV1Finalize -from .types.listen_v1keep_alive import ListenV1KeepAlive -from .types.listen_v1metadata import ListenV1Metadata -from .types.listen_v1results import ListenV1Results -from .types.listen_v1speech_started import ListenV1SpeechStarted -from .types.listen_v1utterance_end import ListenV1UtteranceEnd - -try: - from websockets.legacy.client import WebSocketClientProtocol # type: ignore -except ImportError: - from websockets import WebSocketClientProtocol # type: ignore - -V1SocketClientResponse = typing.Union[ListenV1Results, ListenV1Metadata, ListenV1UtteranceEnd, ListenV1SpeechStarted] - - -class AsyncV1SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: WebSocketClientProtocol): - super().__init__() - self._websocket = websocket - - async def __aiter__(self): - async for message in self._websocket: - yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore - - async def start_listening(self): - """ - Start listening for messages on the websocket connection. - - Emits events in the following order: - - EventType.OPEN when connection is established - - EventType.MESSAGE for each message received - - EventType.ERROR if an error occurs - - EventType.CLOSE when connection is closed - """ - await self._emit_async(EventType.OPEN, None) - try: - async for raw_message in self._websocket: - json_data = json.loads(raw_message) - parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: - await self._emit_async(EventType.ERROR, exc) - finally: - await self._emit_async(EventType.CLOSE, None) - - async def send_media(self, message: bytes) -> None: - """ - Send a message to the websocket connection. - The message will be sent as bytes. - """ - await self._send(message) - - async def send_finalize(self, message: ListenV1Finalize) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV1Finalize. - """ - await self._send_model(message) - - async def send_close_stream(self, message: ListenV1CloseStream) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV1CloseStream. - """ - await self._send_model(message) - - async def send_keep_alive(self, message: ListenV1KeepAlive) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV1KeepAlive. - """ - await self._send_model(message) - - async def recv(self) -> V1SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = await self._websocket.recv() - json_data = json.loads(data) - return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - - async def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - await self._websocket.send(data) - - async def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - await self._send(data.dict()) - - -class V1SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: websockets_sync_connection.Connection): - super().__init__() - self._websocket = websocket - - def __iter__(self): - for message in self._websocket: - yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore - - def start_listening(self): - """ - Start listening for messages on the websocket connection. - - Emits events in the following order: - - EventType.OPEN when connection is established - - EventType.MESSAGE for each message received - - EventType.ERROR if an error occurs - - EventType.CLOSE when connection is closed - """ - self._emit(EventType.OPEN, None) - try: - for raw_message in self._websocket: - json_data = json.loads(raw_message) - parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: - self._emit(EventType.ERROR, exc) - finally: - self._emit(EventType.CLOSE, None) - - def send_media(self, message: bytes) -> None: - """ - Send a message to the websocket connection. - The message will be sent as bytes. - """ - self._send(message) - - def send_finalize(self, message: ListenV1Finalize) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV1Finalize. - """ - self._send_model(message) - - def send_close_stream(self, message: ListenV1CloseStream) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV1CloseStream. - """ - self._send_model(message) - - def send_keep_alive(self, message: ListenV1KeepAlive) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV1KeepAlive. - """ - self._send_model(message) - - def recv(self) -> V1SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = self._websocket.recv() - json_data = json.loads(data) - return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - - def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - self._websocket.send(data) - - def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - self._send(data.dict()) diff --git a/src/deepgram/listen/v1/types/__init__.py b/src/deepgram/listen/v1/types/__init__.py deleted file mode 100644 index 30c6849a..00000000 --- a/src/deepgram/listen/v1/types/__init__.py +++ /dev/null @@ -1,83 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .listen_v1close_stream import ListenV1CloseStream - from .listen_v1close_stream_type import ListenV1CloseStreamType - from .listen_v1finalize import ListenV1Finalize - from .listen_v1finalize_type import ListenV1FinalizeType - from .listen_v1keep_alive import ListenV1KeepAlive - from .listen_v1keep_alive_type import ListenV1KeepAliveType - from .listen_v1metadata import ListenV1Metadata - from .listen_v1results import ListenV1Results - from .listen_v1results_channel import ListenV1ResultsChannel - from .listen_v1results_channel_alternatives_item import ListenV1ResultsChannelAlternativesItem - from .listen_v1results_channel_alternatives_item_words_item import ListenV1ResultsChannelAlternativesItemWordsItem - from .listen_v1results_entities_item import ListenV1ResultsEntitiesItem - from .listen_v1results_metadata import ListenV1ResultsMetadata - from .listen_v1results_metadata_model_info import ListenV1ResultsMetadataModelInfo - from .listen_v1speech_started import ListenV1SpeechStarted - from .listen_v1utterance_end import ListenV1UtteranceEnd -_dynamic_imports: typing.Dict[str, str] = { - "ListenV1CloseStream": ".listen_v1close_stream", - "ListenV1CloseStreamType": ".listen_v1close_stream_type", - "ListenV1Finalize": ".listen_v1finalize", - "ListenV1FinalizeType": ".listen_v1finalize_type", - "ListenV1KeepAlive": ".listen_v1keep_alive", - "ListenV1KeepAliveType": ".listen_v1keep_alive_type", - "ListenV1Metadata": ".listen_v1metadata", - "ListenV1Results": ".listen_v1results", - "ListenV1ResultsChannel": ".listen_v1results_channel", - "ListenV1ResultsChannelAlternativesItem": ".listen_v1results_channel_alternatives_item", - "ListenV1ResultsChannelAlternativesItemWordsItem": ".listen_v1results_channel_alternatives_item_words_item", - "ListenV1ResultsEntitiesItem": ".listen_v1results_entities_item", - "ListenV1ResultsMetadata": ".listen_v1results_metadata", - "ListenV1ResultsMetadataModelInfo": ".listen_v1results_metadata_model_info", - "ListenV1SpeechStarted": ".listen_v1speech_started", - "ListenV1UtteranceEnd": ".listen_v1utterance_end", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "ListenV1CloseStream", - "ListenV1CloseStreamType", - "ListenV1Finalize", - "ListenV1FinalizeType", - "ListenV1KeepAlive", - "ListenV1KeepAliveType", - "ListenV1Metadata", - "ListenV1Results", - "ListenV1ResultsChannel", - "ListenV1ResultsChannelAlternativesItem", - "ListenV1ResultsChannelAlternativesItemWordsItem", - "ListenV1ResultsEntitiesItem", - "ListenV1ResultsMetadata", - "ListenV1ResultsMetadataModelInfo", - "ListenV1SpeechStarted", - "ListenV1UtteranceEnd", -] diff --git a/src/deepgram/listen/v1/types/listen_v1close_stream.py b/src/deepgram/listen/v1/types/listen_v1close_stream.py deleted file mode 100644 index 6c11646f..00000000 --- a/src/deepgram/listen/v1/types/listen_v1close_stream.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .listen_v1close_stream_type import ListenV1CloseStreamType - - -class ListenV1CloseStream(UniversalBaseModel): - type: ListenV1CloseStreamType = pydantic.Field() - """ - Message type identifier - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1close_stream_type.py b/src/deepgram/listen/v1/types/listen_v1close_stream_type.py deleted file mode 100644 index e5332dfd..00000000 --- a/src/deepgram/listen/v1/types/listen_v1close_stream_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1CloseStreamType = typing.Union[typing.Literal["Finalize", "CloseStream", "KeepAlive"], typing.Any] diff --git a/src/deepgram/listen/v1/types/listen_v1finalize.py b/src/deepgram/listen/v1/types/listen_v1finalize.py deleted file mode 100644 index ffd48baa..00000000 --- a/src/deepgram/listen/v1/types/listen_v1finalize.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .listen_v1finalize_type import ListenV1FinalizeType - - -class ListenV1Finalize(UniversalBaseModel): - type: ListenV1FinalizeType = pydantic.Field() - """ - Message type identifier - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1finalize_type.py b/src/deepgram/listen/v1/types/listen_v1finalize_type.py deleted file mode 100644 index c8e1de82..00000000 --- a/src/deepgram/listen/v1/types/listen_v1finalize_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1FinalizeType = typing.Union[typing.Literal["Finalize", "CloseStream", "KeepAlive"], typing.Any] diff --git a/src/deepgram/listen/v1/types/listen_v1keep_alive.py b/src/deepgram/listen/v1/types/listen_v1keep_alive.py deleted file mode 100644 index 96d3e67a..00000000 --- a/src/deepgram/listen/v1/types/listen_v1keep_alive.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .listen_v1keep_alive_type import ListenV1KeepAliveType - - -class ListenV1KeepAlive(UniversalBaseModel): - type: ListenV1KeepAliveType = pydantic.Field() - """ - Message type identifier - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1keep_alive_type.py b/src/deepgram/listen/v1/types/listen_v1keep_alive_type.py deleted file mode 100644 index 36b22ae4..00000000 --- a/src/deepgram/listen/v1/types/listen_v1keep_alive_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1KeepAliveType = typing.Union[typing.Literal["Finalize", "CloseStream", "KeepAlive"], typing.Any] diff --git a/src/deepgram/listen/v1/types/listen_v1metadata.py b/src/deepgram/listen/v1/types/listen_v1metadata.py deleted file mode 100644 index d86a5253..00000000 --- a/src/deepgram/listen/v1/types/listen_v1metadata.py +++ /dev/null @@ -1,52 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListenV1Metadata(UniversalBaseModel): - type: typing.Literal["Metadata"] = pydantic.Field(default="Metadata") - """ - Message type identifier - """ - - transaction_key: str = pydantic.Field() - """ - The transaction key - """ - - request_id: str = pydantic.Field() - """ - The request ID - """ - - sha256: str = pydantic.Field() - """ - The sha256 - """ - - created: str = pydantic.Field() - """ - The created - """ - - duration: float = pydantic.Field() - """ - The duration - """ - - channels: float = pydantic.Field() - """ - The channels - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1results.py b/src/deepgram/listen/v1/types/listen_v1results.py deleted file mode 100644 index 9479f87d..00000000 --- a/src/deepgram/listen/v1/types/listen_v1results.py +++ /dev/null @@ -1,62 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .listen_v1results_channel import ListenV1ResultsChannel -from .listen_v1results_entities_item import ListenV1ResultsEntitiesItem -from .listen_v1results_metadata import ListenV1ResultsMetadata - - -class ListenV1Results(UniversalBaseModel): - type: typing.Literal["Results"] = pydantic.Field(default="Results") - """ - Message type identifier - """ - - channel_index: typing.List[float] = pydantic.Field() - """ - The index of the channel - """ - - duration: float = pydantic.Field() - """ - The duration of the transcription - """ - - start: float = pydantic.Field() - """ - The start time of the transcription - """ - - is_final: typing.Optional[bool] = pydantic.Field(default=None) - """ - Whether the transcription is final - """ - - speech_final: typing.Optional[bool] = pydantic.Field(default=None) - """ - Whether the transcription is speech final - """ - - channel: ListenV1ResultsChannel - metadata: ListenV1ResultsMetadata - from_finalize: typing.Optional[bool] = pydantic.Field(default=None) - """ - Whether the transcription is from a finalize message - """ - - entities: typing.Optional[typing.List[ListenV1ResultsEntitiesItem]] = pydantic.Field(default=None) - """ - Extracted entities from the audio when detect_entities is enabled. Only present in is_final messages. Returns an empty array if no entities are detected - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1results_channel.py b/src/deepgram/listen/v1/types/listen_v1results_channel.py deleted file mode 100644 index ce58c5f3..00000000 --- a/src/deepgram/listen/v1/types/listen_v1results_channel.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .listen_v1results_channel_alternatives_item import ListenV1ResultsChannelAlternativesItem - - -class ListenV1ResultsChannel(UniversalBaseModel): - alternatives: typing.List[ListenV1ResultsChannelAlternativesItem] - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1results_channel_alternatives_item.py b/src/deepgram/listen/v1/types/listen_v1results_channel_alternatives_item.py deleted file mode 100644 index c8e0703c..00000000 --- a/src/deepgram/listen/v1/types/listen_v1results_channel_alternatives_item.py +++ /dev/null @@ -1,31 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .listen_v1results_channel_alternatives_item_words_item import ListenV1ResultsChannelAlternativesItemWordsItem - - -class ListenV1ResultsChannelAlternativesItem(UniversalBaseModel): - transcript: str = pydantic.Field() - """ - The transcript of the transcription - """ - - confidence: float = pydantic.Field() - """ - The confidence of the transcription - """ - - languages: typing.Optional[typing.List[str]] = None - words: typing.List[ListenV1ResultsChannelAlternativesItemWordsItem] - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1results_channel_alternatives_item_words_item.py b/src/deepgram/listen/v1/types/listen_v1results_channel_alternatives_item_words_item.py deleted file mode 100644 index 2cc3686f..00000000 --- a/src/deepgram/listen/v1/types/listen_v1results_channel_alternatives_item_words_item.py +++ /dev/null @@ -1,52 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListenV1ResultsChannelAlternativesItemWordsItem(UniversalBaseModel): - word: str = pydantic.Field() - """ - The word of the transcription - """ - - start: float = pydantic.Field() - """ - The start time of the word - """ - - end: float = pydantic.Field() - """ - The end time of the word - """ - - confidence: float = pydantic.Field() - """ - The confidence of the word - """ - - language: typing.Optional[str] = pydantic.Field(default=None) - """ - The language of the word - """ - - punctuated_word: typing.Optional[str] = pydantic.Field(default=None) - """ - The punctuated word of the word - """ - - speaker: typing.Optional[float] = pydantic.Field(default=None) - """ - The speaker of the word - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1results_entities_item.py b/src/deepgram/listen/v1/types/listen_v1results_entities_item.py deleted file mode 100644 index f8d5fb3a..00000000 --- a/src/deepgram/listen/v1/types/listen_v1results_entities_item.py +++ /dev/null @@ -1,47 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListenV1ResultsEntitiesItem(UniversalBaseModel): - label: str = pydantic.Field() - """ - The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, CARDINAL) - """ - - value: str = pydantic.Field() - """ - The formatted text representation of the entity - """ - - raw_value: str = pydantic.Field() - """ - The original spoken text of the entity (present when formatting is enabled) - """ - - confidence: float = pydantic.Field() - """ - The confidence score of the entity detection - """ - - start_word: int = pydantic.Field() - """ - The index of the first word of the entity in the transcript (inclusive) - """ - - end_word: int = pydantic.Field() - """ - The index of the last word of the entity in the transcript (exclusive) - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1results_metadata.py b/src/deepgram/listen/v1/types/listen_v1results_metadata.py deleted file mode 100644 index 92518626..00000000 --- a/src/deepgram/listen/v1/types/listen_v1results_metadata.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .listen_v1results_metadata_model_info import ListenV1ResultsMetadataModelInfo - - -class ListenV1ResultsMetadata(UniversalBaseModel): - request_id: str = pydantic.Field() - """ - The request ID - """ - - model_info: ListenV1ResultsMetadataModelInfo - model_uuid: str = pydantic.Field() - """ - The model UUID - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1results_metadata_model_info.py b/src/deepgram/listen/v1/types/listen_v1results_metadata_model_info.py deleted file mode 100644 index 19e04fa8..00000000 --- a/src/deepgram/listen/v1/types/listen_v1results_metadata_model_info.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListenV1ResultsMetadataModelInfo(UniversalBaseModel): - name: str = pydantic.Field() - """ - The name of the model - """ - - version: str = pydantic.Field() - """ - The version of the model - """ - - arch: str = pydantic.Field() - """ - The arch of the model - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1speech_started.py b/src/deepgram/listen/v1/types/listen_v1speech_started.py deleted file mode 100644 index ce42f749..00000000 --- a/src/deepgram/listen/v1/types/listen_v1speech_started.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListenV1SpeechStarted(UniversalBaseModel): - type: typing.Literal["SpeechStarted"] = pydantic.Field(default="SpeechStarted") - """ - Message type identifier - """ - - channel: typing.List[float] = pydantic.Field() - """ - The channel - """ - - timestamp: float = pydantic.Field() - """ - The timestamp - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v1/types/listen_v1utterance_end.py b/src/deepgram/listen/v1/types/listen_v1utterance_end.py deleted file mode 100644 index 39cb1100..00000000 --- a/src/deepgram/listen/v1/types/listen_v1utterance_end.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListenV1UtteranceEnd(UniversalBaseModel): - type: typing.Literal["UtteranceEnd"] = pydantic.Field(default="UtteranceEnd") - """ - Message type identifier - """ - - channel: typing.List[float] = pydantic.Field() - """ - The channel - """ - - last_word_end: float = pydantic.Field() - """ - The last word end - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/__init__.py b/src/deepgram/listen/v2/__init__.py deleted file mode 100644 index db7c724c..00000000 --- a/src/deepgram/listen/v2/__init__.py +++ /dev/null @@ -1,75 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .types import ( - ListenV2CloseStream, - ListenV2CloseStreamType, - ListenV2Connected, - ListenV2FatalError, - ListenV2TurnInfo, - ListenV2TurnInfoEvent, - ListenV2TurnInfoWordsItem, - ) - from .requests import ( - ListenV2CloseStreamParams, - ListenV2ConnectedParams, - ListenV2FatalErrorParams, - ListenV2TurnInfoParams, - ListenV2TurnInfoWordsItemParams, - ) -_dynamic_imports: typing.Dict[str, str] = { - "ListenV2CloseStream": ".types", - "ListenV2CloseStreamParams": ".requests", - "ListenV2CloseStreamType": ".types", - "ListenV2Connected": ".types", - "ListenV2ConnectedParams": ".requests", - "ListenV2FatalError": ".types", - "ListenV2FatalErrorParams": ".requests", - "ListenV2TurnInfo": ".types", - "ListenV2TurnInfoEvent": ".types", - "ListenV2TurnInfoParams": ".requests", - "ListenV2TurnInfoWordsItem": ".types", - "ListenV2TurnInfoWordsItemParams": ".requests", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "ListenV2CloseStream", - "ListenV2CloseStreamParams", - "ListenV2CloseStreamType", - "ListenV2Connected", - "ListenV2ConnectedParams", - "ListenV2FatalError", - "ListenV2FatalErrorParams", - "ListenV2TurnInfo", - "ListenV2TurnInfoEvent", - "ListenV2TurnInfoParams", - "ListenV2TurnInfoWordsItem", - "ListenV2TurnInfoWordsItemParams", -] diff --git a/src/deepgram/listen/v2/client.py b/src/deepgram/listen/v2/client.py deleted file mode 100644 index ff78c81d..00000000 --- a/src/deepgram/listen/v2/client.py +++ /dev/null @@ -1,240 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -from contextlib import asynccontextmanager, contextmanager - -import httpx -import websockets.exceptions -import websockets.sync.client as websockets_sync_client -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.request_options import RequestOptions -from .raw_client import AsyncRawV2Client, RawV2Client -from .socket_client import AsyncV2SocketClient, V2SocketClient - -try: - from websockets.legacy.client import connect as websockets_client_connect # type: ignore -except ImportError: - from websockets import connect as websockets_client_connect # type: ignore - - -class V2Client: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawV2Client(client_wrapper=client_wrapper) - - @property - def with_raw_response(self) -> RawV2Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawV2Client - """ - return self._raw_client - - @contextmanager - def connect( - self, - *, - model: str, - encoding: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - eager_eot_threshold: typing.Optional[str] = None, - eot_threshold: typing.Optional[str] = None, - eot_timeout_ms: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - tag: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Iterator[V2SocketClient]: - """ - Real-time conversational speech recognition with contextual turn detection - for natural voice conversations - - Parameters - ---------- - model : str - - encoding : typing.Optional[str] - - sample_rate : typing.Optional[str] - - eager_eot_threshold : typing.Optional[str] - - eot_threshold : typing.Optional[str] - - eot_timeout_ms : typing.Optional[str] - - keyterm : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - tag : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - V2SocketClient - """ - ws_url = self._raw_client._client_wrapper.get_environment().production + "/v2/listen" - query_params = httpx.QueryParams() - if model is not None: - query_params = query_params.add("model", model) - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - if eager_eot_threshold is not None: - query_params = query_params.add("eager_eot_threshold", eager_eot_threshold) - if eot_threshold is not None: - query_params = query_params.add("eot_threshold", eot_threshold) - if eot_timeout_ms is not None: - query_params = query_params.add("eot_timeout_ms", eot_timeout_ms) - if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if tag is not None: - query_params = query_params.add("tag", tag) - ws_url = ws_url + f"?{query_params}" - headers = self._raw_client._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - with websockets_sync_client.connect(ws_url, additional_headers=headers) as protocol: - yield V2SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - - -class AsyncV2Client: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawV2Client(client_wrapper=client_wrapper) - - @property - def with_raw_response(self) -> AsyncRawV2Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawV2Client - """ - return self._raw_client - - @asynccontextmanager - async def connect( - self, - *, - model: str, - encoding: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - eager_eot_threshold: typing.Optional[str] = None, - eot_threshold: typing.Optional[str] = None, - eot_timeout_ms: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - tag: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.AsyncIterator[AsyncV2SocketClient]: - """ - Real-time conversational speech recognition with contextual turn detection - for natural voice conversations - - Parameters - ---------- - model : str - - encoding : typing.Optional[str] - - sample_rate : typing.Optional[str] - - eager_eot_threshold : typing.Optional[str] - - eot_threshold : typing.Optional[str] - - eot_timeout_ms : typing.Optional[str] - - keyterm : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - tag : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncV2SocketClient - """ - ws_url = self._raw_client._client_wrapper.get_environment().production + "/v2/listen" - query_params = httpx.QueryParams() - if model is not None: - query_params = query_params.add("model", model) - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - if eager_eot_threshold is not None: - query_params = query_params.add("eager_eot_threshold", eager_eot_threshold) - if eot_threshold is not None: - query_params = query_params.add("eot_threshold", eot_threshold) - if eot_timeout_ms is not None: - query_params = query_params.add("eot_timeout_ms", eot_timeout_ms) - if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if tag is not None: - query_params = query_params.add("tag", tag) - ws_url = ws_url + f"?{query_params}" - headers = self._raw_client._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - async with websockets_client_connect(ws_url, extra_headers=headers) as protocol: - yield AsyncV2SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) diff --git a/src/deepgram/listen/v2/raw_client.py b/src/deepgram/listen/v2/raw_client.py deleted file mode 100644 index 818a88e4..00000000 --- a/src/deepgram/listen/v2/raw_client.py +++ /dev/null @@ -1,217 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -from contextlib import asynccontextmanager, contextmanager - -import httpx -import websockets.exceptions -import websockets.sync.client as websockets_sync_client -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.request_options import RequestOptions -from .socket_client import AsyncV2SocketClient, V2SocketClient - -try: - from websockets.legacy.client import connect as websockets_client_connect # type: ignore -except ImportError: - from websockets import connect as websockets_client_connect # type: ignore - - -class RawV2Client: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - @contextmanager - def connect( - self, - *, - model: str, - encoding: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - eager_eot_threshold: typing.Optional[str] = None, - eot_threshold: typing.Optional[str] = None, - eot_timeout_ms: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - tag: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Iterator[V2SocketClient]: - """ - Real-time conversational speech recognition with contextual turn detection - for natural voice conversations - - Parameters - ---------- - model : str - - encoding : typing.Optional[str] - - sample_rate : typing.Optional[str] - - eager_eot_threshold : typing.Optional[str] - - eot_threshold : typing.Optional[str] - - eot_timeout_ms : typing.Optional[str] - - keyterm : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - tag : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - V2SocketClient - """ - ws_url = self._client_wrapper.get_environment().production + "/v2/listen" - query_params = httpx.QueryParams() - if model is not None: - query_params = query_params.add("model", model) - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - if eager_eot_threshold is not None: - query_params = query_params.add("eager_eot_threshold", eager_eot_threshold) - if eot_threshold is not None: - query_params = query_params.add("eot_threshold", eot_threshold) - if eot_timeout_ms is not None: - query_params = query_params.add("eot_timeout_ms", eot_timeout_ms) - if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if tag is not None: - query_params = query_params.add("tag", tag) - ws_url = ws_url + f"?{query_params}" - headers = self._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - with websockets_sync_client.connect(ws_url, additional_headers=headers) as protocol: - yield V2SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - - -class AsyncRawV2Client: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - @asynccontextmanager - async def connect( - self, - *, - model: str, - encoding: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - eager_eot_threshold: typing.Optional[str] = None, - eot_threshold: typing.Optional[str] = None, - eot_timeout_ms: typing.Optional[str] = None, - keyterm: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - tag: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.AsyncIterator[AsyncV2SocketClient]: - """ - Real-time conversational speech recognition with contextual turn detection - for natural voice conversations - - Parameters - ---------- - model : str - - encoding : typing.Optional[str] - - sample_rate : typing.Optional[str] - - eager_eot_threshold : typing.Optional[str] - - eot_threshold : typing.Optional[str] - - eot_timeout_ms : typing.Optional[str] - - keyterm : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - tag : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncV2SocketClient - """ - ws_url = self._client_wrapper.get_environment().production + "/v2/listen" - query_params = httpx.QueryParams() - if model is not None: - query_params = query_params.add("model", model) - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - if eager_eot_threshold is not None: - query_params = query_params.add("eager_eot_threshold", eager_eot_threshold) - if eot_threshold is not None: - query_params = query_params.add("eot_threshold", eot_threshold) - if eot_timeout_ms is not None: - query_params = query_params.add("eot_timeout_ms", eot_timeout_ms) - if keyterm is not None: - query_params = query_params.add("keyterm", keyterm) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if tag is not None: - query_params = query_params.add("tag", tag) - ws_url = ws_url + f"?{query_params}" - headers = self._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - async with websockets_client_connect(ws_url, extra_headers=headers) as protocol: - yield AsyncV2SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) diff --git a/src/deepgram/listen/v2/requests/__init__.py b/src/deepgram/listen/v2/requests/__init__.py deleted file mode 100644 index 96ce5ece..00000000 --- a/src/deepgram/listen/v2/requests/__init__.py +++ /dev/null @@ -1,50 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .listen_v2close_stream import ListenV2CloseStreamParams - from .listen_v2connected import ListenV2ConnectedParams - from .listen_v2fatal_error import ListenV2FatalErrorParams - from .listen_v2turn_info import ListenV2TurnInfoParams - from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItemParams -_dynamic_imports: typing.Dict[str, str] = { - "ListenV2CloseStreamParams": ".listen_v2close_stream", - "ListenV2ConnectedParams": ".listen_v2connected", - "ListenV2FatalErrorParams": ".listen_v2fatal_error", - "ListenV2TurnInfoParams": ".listen_v2turn_info", - "ListenV2TurnInfoWordsItemParams": ".listen_v2turn_info_words_item", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "ListenV2CloseStreamParams", - "ListenV2ConnectedParams", - "ListenV2FatalErrorParams", - "ListenV2TurnInfoParams", - "ListenV2TurnInfoWordsItemParams", -] diff --git a/src/deepgram/listen/v2/requests/listen_v2close_stream.py b/src/deepgram/listen/v2/requests/listen_v2close_stream.py deleted file mode 100644 index 70e4f760..00000000 --- a/src/deepgram/listen/v2/requests/listen_v2close_stream.py +++ /dev/null @@ -1,11 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.listen_v2close_stream_type import ListenV2CloseStreamType - - -class ListenV2CloseStreamParams(typing_extensions.TypedDict): - type: ListenV2CloseStreamType - """ - Message type identifier - """ diff --git a/src/deepgram/listen/v2/requests/listen_v2connected.py b/src/deepgram/listen/v2/requests/listen_v2connected.py deleted file mode 100644 index c931eec2..00000000 --- a/src/deepgram/listen/v2/requests/listen_v2connected.py +++ /dev/null @@ -1,24 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class ListenV2ConnectedParams(typing_extensions.TypedDict): - type: typing.Literal["Connected"] - """ - Message type identifier - """ - - request_id: str - """ - The unique identifier of the request - """ - - sequence_id: float - """ - Starts at `0` and increments for each message the server sends - to the client. This includes messages of other types, like - `TurnInfo` messages. - """ diff --git a/src/deepgram/listen/v2/requests/listen_v2fatal_error.py b/src/deepgram/listen/v2/requests/listen_v2fatal_error.py deleted file mode 100644 index 05cb3041..00000000 --- a/src/deepgram/listen/v2/requests/listen_v2fatal_error.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class ListenV2FatalErrorParams(typing_extensions.TypedDict): - type: typing.Literal["Error"] - """ - Message type identifier - """ - - sequence_id: float - """ - Starts at `0` and increments for each message the server sends - to the client. This includes messages of other types, like - `Connected` messages. - """ - - code: str - """ - A string code describing the error, e.g. `INTERNAL_SERVER_ERROR` - """ - - description: str - """ - Prose description of the error - """ diff --git a/src/deepgram/listen/v2/requests/listen_v2turn_info.py b/src/deepgram/listen/v2/requests/listen_v2turn_info.py deleted file mode 100644 index d1a15fec..00000000 --- a/src/deepgram/listen/v2/requests/listen_v2turn_info.py +++ /dev/null @@ -1,65 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from ..types.listen_v2turn_info_event import ListenV2TurnInfoEvent -from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItemParams - - -class ListenV2TurnInfoParams(typing_extensions.TypedDict): - """ - Describes the current turn and latest state of the turn - """ - - type: typing.Literal["TurnInfo"] - request_id: str - """ - The unique identifier of the request - """ - - sequence_id: float - """ - Starts at `0` and increments for each message the server sends to the client. This includes messages of other types, like `Connected` messages. - """ - - event: ListenV2TurnInfoEvent - """ - The type of event being reported. - - - **Update** - Additional audio has been transcribed, but the turn state hasn't changed - - **StartOfTurn** - The user has begun speaking for the first time in the turn - - **EagerEndOfTurn** - The system has moderate confidence that the user has finished speaking for the turn. This is an opportunity to begin preparing an agent reply - - **TurnResumed** - The system detected that speech had ended and therefore sent an **EagerEndOfTurn** event, but speech is actually continuing for this turn - - **EndOfTurn** - The user has finished speaking for the turn - """ - - turn_index: float - """ - The index of the current turn - """ - - audio_window_start: float - """ - Start time in seconds of the audio range that was transcribed - """ - - audio_window_end: float - """ - End time in seconds of the audio range that was transcribed - """ - - transcript: str - """ - Text that was said over the course of the current turn - """ - - words: typing.Sequence[ListenV2TurnInfoWordsItemParams] - """ - The words in the `transcript` - """ - - end_of_turn_confidence: float - """ - Confidence that no more speech is coming in this turn - """ diff --git a/src/deepgram/listen/v2/requests/listen_v2turn_info_words_item.py b/src/deepgram/listen/v2/requests/listen_v2turn_info_words_item.py deleted file mode 100644 index 397157f5..00000000 --- a/src/deepgram/listen/v2/requests/listen_v2turn_info_words_item.py +++ /dev/null @@ -1,15 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions - - -class ListenV2TurnInfoWordsItemParams(typing_extensions.TypedDict): - word: str - """ - The individual punctuated, properly-cased word from the transcript - """ - - confidence: float - """ - Confidence that this word was transcribed correctly - """ diff --git a/src/deepgram/listen/v2/socket_client.py b/src/deepgram/listen/v2/socket_client.py deleted file mode 100644 index 177a0e4f..00000000 --- a/src/deepgram/listen/v2/socket_client.py +++ /dev/null @@ -1,155 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import json -import typing -from json.decoder import JSONDecodeError - -import websockets -import websockets.sync.connection as websockets_sync_connection -from ...core.events import EventEmitterMixin, EventType -from ...core.pydantic_utilities import parse_obj_as -from .types.listen_v2close_stream import ListenV2CloseStream -from .types.listen_v2connected import ListenV2Connected -from .types.listen_v2fatal_error import ListenV2FatalError -from .types.listen_v2turn_info import ListenV2TurnInfo - -try: - from websockets.legacy.client import WebSocketClientProtocol # type: ignore -except ImportError: - from websockets import WebSocketClientProtocol # type: ignore - -V2SocketClientResponse = typing.Union[ListenV2Connected, ListenV2TurnInfo, ListenV2FatalError] - - -class AsyncV2SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: WebSocketClientProtocol): - super().__init__() - self._websocket = websocket - - async def __aiter__(self): - async for message in self._websocket: - yield parse_obj_as(V2SocketClientResponse, json.loads(message)) # type: ignore - - async def start_listening(self): - """ - Start listening for messages on the websocket connection. - - Emits events in the following order: - - EventType.OPEN when connection is established - - EventType.MESSAGE for each message received - - EventType.ERROR if an error occurs - - EventType.CLOSE when connection is closed - """ - await self._emit_async(EventType.OPEN, None) - try: - async for raw_message in self._websocket: - json_data = json.loads(raw_message) - parsed = parse_obj_as(V2SocketClientResponse, json_data) # type: ignore - await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: - await self._emit_async(EventType.ERROR, exc) - finally: - await self._emit_async(EventType.CLOSE, None) - - async def send_media(self, message: bytes) -> None: - """ - Send a message to the websocket connection. - The message will be sent as bytes. - """ - await self._send(message) - - async def send_close_stream(self, message: ListenV2CloseStream) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV2CloseStream. - """ - await self._send_model(message) - - async def recv(self) -> V2SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = await self._websocket.recv() - json_data = json.loads(data) - return parse_obj_as(V2SocketClientResponse, json_data) # type: ignore - - async def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - await self._websocket.send(data) - - async def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - await self._send(data.dict()) - - -class V2SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: websockets_sync_connection.Connection): - super().__init__() - self._websocket = websocket - - def __iter__(self): - for message in self._websocket: - yield parse_obj_as(V2SocketClientResponse, json.loads(message)) # type: ignore - - def start_listening(self): - """ - Start listening for messages on the websocket connection. - - Emits events in the following order: - - EventType.OPEN when connection is established - - EventType.MESSAGE for each message received - - EventType.ERROR if an error occurs - - EventType.CLOSE when connection is closed - """ - self._emit(EventType.OPEN, None) - try: - for raw_message in self._websocket: - json_data = json.loads(raw_message) - parsed = parse_obj_as(V2SocketClientResponse, json_data) # type: ignore - self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: - self._emit(EventType.ERROR, exc) - finally: - self._emit(EventType.CLOSE, None) - - def send_media(self, message: bytes) -> None: - """ - Send a message to the websocket connection. - The message will be sent as bytes. - """ - self._send(message) - - def send_close_stream(self, message: ListenV2CloseStream) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a ListenV2CloseStream. - """ - self._send_model(message) - - def recv(self) -> V2SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = self._websocket.recv() - json_data = json.loads(data) - return parse_obj_as(V2SocketClientResponse, json_data) # type: ignore - - def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - self._websocket.send(data) - - def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - self._send(data.dict()) diff --git a/src/deepgram/listen/v2/types/__init__.py b/src/deepgram/listen/v2/types/__init__.py deleted file mode 100644 index 229417bf..00000000 --- a/src/deepgram/listen/v2/types/__init__.py +++ /dev/null @@ -1,56 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .listen_v2close_stream import ListenV2CloseStream - from .listen_v2close_stream_type import ListenV2CloseStreamType - from .listen_v2connected import ListenV2Connected - from .listen_v2fatal_error import ListenV2FatalError - from .listen_v2turn_info import ListenV2TurnInfo - from .listen_v2turn_info_event import ListenV2TurnInfoEvent - from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItem -_dynamic_imports: typing.Dict[str, str] = { - "ListenV2CloseStream": ".listen_v2close_stream", - "ListenV2CloseStreamType": ".listen_v2close_stream_type", - "ListenV2Connected": ".listen_v2connected", - "ListenV2FatalError": ".listen_v2fatal_error", - "ListenV2TurnInfo": ".listen_v2turn_info", - "ListenV2TurnInfoEvent": ".listen_v2turn_info_event", - "ListenV2TurnInfoWordsItem": ".listen_v2turn_info_words_item", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "ListenV2CloseStream", - "ListenV2CloseStreamType", - "ListenV2Connected", - "ListenV2FatalError", - "ListenV2TurnInfo", - "ListenV2TurnInfoEvent", - "ListenV2TurnInfoWordsItem", -] diff --git a/src/deepgram/listen/v2/types/listen_v2close_stream.py b/src/deepgram/listen/v2/types/listen_v2close_stream.py deleted file mode 100644 index 00376ced..00000000 --- a/src/deepgram/listen/v2/types/listen_v2close_stream.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .listen_v2close_stream_type import ListenV2CloseStreamType - - -class ListenV2CloseStream(UniversalBaseModel): - type: ListenV2CloseStreamType = pydantic.Field() - """ - Message type identifier - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2close_stream_type.py b/src/deepgram/listen/v2/types/listen_v2close_stream_type.py deleted file mode 100644 index 2ac3484e..00000000 --- a/src/deepgram/listen/v2/types/listen_v2close_stream_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2CloseStreamType = typing.Union[typing.Literal["Finalize", "CloseStream", "KeepAlive"], typing.Any] diff --git a/src/deepgram/listen/v2/types/listen_v2connected.py b/src/deepgram/listen/v2/types/listen_v2connected.py deleted file mode 100644 index 29108f24..00000000 --- a/src/deepgram/listen/v2/types/listen_v2connected.py +++ /dev/null @@ -1,34 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListenV2Connected(UniversalBaseModel): - type: typing.Literal["Connected"] = pydantic.Field(default="Connected") - """ - Message type identifier - """ - - request_id: str = pydantic.Field() - """ - The unique identifier of the request - """ - - sequence_id: float = pydantic.Field() - """ - Starts at `0` and increments for each message the server sends - to the client. This includes messages of other types, like - `TurnInfo` messages. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2fatal_error.py b/src/deepgram/listen/v2/types/listen_v2fatal_error.py deleted file mode 100644 index 1eccfabc..00000000 --- a/src/deepgram/listen/v2/types/listen_v2fatal_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListenV2FatalError(UniversalBaseModel): - type: typing.Literal["Error"] = pydantic.Field(default="Error") - """ - Message type identifier - """ - - sequence_id: float = pydantic.Field() - """ - Starts at `0` and increments for each message the server sends - to the client. This includes messages of other types, like - `Connected` messages. - """ - - code: str = pydantic.Field() - """ - A string code describing the error, e.g. `INTERNAL_SERVER_ERROR` - """ - - description: str = pydantic.Field() - """ - Prose description of the error - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info.py b/src/deepgram/listen/v2/types/listen_v2turn_info.py deleted file mode 100644 index 80006b6b..00000000 --- a/src/deepgram/listen/v2/types/listen_v2turn_info.py +++ /dev/null @@ -1,75 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .listen_v2turn_info_event import ListenV2TurnInfoEvent -from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItem - - -class ListenV2TurnInfo(UniversalBaseModel): - """ - Describes the current turn and latest state of the turn - """ - - type: typing.Literal["TurnInfo"] = "TurnInfo" - request_id: str = pydantic.Field() - """ - The unique identifier of the request - """ - - sequence_id: float = pydantic.Field() - """ - Starts at `0` and increments for each message the server sends to the client. This includes messages of other types, like `Connected` messages. - """ - - event: ListenV2TurnInfoEvent = pydantic.Field() - """ - The type of event being reported. - - - **Update** - Additional audio has been transcribed, but the turn state hasn't changed - - **StartOfTurn** - The user has begun speaking for the first time in the turn - - **EagerEndOfTurn** - The system has moderate confidence that the user has finished speaking for the turn. This is an opportunity to begin preparing an agent reply - - **TurnResumed** - The system detected that speech had ended and therefore sent an **EagerEndOfTurn** event, but speech is actually continuing for this turn - - **EndOfTurn** - The user has finished speaking for the turn - """ - - turn_index: float = pydantic.Field() - """ - The index of the current turn - """ - - audio_window_start: float = pydantic.Field() - """ - Start time in seconds of the audio range that was transcribed - """ - - audio_window_end: float = pydantic.Field() - """ - End time in seconds of the audio range that was transcribed - """ - - transcript: str = pydantic.Field() - """ - Text that was said over the course of the current turn - """ - - words: typing.List[ListenV2TurnInfoWordsItem] = pydantic.Field() - """ - The words in the `transcript` - """ - - end_of_turn_confidence: float = pydantic.Field() - """ - Confidence that no more speech is coming in this turn - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info_event.py b/src/deepgram/listen/v2/types/listen_v2turn_info_event.py deleted file mode 100644 index d2a0510f..00000000 --- a/src/deepgram/listen/v2/types/listen_v2turn_info_event.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2TurnInfoEvent = typing.Union[ - typing.Literal["Update", "StartOfTurn", "EagerEndOfTurn", "TurnResumed", "EndOfTurn"], typing.Any -] diff --git a/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py b/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py deleted file mode 100644 index 58ae2f98..00000000 --- a/src/deepgram/listen/v2/types/listen_v2turn_info_words_item.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class ListenV2TurnInfoWordsItem(UniversalBaseModel): - word: str = pydantic.Field() - """ - The individual punctuated, properly-cased word from the transcript - """ - - confidence: float = pydantic.Field() - """ - Confidence that this word was transcribed correctly - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/manage/client.py b/src/deepgram/manage/client.py index 5460c138..471cf063 100644 --- a/src/deepgram/manage/client.py +++ b/src/deepgram/manage/client.py @@ -5,7 +5,6 @@ import typing from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawManageClient, RawManageClient if typing.TYPE_CHECKING: from .v1.client import AsyncV1Client, V1Client @@ -13,21 +12,9 @@ class ManageClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawManageClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[V1Client] = None - @property - def with_raw_response(self) -> RawManageClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawManageClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: @@ -39,21 +26,9 @@ def v1(self): class AsyncManageClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawManageClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[AsyncV1Client] = None - @property - def with_raw_response(self) -> AsyncRawManageClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawManageClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: diff --git a/src/deepgram/manage/raw_client.py b/src/deepgram/manage/raw_client.py deleted file mode 100644 index 1e919e19..00000000 --- a/src/deepgram/manage/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawManageClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawManageClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/manage/v1/client.py b/src/deepgram/manage/v1/client.py index beafb55e..d02408be 100644 --- a/src/deepgram/manage/v1/client.py +++ b/src/deepgram/manage/v1/client.py @@ -5,7 +5,6 @@ import typing from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawV1Client, RawV1Client if typing.TYPE_CHECKING: from .models.client import AsyncModelsClient, ModelsClient @@ -14,22 +13,10 @@ class V1Client: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._models: typing.Optional[ModelsClient] = None self._projects: typing.Optional[ProjectsClient] = None - @property - def with_raw_response(self) -> RawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawV1Client - """ - return self._raw_client - @property def models(self): if self._models is None: @@ -49,22 +36,10 @@ def projects(self): class AsyncV1Client: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._models: typing.Optional[AsyncModelsClient] = None self._projects: typing.Optional[AsyncProjectsClient] = None - @property - def with_raw_response(self) -> AsyncRawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawV1Client - """ - return self._raw_client - @property def models(self): if self._models is None: diff --git a/src/deepgram/manage/v1/models/raw_client.py b/src/deepgram/manage/v1/models/raw_client.py index f1300e7f..d04a38e5 100644 --- a/src/deepgram/manage/v1/models/raw_client.py +++ b/src/deepgram/manage/v1/models/raw_client.py @@ -39,7 +39,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( "v1/models", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "include_outdated": include_outdated, @@ -93,7 +92,6 @@ def get( """ _response = self._client_wrapper.httpx_client.request( f"v1/models/{jsonable_encoder(model_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -149,7 +147,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( "v1/models", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "include_outdated": include_outdated, @@ -203,7 +200,6 @@ async def get( """ _response = await self._client_wrapper.httpx_client.request( f"v1/models/{jsonable_encoder(model_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) diff --git a/src/deepgram/manage/v1/projects/billing/balances/raw_client.py b/src/deepgram/manage/v1/projects/billing/balances/raw_client.py index 744135f4..229159da 100644 --- a/src/deepgram/manage/v1/projects/billing/balances/raw_client.py +++ b/src/deepgram/manage/v1/projects/billing/balances/raw_client.py @@ -39,7 +39,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/balances", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -93,7 +92,6 @@ def get( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/balances/{jsonable_encoder(balance_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -149,7 +147,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/balances", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -203,7 +200,6 @@ async def get( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/balances/{jsonable_encoder(balance_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) diff --git a/src/deepgram/manage/v1/projects/billing/breakdown/raw_client.py b/src/deepgram/manage/v1/projects/billing/breakdown/raw_client.py index c34e4eb9..87131a24 100644 --- a/src/deepgram/manage/v1/projects/billing/breakdown/raw_client.py +++ b/src/deepgram/manage/v1/projects/billing/breakdown/raw_client.py @@ -73,7 +73,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/billing/breakdown", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, @@ -171,7 +170,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/billing/breakdown", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, diff --git a/src/deepgram/manage/v1/projects/billing/client.py b/src/deepgram/manage/v1/projects/billing/client.py index ad8b0fef..8a089144 100644 --- a/src/deepgram/manage/v1/projects/billing/client.py +++ b/src/deepgram/manage/v1/projects/billing/client.py @@ -5,7 +5,6 @@ import typing from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawBillingClient, RawBillingClient if typing.TYPE_CHECKING: from .balances.client import AsyncBalancesClient, BalancesClient @@ -16,24 +15,12 @@ class BillingClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawBillingClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._balances: typing.Optional[BalancesClient] = None self._breakdown: typing.Optional[BreakdownClient] = None self._fields: typing.Optional[FieldsClient] = None self._purchases: typing.Optional[PurchasesClient] = None - @property - def with_raw_response(self) -> RawBillingClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawBillingClient - """ - return self._raw_client - @property def balances(self): if self._balances is None: @@ -69,24 +56,12 @@ def purchases(self): class AsyncBillingClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawBillingClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._balances: typing.Optional[AsyncBalancesClient] = None self._breakdown: typing.Optional[AsyncBreakdownClient] = None self._fields: typing.Optional[AsyncFieldsClient] = None self._purchases: typing.Optional[AsyncPurchasesClient] = None - @property - def with_raw_response(self) -> AsyncRawBillingClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawBillingClient - """ - return self._raw_client - @property def balances(self): if self._balances is None: diff --git a/src/deepgram/manage/v1/projects/billing/fields/raw_client.py b/src/deepgram/manage/v1/projects/billing/fields/raw_client.py index 548efb07..1b86e8f5 100644 --- a/src/deepgram/manage/v1/projects/billing/fields/raw_client.py +++ b/src/deepgram/manage/v1/projects/billing/fields/raw_client.py @@ -49,7 +49,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/billing/fields", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, @@ -120,7 +119,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/billing/fields", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, diff --git a/src/deepgram/manage/v1/projects/billing/purchases/raw_client.py b/src/deepgram/manage/v1/projects/billing/purchases/raw_client.py index 7839ad56..67b0f4c2 100644 --- a/src/deepgram/manage/v1/projects/billing/purchases/raw_client.py +++ b/src/deepgram/manage/v1/projects/billing/purchases/raw_client.py @@ -45,7 +45,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/purchases", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "limit": limit, @@ -111,7 +110,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/purchases", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "limit": limit, diff --git a/src/deepgram/manage/v1/projects/billing/raw_client.py b/src/deepgram/manage/v1/projects/billing/raw_client.py deleted file mode 100644 index c883aa4b..00000000 --- a/src/deepgram/manage/v1/projects/billing/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawBillingClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawBillingClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/manage/v1/projects/keys/raw_client.py b/src/deepgram/manage/v1/projects/keys/raw_client.py index 435f70eb..6b12cbe3 100644 --- a/src/deepgram/manage/v1/projects/keys/raw_client.py +++ b/src/deepgram/manage/v1/projects/keys/raw_client.py @@ -53,7 +53,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/keys", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "status": status, @@ -113,7 +112,6 @@ def create( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/keys", - base_url=self._client_wrapper.get_environment().base, method="POST", json=request, headers={ @@ -172,7 +170,6 @@ def get( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/keys/{jsonable_encoder(key_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -226,7 +223,6 @@ def delete( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/keys/{jsonable_encoder(key_id)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) @@ -289,7 +285,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/keys", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "status": status, @@ -349,7 +344,6 @@ async def create( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/keys", - base_url=self._client_wrapper.get_environment().base, method="POST", json=request, headers={ @@ -408,7 +402,6 @@ async def get( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/keys/{jsonable_encoder(key_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -462,7 +455,6 @@ async def delete( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/keys/{jsonable_encoder(key_id)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) diff --git a/src/deepgram/manage/v1/projects/members/invites/raw_client.py b/src/deepgram/manage/v1/projects/members/invites/raw_client.py index d7dce374..d3316dda 100644 --- a/src/deepgram/manage/v1/projects/members/invites/raw_client.py +++ b/src/deepgram/manage/v1/projects/members/invites/raw_client.py @@ -43,7 +43,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/invites", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -100,7 +99,6 @@ def create( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/invites", - base_url=self._client_wrapper.get_environment().base, method="POST", json={ "email": email, @@ -162,7 +160,6 @@ def delete( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/invites/{jsonable_encoder(email)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) @@ -218,7 +215,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/invites", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -275,7 +271,6 @@ async def create( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/invites", - base_url=self._client_wrapper.get_environment().base, method="POST", json={ "email": email, @@ -337,7 +332,6 @@ async def delete( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/invites/{jsonable_encoder(email)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) diff --git a/src/deepgram/manage/v1/projects/members/raw_client.py b/src/deepgram/manage/v1/projects/members/raw_client.py index fa671c6b..26c31a2d 100644 --- a/src/deepgram/manage/v1/projects/members/raw_client.py +++ b/src/deepgram/manage/v1/projects/members/raw_client.py @@ -39,7 +39,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/members", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -93,7 +92,6 @@ def delete( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/members/{jsonable_encoder(member_id)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) @@ -149,7 +147,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/members", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -203,7 +200,6 @@ async def delete( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/members/{jsonable_encoder(member_id)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) diff --git a/src/deepgram/manage/v1/projects/members/scopes/raw_client.py b/src/deepgram/manage/v1/projects/members/scopes/raw_client.py index 2cbfe030..d83d56d0 100644 --- a/src/deepgram/manage/v1/projects/members/scopes/raw_client.py +++ b/src/deepgram/manage/v1/projects/members/scopes/raw_client.py @@ -45,7 +45,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/members/{jsonable_encoder(member_id)}/scopes", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -102,7 +101,6 @@ def update( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/members/{jsonable_encoder(member_id)}/scopes", - base_url=self._client_wrapper.get_environment().base, method="PUT", json={ "scope": scope, @@ -168,7 +166,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/members/{jsonable_encoder(member_id)}/scopes", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -225,7 +222,6 @@ async def update( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/members/{jsonable_encoder(member_id)}/scopes", - base_url=self._client_wrapper.get_environment().base, method="PUT", json={ "scope": scope, diff --git a/src/deepgram/manage/v1/projects/models/raw_client.py b/src/deepgram/manage/v1/projects/models/raw_client.py index 518870bf..dff277e5 100644 --- a/src/deepgram/manage/v1/projects/models/raw_client.py +++ b/src/deepgram/manage/v1/projects/models/raw_client.py @@ -46,7 +46,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/models", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "include_outdated": include_outdated, @@ -103,7 +102,6 @@ def get( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/models/{jsonable_encoder(model_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -166,7 +164,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/models", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "include_outdated": include_outdated, @@ -223,7 +220,6 @@ async def get( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/models/{jsonable_encoder(model_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) diff --git a/src/deepgram/manage/v1/projects/raw_client.py b/src/deepgram/manage/v1/projects/raw_client.py index bdcc7fbd..e1bcb0be 100644 --- a/src/deepgram/manage/v1/projects/raw_client.py +++ b/src/deepgram/manage/v1/projects/raw_client.py @@ -40,7 +40,6 @@ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> Ht """ _response = self._client_wrapper.httpx_client.request( "v1/projects", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -102,7 +101,6 @@ def get( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "limit": limit, @@ -157,7 +155,6 @@ def delete( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) @@ -215,7 +212,6 @@ def update( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}", - base_url=self._client_wrapper.get_environment().base, method="PATCH", json={ "name": name, @@ -273,7 +269,6 @@ def leave( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/leave", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) @@ -326,7 +321,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( "v1/projects", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -388,7 +382,6 @@ async def get( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "limit": limit, @@ -443,7 +436,6 @@ async def delete( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) @@ -501,7 +493,6 @@ async def update( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}", - base_url=self._client_wrapper.get_environment().base, method="PATCH", json={ "name": name, @@ -559,7 +550,6 @@ async def leave( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/leave", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) diff --git a/src/deepgram/manage/v1/projects/requests/raw_client.py b/src/deepgram/manage/v1/projects/requests/raw_client.py index e71b5f56..f04ca30a 100644 --- a/src/deepgram/manage/v1/projects/requests/raw_client.py +++ b/src/deepgram/manage/v1/projects/requests/raw_client.py @@ -88,7 +88,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/requests", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": serialize_datetime(start) if start is not None else None, @@ -154,7 +153,6 @@ def get( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/requests/{jsonable_encoder(request_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -253,7 +251,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/requests", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": serialize_datetime(start) if start is not None else None, @@ -319,7 +316,6 @@ async def get( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/requests/{jsonable_encoder(request_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) diff --git a/src/deepgram/manage/v1/projects/usage/breakdown/raw_client.py b/src/deepgram/manage/v1/projects/usage/breakdown/raw_client.py index 13e4a1b5..8419f26d 100644 --- a/src/deepgram/manage/v1/projects/usage/breakdown/raw_client.py +++ b/src/deepgram/manage/v1/projects/usage/breakdown/raw_client.py @@ -225,7 +225,6 @@ def get( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/usage/breakdown", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, @@ -511,7 +510,6 @@ async def get( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/usage/breakdown", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, diff --git a/src/deepgram/manage/v1/projects/usage/fields/raw_client.py b/src/deepgram/manage/v1/projects/usage/fields/raw_client.py index e80b6fa0..c43b5790 100644 --- a/src/deepgram/manage/v1/projects/usage/fields/raw_client.py +++ b/src/deepgram/manage/v1/projects/usage/fields/raw_client.py @@ -49,7 +49,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/usage/fields", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, @@ -120,7 +119,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/usage/fields", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, diff --git a/src/deepgram/manage/v1/projects/usage/raw_client.py b/src/deepgram/manage/v1/projects/usage/raw_client.py index 15077e42..eec04bbb 100644 --- a/src/deepgram/manage/v1/projects/usage/raw_client.py +++ b/src/deepgram/manage/v1/projects/usage/raw_client.py @@ -220,7 +220,6 @@ def get( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/usage", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, @@ -501,7 +500,6 @@ async def get( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/usage", - base_url=self._client_wrapper.get_environment().base, method="GET", params={ "start": start, diff --git a/src/deepgram/manage/v1/raw_client.py b/src/deepgram/manage/v1/raw_client.py deleted file mode 100644 index 82da8718..00000000 --- a/src/deepgram/manage/v1/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawV1Client: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawV1Client: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/proxy/__init__.py b/src/deepgram/proxy/__init__.py new file mode 100644 index 00000000..da61f7c3 --- /dev/null +++ b/src/deepgram/proxy/__init__.py @@ -0,0 +1,6 @@ +"""Deepgram Proxy — drop-in proxy middleware for web applications.""" + +from .engine import DeepgramProxy +from .scopes import Scope + +__all__ = ["DeepgramProxy", "Scope"] diff --git a/src/deepgram/proxy/adapters/__init__.py b/src/deepgram/proxy/adapters/__init__.py new file mode 100644 index 00000000..a91a16a8 --- /dev/null +++ b/src/deepgram/proxy/adapters/__init__.py @@ -0,0 +1 @@ +"""Framework adapters for the Deepgram proxy.""" diff --git a/src/deepgram/proxy/adapters/django.py b/src/deepgram/proxy/adapters/django.py new file mode 100644 index 00000000..051cde14 --- /dev/null +++ b/src/deepgram/proxy/adapters/django.py @@ -0,0 +1,131 @@ +"""Django adapter for the Deepgram proxy.""" + +import asyncio +from typing import TYPE_CHECKING, Any, List + +from ..errors import ProxyError + +if TYPE_CHECKING: + from ..engine import DeepgramProxy + + +def deepgram_proxy_urls(proxy: "DeepgramProxy") -> List[Any]: + """Create Django URL patterns that proxy requests to Deepgram. + + REST views are CSRF-exempt. Optional WebSocket support requires + Django Channels (``pip install channels``). + + Usage:: + + from django.urls import path, include + from deepgram.proxy import DeepgramProxy + from deepgram.proxy.adapters.django import deepgram_proxy_urls + + proxy = DeepgramProxy(api_key="dg-xxx") + urlpatterns = [path("deepgram/", include(deepgram_proxy_urls(proxy)))] + + Returns: + List of URL patterns. If Django Channels is installed, the list also + has a ``websocket_consumer`` attribute containing the ASGI consumer class. + """ + from django.http import HttpRequest, HttpResponse + from django.urls import re_path + from django.views.decorators.csrf import csrf_exempt + + @csrf_exempt + def proxy_rest(request: HttpRequest, path: str) -> HttpResponse: + full_path = f"/{path}" + authorization = request.headers.get("Authorization") + + try: + scopes = proxy.authenticate(authorization) + proxy.authorize(full_path, scopes) + except ProxyError as exc: + return HttpResponse(exc.message, status=exc.status_code) + + headers = dict(request.headers) + body = request.body + query_string = request.META.get("QUERY_STRING", "") + + try: + status, resp_headers, resp_body = proxy.forward_rest_sync( + method=request.method, + path=full_path, + headers=headers, + query_string=query_string, + body=body, + ) + except ProxyError as exc: + return HttpResponse(exc.message, status=exc.status_code) + + response = HttpResponse(resp_body, status=status) + for k, v in resp_headers.items(): + if k.lower() not in ("content-length", "content-encoding"): + response[k] = v + return response + + patterns: Any = [ + re_path(r"^(?P.+)$", proxy_rest, name="deepgram_proxy_rest"), + ] + + # Optional WebSocket support via Django Channels + try: + from channels.generic.websocket import AsyncWebsocketConsumer + + class DeepgramProxyConsumer(AsyncWebsocketConsumer): + """ASGI WebSocket consumer for Deepgram proxy.""" + + async def connect(self) -> None: + self._path = "/" + self.scope.get("path", "").lstrip("/") + # Remove the URL prefix to get the API path + query_string = self.scope.get("query_string", b"").decode("utf-8") + subprotocol = None + for header_name, header_value in self.scope.get("headers", []): + if header_name == b"sec-websocket-protocol": + subprotocol = header_value.decode("utf-8") + break + + self._subprotocol = subprotocol + self._query_string = query_string + self._message_queue: asyncio.Queue = asyncio.Queue() + + await self.accept(subprotocol=subprotocol) + + # Start the relay + asyncio.ensure_future(self._relay()) + + async def _relay(self) -> None: + async def client_receive(): + msg = await self._message_queue.get() + return msg + + async def client_send(msg): + if isinstance(msg, bytes): + await self.send(bytes_data=msg) + else: + await self.send(text_data=str(msg)) + + async def client_close(code: int, reason: str = ""): + await self.close(code=code) + + await proxy.forward_websocket( + path=self._path, + query_string=self._query_string, + client_receive=client_receive, + client_send=client_send, + client_close=client_close, + subprotocol=self._subprotocol, + ) + + async def receive(self, text_data: str = None, bytes_data: bytes = None) -> None: # type: ignore[assignment] + await self._message_queue.put(text_data or bytes_data) + + async def disconnect(self, close_code: int) -> None: + await self._message_queue.put(None) + + patterns.websocket_consumer = DeepgramProxyConsumer # type: ignore[attr-defined] + + except ImportError: + pass # Django Channels not installed + + return patterns diff --git a/src/deepgram/proxy/adapters/fastapi.py b/src/deepgram/proxy/adapters/fastapi.py new file mode 100644 index 00000000..9b5631e6 --- /dev/null +++ b/src/deepgram/proxy/adapters/fastapi.py @@ -0,0 +1,98 @@ +"""FastAPI adapter for the Deepgram proxy.""" + +from typing import TYPE_CHECKING + +from ..errors import ProxyError + +if TYPE_CHECKING: + from ..engine import DeepgramProxy + from fastapi import APIRouter + + +def create_deepgram_router(proxy: "DeepgramProxy") -> "APIRouter": + """Create a FastAPI APIRouter that proxies requests to Deepgram. + + Usage:: + + from fastapi import FastAPI + from deepgram.proxy import DeepgramProxy + from deepgram.proxy.adapters.fastapi import create_deepgram_router + + proxy = DeepgramProxy(api_key="dg-xxx") + app = FastAPI() + app.include_router(create_deepgram_router(proxy), prefix="/deepgram") + """ + from fastapi import APIRouter, Request, Response, WebSocket, WebSocketDisconnect + + router = APIRouter() + + @router.api_route("/{path:path}", methods=["GET", "POST", "PUT", "PATCH", "DELETE"]) + async def proxy_rest(request: Request, path: str) -> Response: + full_path = f"/{path}" + authorization = request.headers.get("authorization") + + try: + scopes = proxy.authenticate(authorization) + proxy.authorize(full_path, scopes) + except ProxyError as exc: + return Response(content=exc.message, status_code=exc.status_code) + + headers = dict(request.headers) + body = await request.body() + query_string = str(request.query_params) + + try: + status, resp_headers, resp_body = await proxy.forward_rest_async( + method=request.method, + path=full_path, + headers=headers, + query_string=query_string, + body=body, + ) + except ProxyError as exc: + return Response(content=exc.message, status_code=exc.status_code) + + return Response(content=resp_body, status_code=status, headers=resp_headers) + + @router.websocket("/{path:path}") + async def proxy_websocket(ws: WebSocket, path: str) -> None: + full_path = f"/{path}" + + # Extract subprotocol from Sec-WebSocket-Protocol header + subprotocol = ws.headers.get("sec-websocket-protocol") + + await ws.accept(subprotocol=subprotocol) + + async def client_receive(): + try: + data = await ws.receive() + if data.get("type") == "websocket.disconnect": + return None + return data.get("text") or data.get("bytes") + except WebSocketDisconnect: + return None + + async def client_send(msg): + if isinstance(msg, bytes): + await ws.send_bytes(msg) + else: + await ws.send_text(str(msg)) + + async def client_close(code: int, reason: str = ""): + try: + await ws.close(code=code, reason=reason) + except Exception: + pass + + query_string = str(ws.query_params) + + await proxy.forward_websocket( + path=full_path, + query_string=query_string, + client_receive=client_receive, + client_send=client_send, + client_close=client_close, + subprotocol=subprotocol, + ) + + return router diff --git a/src/deepgram/proxy/adapters/flask.py b/src/deepgram/proxy/adapters/flask.py new file mode 100644 index 00000000..d08dbac6 --- /dev/null +++ b/src/deepgram/proxy/adapters/flask.py @@ -0,0 +1,111 @@ +"""Flask adapter for the Deepgram proxy.""" + +import asyncio +from typing import TYPE_CHECKING + +from ..errors import ProxyError + +if TYPE_CHECKING: + from ..engine import DeepgramProxy + from flask import Blueprint + + +def create_deepgram_blueprint(proxy: "DeepgramProxy") -> "Blueprint": + """Create a Flask Blueprint that proxies requests to Deepgram. + + REST requests use synchronous forwarding. WebSocket support requires + ``flask-sock`` (``pip install flask-sock``). + + Usage:: + + from flask import Flask + from deepgram.proxy import DeepgramProxy + from deepgram.proxy.adapters.flask import create_deepgram_blueprint + + proxy = DeepgramProxy(api_key="dg-xxx") + app = Flask(__name__) + app.register_blueprint(create_deepgram_blueprint(proxy), url_prefix="/deepgram") + """ + from flask import Blueprint, Response, request + + bp = Blueprint("deepgram_proxy", __name__) + + @bp.route("/", methods=["GET", "POST", "PUT", "PATCH", "DELETE"]) + def proxy_rest(path: str) -> Response: + full_path = f"/{path}" + authorization = request.headers.get("Authorization") + + try: + scopes = proxy.authenticate(authorization) + proxy.authorize(full_path, scopes) + except ProxyError as exc: + return Response(exc.message, status=exc.status_code) + + headers = dict(request.headers) + body = request.get_data() + query_string = request.query_string.decode("utf-8") + + try: + status, resp_headers, resp_body = proxy.forward_rest_sync( + method=request.method, + path=full_path, + headers=headers, + query_string=query_string, + body=body, + ) + except ProxyError as exc: + return Response(exc.message, status=exc.status_code) + + return Response(resp_body, status=status, headers=resp_headers) + + # Optional WebSocket support via flask-sock + try: + from flask_sock import Sock + + sock = Sock() + + @sock.route("/", bp=bp) + def proxy_websocket(ws, path: str) -> None: # type: ignore[no-untyped-def] + full_path = f"/{path}" + + # flask-sock doesn't expose subprotocol headers easily; + # read from the underlying environ + subprotocol = ws.environ.get("HTTP_SEC_WEBSOCKET_PROTOCOL") + query_string = ws.environ.get("QUERY_STRING", "") + + loop = asyncio.new_event_loop() + + async def client_receive(): + try: + data = await loop.run_in_executor(None, ws.receive) + return data + except Exception: + return None + + async def client_send(msg): + await loop.run_in_executor(None, ws.send, msg) + + async def client_close(code: int, reason: str = ""): + try: + await loop.run_in_executor(None, ws.close, code, reason) + except Exception: + pass + + try: + loop.run_until_complete( + proxy.forward_websocket( + path=full_path, + query_string=query_string, + client_receive=client_receive, + client_send=client_send, + client_close=client_close, + subprotocol=subprotocol, + ) + ) + finally: + loop.close() + + except ImportError: + pass # flask-sock not installed; WS support unavailable + + return bp diff --git a/src/deepgram/proxy/engine.py b/src/deepgram/proxy/engine.py new file mode 100644 index 00000000..119d5f91 --- /dev/null +++ b/src/deepgram/proxy/engine.py @@ -0,0 +1,355 @@ +"""Core proxy engine for forwarding requests to Deepgram.""" + +import asyncio +import os +from typing import Any, Callable, Dict, List, Optional, Tuple + +import httpx +from .errors import AuthenticationError, AuthorizationError, UpstreamError +from .scopes import Scope, get_target_base_url, path_matches_any_scope + +# Headers that should not be forwarded to upstream +_HOP_BY_HOP = frozenset( + { + "connection", + "keep-alive", + "proxy-authenticate", + "proxy-authorization", + "te", + "trailers", + "transfer-encoding", + "upgrade", + "host", + "authorization", + } +) + +# Default max body size: 200 MB +_DEFAULT_MAX_BODY = 200 * 1024 * 1024 + + +class DeepgramProxy: + """Proxy that authenticates clients and forwards requests to Deepgram. + + Args: + api_key: Deepgram API key. Falls back to ``DEEPGRAM_API_KEY`` env var. + require_auth: If True (default), requests must carry a valid JWT. + production_url: Override the default ``https://api.deepgram.com`` base URL. + agent_url: Override the default ``https://agent.deepgram.com`` base URL. + timeout: HTTP timeout in seconds for upstream requests. + max_body_size: Maximum request body size in bytes. + """ + + def __init__( + self, + api_key: Optional[str] = None, + *, + require_auth: bool = True, + production_url: Optional[str] = None, + agent_url: Optional[str] = None, + timeout: float = 60.0, + max_body_size: int = _DEFAULT_MAX_BODY, + ): + resolved_key = api_key or os.environ.get("DEEPGRAM_API_KEY", "") + if not resolved_key: + raise ValueError("api_key is required (or set DEEPGRAM_API_KEY env var)") + self.api_key: str = resolved_key + + self.require_auth = require_auth + self.production_url = production_url + self.agent_url = agent_url + self.timeout = timeout + self.max_body_size = max_body_size + + self._jwt_manager: Any = None + self._sync_client: Optional[httpx.Client] = None + self._async_client: Optional[httpx.AsyncClient] = None + + @property + def jwt_manager(self) -> Any: + """Lazily initialise the JWT manager (defers PyJWT import).""" + if self._jwt_manager is None: + from .jwt import JWTManager + + self._jwt_manager = JWTManager(self.api_key) + return self._jwt_manager + + # ------------------------------------------------------------------ + # Token helpers + # ------------------------------------------------------------------ + + def create_token(self, scopes: List[Scope], expires_in: int = 3600) -> str: + """Create a signed JWT for client-side use. + + Args: + scopes: Scopes the token grants (e.g. ``[Scope.LISTEN, Scope.SPEAK]``). + expires_in: Token lifetime in seconds. + + Returns: + Encoded JWT string. + """ + return self.jwt_manager.create_token(scopes, expires_in) + + # ------------------------------------------------------------------ + # Auth + # ------------------------------------------------------------------ + + def authenticate(self, authorization: Optional[str]) -> Optional[List[Scope]]: + """Validate a Bearer JWT from an Authorization header. + + Returns: + List of granted scopes, or None if auth is not required and no token + was provided. + + Raises: + AuthenticationError: If a token is required but missing/invalid. + """ + from .jwt import JWTManager + + token = JWTManager.extract_token_from_header(authorization) + + if token is None: + if self.require_auth: + raise AuthenticationError("Missing Authorization header") + return None + + try: + payload = self.jwt_manager.validate_token(token) + except Exception as exc: + raise AuthenticationError(f"Invalid token: {exc}") from exc + + return [Scope(s) for s in payload.scopes if s in Scope._value2member_map_] + + def authorize(self, path: str, scopes: Optional[List[Scope]]) -> None: + """Check that scopes permit accessing *path*. + + When *scopes* is None (unauthenticated, auth not required), access is + allowed to all paths. + + Raises: + AuthorizationError: If the token's scopes don't cover the path. + """ + if scopes is None: + return + if not path_matches_any_scope(path, scopes): + raise AuthorizationError(f"Token scopes {[s.value for s in scopes]} do not permit access to {path}") + + # ------------------------------------------------------------------ + # REST forwarding + # ------------------------------------------------------------------ + + def _prepare_upstream( + self, + method: str, + path: str, + headers: Dict[str, str], + query_string: str = "", + body: bytes = b"", + ) -> Tuple[str, Dict[str, str], str]: + """Build the upstream URL and sanitised headers.""" + base = get_target_base_url(path, self.production_url, self.agent_url) + url = f"{base}{path}" + if query_string: + url = f"{url}?{query_string}" + + out_headers: Dict[str, str] = {} + for k, v in headers.items(): + if k.lower() not in _HOP_BY_HOP: + out_headers[k] = v + out_headers["Authorization"] = f"Token {self.api_key}" + + return url, out_headers, method.upper() + + def forward_rest_sync( + self, + method: str, + path: str, + headers: Dict[str, str], + query_string: str = "", + body: bytes = b"", + ) -> Tuple[int, Dict[str, str], bytes]: + """Synchronously forward an HTTP request to Deepgram. + + Returns: + ``(status_code, response_headers, response_body)`` + """ + url, out_headers, method = self._prepare_upstream(method, path, headers, query_string, body) + + if self._sync_client is None: + self._sync_client = httpx.Client(timeout=self.timeout) + + try: + resp = self._sync_client.request(method, url, headers=out_headers, content=body) + except httpx.ConnectError as exc: + raise UpstreamError("Failed to connect to Deepgram", status_code=502, detail=str(exc)) from exc + except httpx.TimeoutException as exc: + raise UpstreamError("Upstream request timed out", status_code=504, detail=str(exc)) from exc + + resp_headers = dict(resp.headers) + # Remove hop-by-hop from response too + for h in ("transfer-encoding", "connection"): + resp_headers.pop(h, None) + + return resp.status_code, resp_headers, resp.content + + async def forward_rest_async( + self, + method: str, + path: str, + headers: Dict[str, str], + query_string: str = "", + body: bytes = b"", + ) -> Tuple[int, Dict[str, str], bytes]: + """Asynchronously forward an HTTP request to Deepgram. + + Returns: + ``(status_code, response_headers, response_body)`` + """ + url, out_headers, method = self._prepare_upstream(method, path, headers, query_string, body) + + if self._async_client is None: + self._async_client = httpx.AsyncClient(timeout=self.timeout) + + try: + resp = await self._async_client.request(method, url, headers=out_headers, content=body) + except httpx.ConnectError as exc: + raise UpstreamError("Failed to connect to Deepgram", status_code=502, detail=str(exc)) from exc + except httpx.TimeoutException as exc: + raise UpstreamError("Upstream request timed out", status_code=504, detail=str(exc)) from exc + + resp_headers = dict(resp.headers) + for h in ("transfer-encoding", "connection"): + resp_headers.pop(h, None) + + return resp.status_code, resp_headers, resp.content + + # ------------------------------------------------------------------ + # WebSocket forwarding + # ------------------------------------------------------------------ + + async def forward_websocket( + self, + path: str, + query_string: str, + client_receive: Callable, + client_send: Callable, + client_close: Callable, + subprotocol: Optional[str] = None, + ) -> None: + """Bidirectional WebSocket relay between client and Deepgram. + + Auth is handled via the ``subprotocol`` value: + - ``"proxy,"`` — validate JWT, connect upstream with ``token,`` + - ``"token,"`` / ``"bearer,"`` — passthrough to Deepgram + - None + require_auth → close 4003 + + Args: + path: The API path (e.g. ``/v1/listen``). + query_string: URL query string to forward. + client_receive: Async callable that returns the next message from the client. + client_send: Async callable that sends a message to the client. + client_close: Async callable that closes the client connection, accepts (code, reason). + subprotocol: The ``Sec-WebSocket-Protocol`` value from the handshake. + """ + try: + import websockets + except ImportError: + raise ImportError( + "The 'websockets' package is required for WebSocket proxying. " + "Install it with: pip install websockets" + ) + + upstream_subprotocol: Optional[str] = None + scopes: Optional[List[Scope]] = None + + if subprotocol: + if subprotocol.startswith("proxy,"): + token = subprotocol[len("proxy,") :] + try: + payload = self.jwt_manager.validate_token(token) + except Exception: + await client_close(4003, "Invalid token") + return + + scopes = [Scope(s) for s in payload.scopes if s in Scope._value2member_map_] + try: + self.authorize(path, scopes) + except AuthorizationError: + await client_close(4003, "Insufficient scope") + return + + upstream_subprotocol = f"token,{self.api_key}" + + elif subprotocol.startswith(("token,", "bearer,")): + # Direct passthrough — forward the client's subprotocol as-is + upstream_subprotocol = subprotocol + else: + if self.require_auth: + await client_close(4003, "Unrecognised subprotocol") + return + else: + if self.require_auth: + await client_close(4003, "Authentication required") + return + + base = get_target_base_url(path, self.production_url, self.agent_url) + ws_base = base.replace("https://", "wss://").replace("http://", "ws://") + upstream_url = f"{ws_base}{path}" + if query_string: + upstream_url = f"{upstream_url}?{query_string}" + + extra_headers = {"Authorization": f"Token {self.api_key}"} + + connect_kwargs: dict = { + "additional_headers": extra_headers, + } + if upstream_subprotocol: + connect_kwargs["subprotocols"] = [upstream_subprotocol] + + try: + async with websockets.connect(upstream_url, **connect_kwargs) as upstream: + + async def client_to_upstream() -> None: + try: + while True: + msg = await client_receive() + if msg is None: + break + await upstream.send(msg) + except Exception: + pass + + async def upstream_to_client() -> None: + try: + async for msg in upstream: + await client_send(msg) + except Exception: + pass + + tasks = [ + asyncio.create_task(client_to_upstream()), + asyncio.create_task(upstream_to_client()), + ] + # Wait until either side disconnects, then cancel the other + done, pending = await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED) + for t in pending: + t.cancel() + + except Exception as exc: + await client_close(1011, f"Proxy error: {exc}") + + # ------------------------------------------------------------------ + # Cleanup + # ------------------------------------------------------------------ + + def close(self) -> None: + """Close the synchronous HTTP client.""" + if self._sync_client: + self._sync_client.close() + self._sync_client = None + + async def aclose(self) -> None: + """Close the asynchronous HTTP client.""" + if self._async_client: + await self._async_client.aclose() + self._async_client = None diff --git a/src/deepgram/proxy/errors.py b/src/deepgram/proxy/errors.py new file mode 100644 index 00000000..f8f8f535 --- /dev/null +++ b/src/deepgram/proxy/errors.py @@ -0,0 +1,32 @@ +"""Exception classes for the Deepgram proxy.""" + + +class ProxyError(Exception): + """Base exception for proxy errors.""" + + def __init__(self, message: str, status_code: int = 500, detail: str = ""): + self.message = message + self.status_code = status_code + self.detail = detail + super().__init__(message) + + +class AuthenticationError(ProxyError): + """Raised when JWT is missing, invalid, or expired.""" + + def __init__(self, message: str = "Authentication required", detail: str = ""): + super().__init__(message=message, status_code=401, detail=detail) + + +class AuthorizationError(ProxyError): + """Raised when the token's scopes don't permit the requested path.""" + + def __init__(self, message: str = "Insufficient scope", detail: str = ""): + super().__init__(message=message, status_code=403, detail=detail) + + +class UpstreamError(ProxyError): + """Raised when Deepgram returns an error or is unreachable.""" + + def __init__(self, message: str = "Upstream error", status_code: int = 502, detail: str = ""): + super().__init__(message=message, status_code=status_code, detail=detail) diff --git a/src/deepgram/proxy/jwt.py b/src/deepgram/proxy/jwt.py new file mode 100644 index 00000000..7eb47c9a --- /dev/null +++ b/src/deepgram/proxy/jwt.py @@ -0,0 +1,86 @@ +"""JWT creation and validation for the Deepgram proxy. + +Uses HMAC-SHA256 with the Deepgram API key as the signing secret. +Requires PyJWT (``pip install PyJWT``). +""" + +import time +import uuid +from typing import List, NamedTuple, Optional + +try: + import jwt as pyjwt +except ImportError: + raise ImportError( + "PyJWT is required for proxy JWT support. " + "Install it with: pip install 'deepgram-sdk[proxy]' or pip install PyJWT" + ) + +from .scopes import Scope + + +class TokenPayload(NamedTuple): + """Decoded JWT payload.""" + + scopes: List[str] + exp: int + iat: int + jti: str + + +class JWTManager: + """Creates and validates HMAC-SHA256 JWTs signed with the Deepgram API key.""" + + def __init__(self, api_key: str): + self._secret = api_key + + def create_token(self, scopes: List[Scope], expires_in: int = 3600) -> str: + """Create a signed JWT with the given scopes. + + Args: + scopes: List of Scope values the token is permitted to use. + expires_in: Token lifetime in seconds (default 3600). + + Returns: + Encoded JWT string. + """ + now = int(time.time()) + payload = { + "scopes": [s.value if isinstance(s, Scope) else s for s in scopes], + "iat": now, + "exp": now + expires_in, + "jti": str(uuid.uuid4()), + } + return pyjwt.encode(payload, self._secret, algorithm="HS256") + + def validate_token(self, token: str) -> TokenPayload: + """Validate a JWT and return its payload. + + Raises: + jwt.ExpiredSignatureError: If the token has expired. + jwt.InvalidTokenError: If the token is malformed or signature is invalid. + """ + data = pyjwt.decode(token, self._secret, algorithms=["HS256"]) + return TokenPayload( + scopes=data.get("scopes", []), + exp=data["exp"], + iat=data["iat"], + jti=data["jti"], + ) + + @staticmethod + def extract_token_from_header(authorization: Optional[str]) -> Optional[str]: + """Extract a bearer token from an Authorization header value. + + Args: + authorization: The full header value, e.g. ``"Bearer "``. + + Returns: + The token string, or None if the header is missing/malformed. + """ + if not authorization: + return None + parts = authorization.split(None, 1) + if len(parts) == 2 and parts[0].lower() == "bearer": + return parts[1] + return None diff --git a/src/deepgram/proxy/scopes.py b/src/deepgram/proxy/scopes.py new file mode 100644 index 00000000..27bc34ad --- /dev/null +++ b/src/deepgram/proxy/scopes.py @@ -0,0 +1,73 @@ +"""Scope definitions and path matching for the Deepgram proxy.""" + +import re +from enum import Enum +from typing import List, Optional + + +class Scope(str, Enum): + """Scopes that can be granted to proxy JWT tokens.""" + + LISTEN = "listen" + SPEAK = "speak" + READ = "read" + AGENT = "agent" + MANAGE = "manage" + SELF_HOSTED = "self_hosted" + + +# Maps each scope to regex patterns that match permitted API paths. +# Patterns use v\d+ to be version-agnostic. +SCOPE_PATH_PATTERNS: dict = { + Scope.LISTEN: [ + re.compile(r"^/v\d+/listen"), + ], + Scope.SPEAK: [ + re.compile(r"^/v\d+/speak"), + ], + Scope.READ: [ + re.compile(r"^/v\d+/read"), + ], + Scope.AGENT: [ + re.compile(r"^/v\d+/agent"), + ], + Scope.MANAGE: [ + re.compile(r"^/v\d+/projects"), + re.compile(r"^/v\d+/keys"), + re.compile(r"^/v\d+/members"), + re.compile(r"^/v\d+/scopes"), + re.compile(r"^/v\d+/invitations"), + re.compile(r"^/v\d+/usage"), + re.compile(r"^/v\d+/billing"), + re.compile(r"^/v\d+/balances"), + re.compile(r"^/v\d+/models"), + ], + Scope.SELF_HOSTED: [ + re.compile(r"^/v\d+/onprem"), + re.compile(r"^/v\d+/selfhosted"), + ], +} + +# Paths routed to agent.deepgram.com instead of api.deepgram.com +_AGENT_PATH_PATTERN = re.compile(r"^/v\d+/agent") + + +def path_matches_scope(path: str, scope: Scope) -> bool: + """Check if a request path is permitted by a single scope.""" + patterns = SCOPE_PATH_PATTERNS.get(scope, []) + return any(p.search(path) for p in patterns) + + +def path_matches_any_scope(path: str, scopes: List[Scope]) -> bool: + """Check if a request path is permitted by any of the given scopes.""" + return any(path_matches_scope(path, s) for s in scopes) + + +def get_target_base_url(path: str, production_url: Optional[str] = None, agent_url: Optional[str] = None) -> str: + """Return the upstream Deepgram base URL for a given path. + + Agent paths route to agent.deepgram.com; everything else to api.deepgram.com. + """ + if _AGENT_PATH_PATTERN.search(path): + return agent_url or "https://agent.deepgram.com" + return production_url or "https://api.deepgram.com" diff --git a/src/deepgram/read/client.py b/src/deepgram/read/client.py index 68928cbe..e5e5353a 100644 --- a/src/deepgram/read/client.py +++ b/src/deepgram/read/client.py @@ -5,7 +5,6 @@ import typing from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawReadClient, RawReadClient if typing.TYPE_CHECKING: from .v1.client import AsyncV1Client, V1Client @@ -13,21 +12,9 @@ class ReadClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawReadClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[V1Client] = None - @property - def with_raw_response(self) -> RawReadClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawReadClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: @@ -39,21 +26,9 @@ def v1(self): class AsyncReadClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawReadClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[AsyncV1Client] = None - @property - def with_raw_response(self) -> AsyncRawReadClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawReadClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: diff --git a/src/deepgram/read/raw_client.py b/src/deepgram/read/raw_client.py deleted file mode 100644 index 56b6fbd4..00000000 --- a/src/deepgram/read/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawReadClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawReadClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/read/v1/client.py b/src/deepgram/read/v1/client.py index 7eb091c0..5947abd3 100644 --- a/src/deepgram/read/v1/client.py +++ b/src/deepgram/read/v1/client.py @@ -5,7 +5,6 @@ import typing from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawV1Client, RawV1Client if typing.TYPE_CHECKING: from .text.client import AsyncTextClient, TextClient @@ -13,21 +12,9 @@ class V1Client: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._text: typing.Optional[TextClient] = None - @property - def with_raw_response(self) -> RawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawV1Client - """ - return self._raw_client - @property def text(self): if self._text is None: @@ -39,21 +26,9 @@ def text(self): class AsyncV1Client: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._text: typing.Optional[AsyncTextClient] = None - @property - def with_raw_response(self) -> AsyncRawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawV1Client - """ - return self._raw_client - @property def text(self): if self._text is None: diff --git a/src/deepgram/read/v1/raw_client.py b/src/deepgram/read/v1/raw_client.py deleted file mode 100644 index 82da8718..00000000 --- a/src/deepgram/read/v1/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawV1Client: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawV1Client: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/read/v1/text/raw_client.py b/src/deepgram/read/v1/text/raw_client.py index cdfc5f32..2e8de545 100644 --- a/src/deepgram/read/v1/text/raw_client.py +++ b/src/deepgram/read/v1/text/raw_client.py @@ -96,7 +96,6 @@ def analyze( """ _response = self._client_wrapper.httpx_client.request( "v1/read", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "callback": callback, @@ -223,7 +222,6 @@ async def analyze( """ _response = await self._client_wrapper.httpx_client.request( "v1/read", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "callback": callback, diff --git a/src/deepgram/requests/__init__.py b/src/deepgram/requests/__init__.py index 0a34f380..97de54c2 100644 --- a/src/deepgram/requests/__init__.py +++ b/src/deepgram/requests/__init__.py @@ -128,7 +128,6 @@ from .listen_v1response_results_utterances_item_words_item import ( ListenV1ResponseResultsUtterancesItemWordsItemParams, ) - from .listen_v2keyterm import ListenV2KeytermParams from .project_request_response import ProjectRequestResponseParams from .read_v1request import ReadV1RequestParams from .read_v1request_text import ReadV1RequestTextParams @@ -260,7 +259,6 @@ "ListenV1ResponseResultsUtterancesItemParams": ".listen_v1response_results_utterances_item", "ListenV1ResponseResultsUtterancesItemWordsItemParams": ".listen_v1response_results_utterances_item_words_item", "ListenV1ResponseResultsUtterancesParams": ".listen_v1response_results_utterances", - "ListenV2KeytermParams": ".listen_v2keyterm", "ProjectRequestResponseParams": ".project_request_response", "ReadV1RequestParams": ".read_v1request", "ReadV1RequestTextParams": ".read_v1request_text", @@ -412,7 +410,6 @@ def __dir__(): "ListenV1ResponseResultsUtterancesItemParams", "ListenV1ResponseResultsUtterancesItemWordsItemParams", "ListenV1ResponseResultsUtterancesParams", - "ListenV2KeytermParams", "ProjectRequestResponseParams", "ReadV1RequestParams", "ReadV1RequestTextParams", diff --git a/src/deepgram/requests/listen_v2keyterm.py b/src/deepgram/requests/listen_v2keyterm.py deleted file mode 100644 index cedd7a94..00000000 --- a/src/deepgram/requests/listen_v2keyterm.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2KeytermParams = typing.Union[str, typing.Sequence[str]] diff --git a/src/deepgram/self_hosted/client.py b/src/deepgram/self_hosted/client.py index 3d7a7b0f..2be1cdda 100644 --- a/src/deepgram/self_hosted/client.py +++ b/src/deepgram/self_hosted/client.py @@ -5,7 +5,6 @@ import typing from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawSelfHostedClient, RawSelfHostedClient if typing.TYPE_CHECKING: from .v1.client import AsyncV1Client, V1Client @@ -13,21 +12,9 @@ class SelfHostedClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawSelfHostedClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[V1Client] = None - @property - def with_raw_response(self) -> RawSelfHostedClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawSelfHostedClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: @@ -39,21 +26,9 @@ def v1(self): class AsyncSelfHostedClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawSelfHostedClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[AsyncV1Client] = None - @property - def with_raw_response(self) -> AsyncRawSelfHostedClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawSelfHostedClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: diff --git a/src/deepgram/self_hosted/raw_client.py b/src/deepgram/self_hosted/raw_client.py deleted file mode 100644 index 9b4645e1..00000000 --- a/src/deepgram/self_hosted/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawSelfHostedClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawSelfHostedClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/self_hosted/v1/client.py b/src/deepgram/self_hosted/v1/client.py index 789afc77..23513c2f 100644 --- a/src/deepgram/self_hosted/v1/client.py +++ b/src/deepgram/self_hosted/v1/client.py @@ -5,7 +5,6 @@ import typing from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawV1Client, RawV1Client if typing.TYPE_CHECKING: from .distribution_credentials.client import AsyncDistributionCredentialsClient, DistributionCredentialsClient @@ -13,21 +12,9 @@ class V1Client: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._distribution_credentials: typing.Optional[DistributionCredentialsClient] = None - @property - def with_raw_response(self) -> RawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawV1Client - """ - return self._raw_client - @property def distribution_credentials(self): if self._distribution_credentials is None: @@ -39,21 +26,9 @@ def distribution_credentials(self): class AsyncV1Client: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._distribution_credentials: typing.Optional[AsyncDistributionCredentialsClient] = None - @property - def with_raw_response(self) -> AsyncRawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawV1Client - """ - return self._raw_client - @property def distribution_credentials(self): if self._distribution_credentials is None: diff --git a/src/deepgram/self_hosted/v1/distribution_credentials/raw_client.py b/src/deepgram/self_hosted/v1/distribution_credentials/raw_client.py index 57b43ff8..9efc6ad5 100644 --- a/src/deepgram/self_hosted/v1/distribution_credentials/raw_client.py +++ b/src/deepgram/self_hosted/v1/distribution_credentials/raw_client.py @@ -44,7 +44,6 @@ def list( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/self-hosted/distribution/credentials", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -115,7 +114,6 @@ def create( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/self-hosted/distribution/credentials", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "scopes": scopes, @@ -184,7 +182,6 @@ def get( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/self-hosted/distribution/credentials/{jsonable_encoder(distribution_credentials_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -242,7 +239,6 @@ def delete( """ _response = self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/self-hosted/distribution/credentials/{jsonable_encoder(distribution_credentials_id)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) @@ -298,7 +294,6 @@ async def list( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/self-hosted/distribution/credentials", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -369,7 +364,6 @@ async def create( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/self-hosted/distribution/credentials", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "scopes": scopes, @@ -438,7 +432,6 @@ async def get( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/self-hosted/distribution/credentials/{jsonable_encoder(distribution_credentials_id)}", - base_url=self._client_wrapper.get_environment().base, method="GET", request_options=request_options, ) @@ -496,7 +489,6 @@ async def delete( """ _response = await self._client_wrapper.httpx_client.request( f"v1/projects/{jsonable_encoder(project_id)}/self-hosted/distribution/credentials/{jsonable_encoder(distribution_credentials_id)}", - base_url=self._client_wrapper.get_environment().base, method="DELETE", request_options=request_options, ) diff --git a/src/deepgram/self_hosted/v1/raw_client.py b/src/deepgram/self_hosted/v1/raw_client.py deleted file mode 100644 index 82da8718..00000000 --- a/src/deepgram/self_hosted/v1/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawV1Client: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawV1Client: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/speak/__init__.py b/src/deepgram/speak/__init__.py index 73eda24c..148ad154 100644 --- a/src/deepgram/speak/__init__.py +++ b/src/deepgram/speak/__init__.py @@ -7,53 +7,7 @@ if typing.TYPE_CHECKING: from . import v1 - from .v1 import ( - SpeakV1Clear, - SpeakV1ClearParams, - SpeakV1ClearType, - SpeakV1Cleared, - SpeakV1ClearedParams, - SpeakV1ClearedType, - SpeakV1Close, - SpeakV1CloseParams, - SpeakV1CloseType, - SpeakV1Flush, - SpeakV1FlushParams, - SpeakV1FlushType, - SpeakV1Flushed, - SpeakV1FlushedParams, - SpeakV1FlushedType, - SpeakV1Metadata, - SpeakV1MetadataParams, - SpeakV1Text, - SpeakV1TextParams, - SpeakV1Warning, - SpeakV1WarningParams, - ) -_dynamic_imports: typing.Dict[str, str] = { - "SpeakV1Clear": ".v1", - "SpeakV1ClearParams": ".v1", - "SpeakV1ClearType": ".v1", - "SpeakV1Cleared": ".v1", - "SpeakV1ClearedParams": ".v1", - "SpeakV1ClearedType": ".v1", - "SpeakV1Close": ".v1", - "SpeakV1CloseParams": ".v1", - "SpeakV1CloseType": ".v1", - "SpeakV1Flush": ".v1", - "SpeakV1FlushParams": ".v1", - "SpeakV1FlushType": ".v1", - "SpeakV1Flushed": ".v1", - "SpeakV1FlushedParams": ".v1", - "SpeakV1FlushedType": ".v1", - "SpeakV1Metadata": ".v1", - "SpeakV1MetadataParams": ".v1", - "SpeakV1Text": ".v1", - "SpeakV1TextParams": ".v1", - "SpeakV1Warning": ".v1", - "SpeakV1WarningParams": ".v1", - "v1": ".v1", -} +_dynamic_imports: typing.Dict[str, str] = {"v1": ".v1"} def __getattr__(attr_name: str) -> typing.Any: @@ -77,27 +31,4 @@ def __dir__(): return sorted(lazy_attrs) -__all__ = [ - "SpeakV1Clear", - "SpeakV1ClearParams", - "SpeakV1ClearType", - "SpeakV1Cleared", - "SpeakV1ClearedParams", - "SpeakV1ClearedType", - "SpeakV1Close", - "SpeakV1CloseParams", - "SpeakV1CloseType", - "SpeakV1Flush", - "SpeakV1FlushParams", - "SpeakV1FlushType", - "SpeakV1Flushed", - "SpeakV1FlushedParams", - "SpeakV1FlushedType", - "SpeakV1Metadata", - "SpeakV1MetadataParams", - "SpeakV1Text", - "SpeakV1TextParams", - "SpeakV1Warning", - "SpeakV1WarningParams", - "v1", -] +__all__ = ["v1"] diff --git a/src/deepgram/speak/client.py b/src/deepgram/speak/client.py index 4efefd5f..0f3a72bc 100644 --- a/src/deepgram/speak/client.py +++ b/src/deepgram/speak/client.py @@ -5,7 +5,6 @@ import typing from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .raw_client import AsyncRawSpeakClient, RawSpeakClient if typing.TYPE_CHECKING: from .v1.client import AsyncV1Client, V1Client @@ -13,21 +12,9 @@ class SpeakClient: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawSpeakClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[V1Client] = None - @property - def with_raw_response(self) -> RawSpeakClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawSpeakClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: @@ -39,21 +26,9 @@ def v1(self): class AsyncSpeakClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawSpeakClient(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._v1: typing.Optional[AsyncV1Client] = None - @property - def with_raw_response(self) -> AsyncRawSpeakClient: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawSpeakClient - """ - return self._raw_client - @property def v1(self): if self._v1 is None: diff --git a/src/deepgram/speak/raw_client.py b/src/deepgram/speak/raw_client.py deleted file mode 100644 index e63f7275..00000000 --- a/src/deepgram/speak/raw_client.py +++ /dev/null @@ -1,13 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper - - -class RawSpeakClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - -class AsyncRawSpeakClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper diff --git a/src/deepgram/speak/v1/__init__.py b/src/deepgram/speak/v1/__init__.py index c874ef09..40fff37f 100644 --- a/src/deepgram/speak/v1/__init__.py +++ b/src/deepgram/speak/v1/__init__.py @@ -6,21 +6,6 @@ from importlib import import_module if typing.TYPE_CHECKING: - from .types import ( - SpeakV1Clear, - SpeakV1ClearType, - SpeakV1Cleared, - SpeakV1ClearedType, - SpeakV1Close, - SpeakV1CloseType, - SpeakV1Flush, - SpeakV1FlushType, - SpeakV1Flushed, - SpeakV1FlushedType, - SpeakV1Metadata, - SpeakV1Text, - SpeakV1Warning, - ) from . import audio from .audio import ( AudioGenerateRequestCallbackMethod, @@ -28,42 +13,11 @@ AudioGenerateRequestEncoding, AudioGenerateRequestModel, ) - from .requests import ( - SpeakV1ClearParams, - SpeakV1ClearedParams, - SpeakV1CloseParams, - SpeakV1FlushParams, - SpeakV1FlushedParams, - SpeakV1MetadataParams, - SpeakV1TextParams, - SpeakV1WarningParams, - ) _dynamic_imports: typing.Dict[str, str] = { "AudioGenerateRequestCallbackMethod": ".audio", "AudioGenerateRequestContainer": ".audio", "AudioGenerateRequestEncoding": ".audio", "AudioGenerateRequestModel": ".audio", - "SpeakV1Clear": ".types", - "SpeakV1ClearParams": ".requests", - "SpeakV1ClearType": ".types", - "SpeakV1Cleared": ".types", - "SpeakV1ClearedParams": ".requests", - "SpeakV1ClearedType": ".types", - "SpeakV1Close": ".types", - "SpeakV1CloseParams": ".requests", - "SpeakV1CloseType": ".types", - "SpeakV1Flush": ".types", - "SpeakV1FlushParams": ".requests", - "SpeakV1FlushType": ".types", - "SpeakV1Flushed": ".types", - "SpeakV1FlushedParams": ".requests", - "SpeakV1FlushedType": ".types", - "SpeakV1Metadata": ".types", - "SpeakV1MetadataParams": ".requests", - "SpeakV1Text": ".types", - "SpeakV1TextParams": ".requests", - "SpeakV1Warning": ".types", - "SpeakV1WarningParams": ".requests", "audio": ".audio", } @@ -94,26 +48,5 @@ def __dir__(): "AudioGenerateRequestContainer", "AudioGenerateRequestEncoding", "AudioGenerateRequestModel", - "SpeakV1Clear", - "SpeakV1ClearParams", - "SpeakV1ClearType", - "SpeakV1Cleared", - "SpeakV1ClearedParams", - "SpeakV1ClearedType", - "SpeakV1Close", - "SpeakV1CloseParams", - "SpeakV1CloseType", - "SpeakV1Flush", - "SpeakV1FlushParams", - "SpeakV1FlushType", - "SpeakV1Flushed", - "SpeakV1FlushedParams", - "SpeakV1FlushedType", - "SpeakV1Metadata", - "SpeakV1MetadataParams", - "SpeakV1Text", - "SpeakV1TextParams", - "SpeakV1Warning", - "SpeakV1WarningParams", "audio", ] diff --git a/src/deepgram/speak/v1/audio/raw_client.py b/src/deepgram/speak/v1/audio/raw_client.py index 425c2daf..c1e63b0e 100644 --- a/src/deepgram/speak/v1/audio/raw_client.py +++ b/src/deepgram/speak/v1/audio/raw_client.py @@ -84,7 +84,6 @@ def generate( """ with self._client_wrapper.httpx_client.stream( "v1/speak", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "callback": callback, @@ -201,7 +200,6 @@ async def generate( """ async with self._client_wrapper.httpx_client.stream( "v1/speak", - base_url=self._client_wrapper.get_environment().base, method="POST", params={ "callback": callback, diff --git a/src/deepgram/speak/v1/client.py b/src/deepgram/speak/v1/client.py index 3cc0e7dc..eacfa234 100644 --- a/src/deepgram/speak/v1/client.py +++ b/src/deepgram/speak/v1/client.py @@ -3,112 +3,18 @@ from __future__ import annotations import typing -from contextlib import asynccontextmanager, contextmanager -import httpx -import websockets.exceptions -import websockets.sync.client as websockets_sync_client -from ...core.api_error import ApiError from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.request_options import RequestOptions -from .raw_client import AsyncRawV1Client, RawV1Client -from .socket_client import AsyncV1SocketClient, V1SocketClient if typing.TYPE_CHECKING: from .audio.client import AsyncAudioClient, AudioClient -try: - from websockets.legacy.client import connect as websockets_client_connect # type: ignore -except ImportError: - from websockets import connect as websockets_client_connect # type: ignore - class V1Client: def __init__(self, *, client_wrapper: SyncClientWrapper): - self._raw_client = RawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._audio: typing.Optional[AudioClient] = None - @property - def with_raw_response(self) -> RawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - RawV1Client - """ - return self._raw_client - - @contextmanager - def connect( - self, - *, - encoding: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - model: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Iterator[V1SocketClient]: - """ - Convert text into natural-sounding speech using Deepgram's TTS WebSocket - - Parameters - ---------- - encoding : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - model : typing.Optional[str] - - sample_rate : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - V1SocketClient - """ - ws_url = self._raw_client._client_wrapper.get_environment().production + "/v1/speak" - query_params = httpx.QueryParams() - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if model is not None: - query_params = query_params.add("model", model) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - ws_url = ws_url + f"?{query_params}" - headers = self._raw_client._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - with websockets_sync_client.connect(ws_url, additional_headers=headers) as protocol: - yield V1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - @property def audio(self): if self._audio is None: @@ -120,90 +26,9 @@ def audio(self): class AsyncV1Client: def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._raw_client = AsyncRawV1Client(client_wrapper=client_wrapper) self._client_wrapper = client_wrapper self._audio: typing.Optional[AsyncAudioClient] = None - @property - def with_raw_response(self) -> AsyncRawV1Client: - """ - Retrieves a raw implementation of this client that returns raw responses. - - Returns - ------- - AsyncRawV1Client - """ - return self._raw_client - - @asynccontextmanager - async def connect( - self, - *, - encoding: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - model: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.AsyncIterator[AsyncV1SocketClient]: - """ - Convert text into natural-sounding speech using Deepgram's TTS WebSocket - - Parameters - ---------- - encoding : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - model : typing.Optional[str] - - sample_rate : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncV1SocketClient - """ - ws_url = self._raw_client._client_wrapper.get_environment().production + "/v1/speak" - query_params = httpx.QueryParams() - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if model is not None: - query_params = query_params.add("model", model) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - ws_url = ws_url + f"?{query_params}" - headers = self._raw_client._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - async with websockets_client_connect(ws_url, extra_headers=headers) as protocol: - yield AsyncV1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - @property def audio(self): if self._audio is None: diff --git a/src/deepgram/speak/v1/raw_client.py b/src/deepgram/speak/v1/raw_client.py deleted file mode 100644 index ca69a44b..00000000 --- a/src/deepgram/speak/v1/raw_client.py +++ /dev/null @@ -1,165 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -from contextlib import asynccontextmanager, contextmanager - -import httpx -import websockets.exceptions -import websockets.sync.client as websockets_sync_client -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.request_options import RequestOptions -from .socket_client import AsyncV1SocketClient, V1SocketClient - -try: - from websockets.legacy.client import connect as websockets_client_connect # type: ignore -except ImportError: - from websockets import connect as websockets_client_connect # type: ignore - - -class RawV1Client: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - @contextmanager - def connect( - self, - *, - encoding: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - model: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.Iterator[V1SocketClient]: - """ - Convert text into natural-sounding speech using Deepgram's TTS WebSocket - - Parameters - ---------- - encoding : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - model : typing.Optional[str] - - sample_rate : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - V1SocketClient - """ - ws_url = self._client_wrapper.get_environment().production + "/v1/speak" - query_params = httpx.QueryParams() - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if model is not None: - query_params = query_params.add("model", model) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - ws_url = ws_url + f"?{query_params}" - headers = self._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - with websockets_sync_client.connect(ws_url, additional_headers=headers) as protocol: - yield V1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) - - -class AsyncRawV1Client: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - @asynccontextmanager - async def connect( - self, - *, - encoding: typing.Optional[str] = None, - mip_opt_out: typing.Optional[str] = None, - model: typing.Optional[str] = None, - sample_rate: typing.Optional[str] = None, - authorization: typing.Optional[str] = None, - request_options: typing.Optional[RequestOptions] = None, - ) -> typing.AsyncIterator[AsyncV1SocketClient]: - """ - Convert text into natural-sounding speech using Deepgram's TTS WebSocket - - Parameters - ---------- - encoding : typing.Optional[str] - - mip_opt_out : typing.Optional[str] - - model : typing.Optional[str] - - sample_rate : typing.Optional[str] - - authorization : typing.Optional[str] - Use your API key for authentication, or alternatively generate a [temporary token](/guides/fundamentals/token-based-authentication) and pass it via the `token` query parameter. - - **Example:** `token %DEEPGRAM_API_KEY%` or `bearer %DEEPGRAM_TOKEN%` - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - AsyncV1SocketClient - """ - ws_url = self._client_wrapper.get_environment().production + "/v1/speak" - query_params = httpx.QueryParams() - if encoding is not None: - query_params = query_params.add("encoding", encoding) - if mip_opt_out is not None: - query_params = query_params.add("mip_opt_out", mip_opt_out) - if model is not None: - query_params = query_params.add("model", model) - if sample_rate is not None: - query_params = query_params.add("sample_rate", sample_rate) - ws_url = ws_url + f"?{query_params}" - headers = self._client_wrapper.get_headers() - if authorization is not None: - headers["Authorization"] = str(authorization) - if request_options and "additional_headers" in request_options: - headers.update(request_options["additional_headers"]) - try: - async with websockets_client_connect(ws_url, extra_headers=headers) as protocol: - yield AsyncV1SocketClient(websocket=protocol) - except websockets.exceptions.InvalidStatusCode as exc: - status_code: int = exc.status_code - if status_code == 401: - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Websocket initialized with invalid credentials.", - ) - raise ApiError( - status_code=status_code, - headers=dict(headers), - body="Unexpected error when initializing websocket connection.", - ) diff --git a/src/deepgram/speak/v1/requests/__init__.py b/src/deepgram/speak/v1/requests/__init__.py deleted file mode 100644 index 4e8e1826..00000000 --- a/src/deepgram/speak/v1/requests/__init__.py +++ /dev/null @@ -1,59 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .speak_v1clear import SpeakV1ClearParams - from .speak_v1cleared import SpeakV1ClearedParams - from .speak_v1close import SpeakV1CloseParams - from .speak_v1flush import SpeakV1FlushParams - from .speak_v1flushed import SpeakV1FlushedParams - from .speak_v1metadata import SpeakV1MetadataParams - from .speak_v1text import SpeakV1TextParams - from .speak_v1warning import SpeakV1WarningParams -_dynamic_imports: typing.Dict[str, str] = { - "SpeakV1ClearParams": ".speak_v1clear", - "SpeakV1ClearedParams": ".speak_v1cleared", - "SpeakV1CloseParams": ".speak_v1close", - "SpeakV1FlushParams": ".speak_v1flush", - "SpeakV1FlushedParams": ".speak_v1flushed", - "SpeakV1MetadataParams": ".speak_v1metadata", - "SpeakV1TextParams": ".speak_v1text", - "SpeakV1WarningParams": ".speak_v1warning", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "SpeakV1ClearParams", - "SpeakV1ClearedParams", - "SpeakV1CloseParams", - "SpeakV1FlushParams", - "SpeakV1FlushedParams", - "SpeakV1MetadataParams", - "SpeakV1TextParams", - "SpeakV1WarningParams", -] diff --git a/src/deepgram/speak/v1/requests/speak_v1clear.py b/src/deepgram/speak/v1/requests/speak_v1clear.py deleted file mode 100644 index 6ffc2f3e..00000000 --- a/src/deepgram/speak/v1/requests/speak_v1clear.py +++ /dev/null @@ -1,11 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.speak_v1clear_type import SpeakV1ClearType - - -class SpeakV1ClearParams(typing_extensions.TypedDict): - type: SpeakV1ClearType - """ - Message type identifier - """ diff --git a/src/deepgram/speak/v1/requests/speak_v1cleared.py b/src/deepgram/speak/v1/requests/speak_v1cleared.py deleted file mode 100644 index e1f1784b..00000000 --- a/src/deepgram/speak/v1/requests/speak_v1cleared.py +++ /dev/null @@ -1,16 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.speak_v1cleared_type import SpeakV1ClearedType - - -class SpeakV1ClearedParams(typing_extensions.TypedDict): - type: SpeakV1ClearedType - """ - Message type identifier - """ - - sequence_id: float - """ - The sequence ID of the response - """ diff --git a/src/deepgram/speak/v1/requests/speak_v1close.py b/src/deepgram/speak/v1/requests/speak_v1close.py deleted file mode 100644 index 7a3219c3..00000000 --- a/src/deepgram/speak/v1/requests/speak_v1close.py +++ /dev/null @@ -1,11 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.speak_v1close_type import SpeakV1CloseType - - -class SpeakV1CloseParams(typing_extensions.TypedDict): - type: SpeakV1CloseType - """ - Message type identifier - """ diff --git a/src/deepgram/speak/v1/requests/speak_v1flush.py b/src/deepgram/speak/v1/requests/speak_v1flush.py deleted file mode 100644 index 8bafc736..00000000 --- a/src/deepgram/speak/v1/requests/speak_v1flush.py +++ /dev/null @@ -1,11 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.speak_v1flush_type import SpeakV1FlushType - - -class SpeakV1FlushParams(typing_extensions.TypedDict): - type: SpeakV1FlushType - """ - Message type identifier - """ diff --git a/src/deepgram/speak/v1/requests/speak_v1flushed.py b/src/deepgram/speak/v1/requests/speak_v1flushed.py deleted file mode 100644 index 674cb52d..00000000 --- a/src/deepgram/speak/v1/requests/speak_v1flushed.py +++ /dev/null @@ -1,16 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing_extensions -from ..types.speak_v1flushed_type import SpeakV1FlushedType - - -class SpeakV1FlushedParams(typing_extensions.TypedDict): - type: SpeakV1FlushedType - """ - Message type identifier - """ - - sequence_id: float - """ - The sequence ID of the response - """ diff --git a/src/deepgram/speak/v1/requests/speak_v1metadata.py b/src/deepgram/speak/v1/requests/speak_v1metadata.py deleted file mode 100644 index 89fb6809..00000000 --- a/src/deepgram/speak/v1/requests/speak_v1metadata.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class SpeakV1MetadataParams(typing_extensions.TypedDict): - type: typing.Literal["Metadata"] - """ - Message type identifier - """ - - request_id: str - """ - Unique identifier for the request - """ - - model_name: str - """ - Name of the model being used - """ - - model_version: str - """ - Version of the model being used - """ - - model_uuid: str - """ - Unique identifier for the model - """ diff --git a/src/deepgram/speak/v1/requests/speak_v1text.py b/src/deepgram/speak/v1/requests/speak_v1text.py deleted file mode 100644 index 78873194..00000000 --- a/src/deepgram/speak/v1/requests/speak_v1text.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class SpeakV1TextParams(typing_extensions.TypedDict): - type: typing.Literal["Speak"] - """ - Message type identifier - """ - - text: str - """ - The input text to be converted to speech - """ diff --git a/src/deepgram/speak/v1/requests/speak_v1warning.py b/src/deepgram/speak/v1/requests/speak_v1warning.py deleted file mode 100644 index ca6c78f8..00000000 --- a/src/deepgram/speak/v1/requests/speak_v1warning.py +++ /dev/null @@ -1,22 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions - - -class SpeakV1WarningParams(typing_extensions.TypedDict): - type: typing.Literal["Warning"] - """ - Message type identifier - """ - - description: str - """ - A description of what went wrong - """ - - code: str - """ - Error code identifying the type of error - """ diff --git a/src/deepgram/speak/v1/socket_client.py b/src/deepgram/speak/v1/socket_client.py deleted file mode 100644 index 20ccecfc..00000000 --- a/src/deepgram/speak/v1/socket_client.py +++ /dev/null @@ -1,203 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import json -import typing -from json.decoder import JSONDecodeError - -import websockets -import websockets.sync.connection as websockets_sync_connection -from ...core.events import EventEmitterMixin, EventType -from ...core.pydantic_utilities import parse_obj_as -from .types.speak_v1clear import SpeakV1Clear -from .types.speak_v1cleared import SpeakV1Cleared -from .types.speak_v1close import SpeakV1Close -from .types.speak_v1flush import SpeakV1Flush -from .types.speak_v1flushed import SpeakV1Flushed -from .types.speak_v1metadata import SpeakV1Metadata -from .types.speak_v1text import SpeakV1Text -from .types.speak_v1warning import SpeakV1Warning - -try: - from websockets.legacy.client import WebSocketClientProtocol # type: ignore -except ImportError: - from websockets import WebSocketClientProtocol # type: ignore - -V1SocketClientResponse = typing.Union[bytes, SpeakV1Metadata, SpeakV1Flushed, SpeakV1Cleared, SpeakV1Warning] - - -class AsyncV1SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: WebSocketClientProtocol): - super().__init__() - self._websocket = websocket - - async def __aiter__(self): - async for message in self._websocket: - if isinstance(message, bytes): - yield message - else: - yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore - - async def start_listening(self): - """ - Start listening for messages on the websocket connection. - - Emits events in the following order: - - EventType.OPEN when connection is established - - EventType.MESSAGE for each message received - - EventType.ERROR if an error occurs - - EventType.CLOSE when connection is closed - """ - await self._emit_async(EventType.OPEN, None) - try: - async for raw_message in self._websocket: - if isinstance(raw_message, bytes): - await self._emit_async(EventType.MESSAGE, raw_message) - else: - json_data = json.loads(raw_message) - parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - await self._emit_async(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: - await self._emit_async(EventType.ERROR, exc) - finally: - await self._emit_async(EventType.CLOSE, None) - - async def send_text(self, message: SpeakV1Text) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a SpeakV1Text. - """ - await self._send_model(message) - - async def send_flush(self, message: SpeakV1Flush) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a SpeakV1Flush. - """ - await self._send_model(message) - - async def send_clear(self, message: SpeakV1Clear) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a SpeakV1Clear. - """ - await self._send_model(message) - - async def send_close(self, message: SpeakV1Close) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a SpeakV1Close. - """ - await self._send_model(message) - - async def recv(self) -> V1SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = await self._websocket.recv() - if isinstance(data, bytes): - return data # Binary audio data - json_data = json.loads(data) - return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - - async def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - await self._websocket.send(data) - - async def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - await self._send(data.dict()) - - -class V1SocketClient(EventEmitterMixin): - def __init__(self, *, websocket: websockets_sync_connection.Connection): - super().__init__() - self._websocket = websocket - - def __iter__(self): - for message in self._websocket: - if isinstance(message, bytes): - yield message - else: - yield parse_obj_as(V1SocketClientResponse, json.loads(message)) # type: ignore - - def start_listening(self): - """ - Start listening for messages on the websocket connection. - - Emits events in the following order: - - EventType.OPEN when connection is established - - EventType.MESSAGE for each message received - - EventType.ERROR if an error occurs - - EventType.CLOSE when connection is closed - """ - self._emit(EventType.OPEN, None) - try: - for raw_message in self._websocket: - if isinstance(raw_message, bytes): - self._emit(EventType.MESSAGE, raw_message) - else: - json_data = json.loads(raw_message) - parsed = parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - self._emit(EventType.MESSAGE, parsed) - except (websockets.WebSocketException, JSONDecodeError) as exc: - self._emit(EventType.ERROR, exc) - finally: - self._emit(EventType.CLOSE, None) - - def send_text(self, message: SpeakV1Text) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a SpeakV1Text. - """ - self._send_model(message) - - def send_flush(self, message: SpeakV1Flush) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a SpeakV1Flush. - """ - self._send_model(message) - - def send_clear(self, message: SpeakV1Clear) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a SpeakV1Clear. - """ - self._send_model(message) - - def send_close(self, message: SpeakV1Close) -> None: - """ - Send a message to the websocket connection. - The message will be sent as a SpeakV1Close. - """ - self._send_model(message) - - def recv(self) -> V1SocketClientResponse: - """ - Receive a message from the websocket connection. - """ - data = self._websocket.recv() - if isinstance(data, bytes): - return data # Binary audio data - json_data = json.loads(data) - return parse_obj_as(V1SocketClientResponse, json_data) # type: ignore - - def _send(self, data: typing.Any) -> None: - """ - Send a message to the websocket connection. - """ - if isinstance(data, dict): - data = json.dumps(data) - self._websocket.send(data) - - def _send_model(self, data: typing.Any) -> None: - """ - Send a Pydantic model to the websocket connection. - """ - self._send(data.dict()) diff --git a/src/deepgram/speak/v1/types/__init__.py b/src/deepgram/speak/v1/types/__init__.py deleted file mode 100644 index 72a25d1b..00000000 --- a/src/deepgram/speak/v1/types/__init__.py +++ /dev/null @@ -1,74 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -# isort: skip_file - -import typing -from importlib import import_module - -if typing.TYPE_CHECKING: - from .speak_v1clear import SpeakV1Clear - from .speak_v1clear_type import SpeakV1ClearType - from .speak_v1cleared import SpeakV1Cleared - from .speak_v1cleared_type import SpeakV1ClearedType - from .speak_v1close import SpeakV1Close - from .speak_v1close_type import SpeakV1CloseType - from .speak_v1flush import SpeakV1Flush - from .speak_v1flush_type import SpeakV1FlushType - from .speak_v1flushed import SpeakV1Flushed - from .speak_v1flushed_type import SpeakV1FlushedType - from .speak_v1metadata import SpeakV1Metadata - from .speak_v1text import SpeakV1Text - from .speak_v1warning import SpeakV1Warning -_dynamic_imports: typing.Dict[str, str] = { - "SpeakV1Clear": ".speak_v1clear", - "SpeakV1ClearType": ".speak_v1clear_type", - "SpeakV1Cleared": ".speak_v1cleared", - "SpeakV1ClearedType": ".speak_v1cleared_type", - "SpeakV1Close": ".speak_v1close", - "SpeakV1CloseType": ".speak_v1close_type", - "SpeakV1Flush": ".speak_v1flush", - "SpeakV1FlushType": ".speak_v1flush_type", - "SpeakV1Flushed": ".speak_v1flushed", - "SpeakV1FlushedType": ".speak_v1flushed_type", - "SpeakV1Metadata": ".speak_v1metadata", - "SpeakV1Text": ".speak_v1text", - "SpeakV1Warning": ".speak_v1warning", -} - - -def __getattr__(attr_name: str) -> typing.Any: - module_name = _dynamic_imports.get(attr_name) - if module_name is None: - raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") - try: - module = import_module(module_name, __package__) - if module_name == f".{attr_name}": - return module - else: - return getattr(module, attr_name) - except ImportError as e: - raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e - except AttributeError as e: - raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e - - -def __dir__(): - lazy_attrs = list(_dynamic_imports.keys()) - return sorted(lazy_attrs) - - -__all__ = [ - "SpeakV1Clear", - "SpeakV1ClearType", - "SpeakV1Cleared", - "SpeakV1ClearedType", - "SpeakV1Close", - "SpeakV1CloseType", - "SpeakV1Flush", - "SpeakV1FlushType", - "SpeakV1Flushed", - "SpeakV1FlushedType", - "SpeakV1Metadata", - "SpeakV1Text", - "SpeakV1Warning", -] diff --git a/src/deepgram/speak/v1/types/speak_v1clear.py b/src/deepgram/speak/v1/types/speak_v1clear.py deleted file mode 100644 index b528050a..00000000 --- a/src/deepgram/speak/v1/types/speak_v1clear.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .speak_v1clear_type import SpeakV1ClearType - - -class SpeakV1Clear(UniversalBaseModel): - type: SpeakV1ClearType = pydantic.Field() - """ - Message type identifier - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/speak/v1/types/speak_v1clear_type.py b/src/deepgram/speak/v1/types/speak_v1clear_type.py deleted file mode 100644 index 93317162..00000000 --- a/src/deepgram/speak/v1/types/speak_v1clear_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SpeakV1ClearType = typing.Union[typing.Literal["Flush", "Clear", "Close"], typing.Any] diff --git a/src/deepgram/speak/v1/types/speak_v1cleared.py b/src/deepgram/speak/v1/types/speak_v1cleared.py deleted file mode 100644 index 9e88c530..00000000 --- a/src/deepgram/speak/v1/types/speak_v1cleared.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .speak_v1cleared_type import SpeakV1ClearedType - - -class SpeakV1Cleared(UniversalBaseModel): - type: SpeakV1ClearedType = pydantic.Field() - """ - Message type identifier - """ - - sequence_id: float = pydantic.Field() - """ - The sequence ID of the response - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/speak/v1/types/speak_v1cleared_type.py b/src/deepgram/speak/v1/types/speak_v1cleared_type.py deleted file mode 100644 index 2e2b0158..00000000 --- a/src/deepgram/speak/v1/types/speak_v1cleared_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SpeakV1ClearedType = typing.Union[typing.Literal["Flushed", "Cleared"], typing.Any] diff --git a/src/deepgram/speak/v1/types/speak_v1close.py b/src/deepgram/speak/v1/types/speak_v1close.py deleted file mode 100644 index f801dc92..00000000 --- a/src/deepgram/speak/v1/types/speak_v1close.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .speak_v1close_type import SpeakV1CloseType - - -class SpeakV1Close(UniversalBaseModel): - type: SpeakV1CloseType = pydantic.Field() - """ - Message type identifier - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/speak/v1/types/speak_v1close_type.py b/src/deepgram/speak/v1/types/speak_v1close_type.py deleted file mode 100644 index c3381c96..00000000 --- a/src/deepgram/speak/v1/types/speak_v1close_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SpeakV1CloseType = typing.Union[typing.Literal["Flush", "Clear", "Close"], typing.Any] diff --git a/src/deepgram/speak/v1/types/speak_v1flush.py b/src/deepgram/speak/v1/types/speak_v1flush.py deleted file mode 100644 index bfa3f72c..00000000 --- a/src/deepgram/speak/v1/types/speak_v1flush.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .speak_v1flush_type import SpeakV1FlushType - - -class SpeakV1Flush(UniversalBaseModel): - type: SpeakV1FlushType = pydantic.Field() - """ - Message type identifier - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/speak/v1/types/speak_v1flush_type.py b/src/deepgram/speak/v1/types/speak_v1flush_type.py deleted file mode 100644 index eaf4237f..00000000 --- a/src/deepgram/speak/v1/types/speak_v1flush_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SpeakV1FlushType = typing.Union[typing.Literal["Flush", "Clear", "Close"], typing.Any] diff --git a/src/deepgram/speak/v1/types/speak_v1flushed.py b/src/deepgram/speak/v1/types/speak_v1flushed.py deleted file mode 100644 index 6a5fd2c2..00000000 --- a/src/deepgram/speak/v1/types/speak_v1flushed.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel -from .speak_v1flushed_type import SpeakV1FlushedType - - -class SpeakV1Flushed(UniversalBaseModel): - type: SpeakV1FlushedType = pydantic.Field() - """ - Message type identifier - """ - - sequence_id: float = pydantic.Field() - """ - The sequence ID of the response - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/speak/v1/types/speak_v1flushed_type.py b/src/deepgram/speak/v1/types/speak_v1flushed_type.py deleted file mode 100644 index 4651ac44..00000000 --- a/src/deepgram/speak/v1/types/speak_v1flushed_type.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SpeakV1FlushedType = typing.Union[typing.Literal["Flushed", "Cleared"], typing.Any] diff --git a/src/deepgram/speak/v1/types/speak_v1metadata.py b/src/deepgram/speak/v1/types/speak_v1metadata.py deleted file mode 100644 index 4502f0c6..00000000 --- a/src/deepgram/speak/v1/types/speak_v1metadata.py +++ /dev/null @@ -1,42 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class SpeakV1Metadata(UniversalBaseModel): - type: typing.Literal["Metadata"] = pydantic.Field(default="Metadata") - """ - Message type identifier - """ - - request_id: str = pydantic.Field() - """ - Unique identifier for the request - """ - - model_name: str = pydantic.Field() - """ - Name of the model being used - """ - - model_version: str = pydantic.Field() - """ - Version of the model being used - """ - - model_uuid: str = pydantic.Field() - """ - Unique identifier for the model - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/speak/v1/types/speak_v1text.py b/src/deepgram/speak/v1/types/speak_v1text.py deleted file mode 100644 index 94ec70c8..00000000 --- a/src/deepgram/speak/v1/types/speak_v1text.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class SpeakV1Text(UniversalBaseModel): - type: typing.Literal["Speak"] = pydantic.Field(default="Speak") - """ - Message type identifier - """ - - text: str = pydantic.Field() - """ - The input text to be converted to speech - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/speak/v1/types/speak_v1warning.py b/src/deepgram/speak/v1/types/speak_v1warning.py deleted file mode 100644 index 95815596..00000000 --- a/src/deepgram/speak/v1/types/speak_v1warning.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel - - -class SpeakV1Warning(UniversalBaseModel): - type: typing.Literal["Warning"] = pydantic.Field(default="Warning") - """ - Message type identifier - """ - - description: str = pydantic.Field() - """ - A description of what went wrong - """ - - code: str = pydantic.Field() - """ - Error code identifying the type of error - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/deepgram/types/__init__.py b/src/deepgram/types/__init__.py index 3ef99cd6..23f30703 100644 --- a/src/deepgram/types/__init__.py +++ b/src/deepgram/types/__init__.py @@ -91,27 +91,6 @@ from .list_projects_v1response import ListProjectsV1Response from .list_projects_v1response_projects_item import ListProjectsV1ResponseProjectsItem from .listen_v1accepted_response import ListenV1AcceptedResponse - from .listen_v1callback import ListenV1Callback - from .listen_v1callback_method import ListenV1CallbackMethod - from .listen_v1channels import ListenV1Channels - from .listen_v1detect_entities import ListenV1DetectEntities - from .listen_v1diarize import ListenV1Diarize - from .listen_v1dictation import ListenV1Dictation - from .listen_v1encoding import ListenV1Encoding - from .listen_v1endpointing import ListenV1Endpointing - from .listen_v1extra import ListenV1Extra - from .listen_v1interim_results import ListenV1InterimResults - from .listen_v1keyterm import ListenV1Keyterm - from .listen_v1keywords import ListenV1Keywords - from .listen_v1language import ListenV1Language - from .listen_v1mip_opt_out import ListenV1MipOptOut - from .listen_v1model import ListenV1Model - from .listen_v1multichannel import ListenV1Multichannel - from .listen_v1numerals import ListenV1Numerals - from .listen_v1profanity_filter import ListenV1ProfanityFilter - from .listen_v1punctuate import ListenV1Punctuate - from .listen_v1redact import ListenV1Redact - from .listen_v1replace import ListenV1Replace from .listen_v1request_file import ListenV1RequestFile from .listen_v1response import ListenV1Response from .listen_v1response_metadata import ListenV1ResponseMetadata @@ -154,22 +133,6 @@ from .listen_v1response_results_utterances import ListenV1ResponseResultsUtterances from .listen_v1response_results_utterances_item import ListenV1ResponseResultsUtterancesItem from .listen_v1response_results_utterances_item_words_item import ListenV1ResponseResultsUtterancesItemWordsItem - from .listen_v1sample_rate import ListenV1SampleRate - from .listen_v1search import ListenV1Search - from .listen_v1smart_format import ListenV1SmartFormat - from .listen_v1tag import ListenV1Tag - from .listen_v1utterance_end_ms import ListenV1UtteranceEndMs - from .listen_v1vad_events import ListenV1VadEvents - from .listen_v1version import ListenV1Version - from .listen_v2eager_eot_threshold import ListenV2EagerEotThreshold - from .listen_v2encoding import ListenV2Encoding - from .listen_v2eot_threshold import ListenV2EotThreshold - from .listen_v2eot_timeout_ms import ListenV2EotTimeoutMs - from .listen_v2keyterm import ListenV2Keyterm - from .listen_v2mip_opt_out import ListenV2MipOptOut - from .listen_v2model import ListenV2Model - from .listen_v2sample_rate import ListenV2SampleRate - from .listen_v2tag import ListenV2Tag from .project_request_response import ProjectRequestResponse from .read_v1request import ReadV1Request from .read_v1request_text import ReadV1RequestText @@ -200,11 +163,7 @@ from .shared_topics_results_topics import SharedTopicsResultsTopics from .shared_topics_results_topics_segments_item import SharedTopicsResultsTopicsSegmentsItem from .shared_topics_results_topics_segments_item_topics_item import SharedTopicsResultsTopicsSegmentsItemTopicsItem - from .speak_v1encoding import SpeakV1Encoding - from .speak_v1mip_opt_out import SpeakV1MipOptOut - from .speak_v1model import SpeakV1Model from .speak_v1response import SpeakV1Response - from .speak_v1sample_rate import SpeakV1SampleRate from .update_project_member_scopes_v1response import UpdateProjectMemberScopesV1Response from .update_project_v1response import UpdateProjectV1Response from .usage_breakdown_v1response import UsageBreakdownV1Response @@ -287,27 +246,6 @@ "ListProjectsV1Response": ".list_projects_v1response", "ListProjectsV1ResponseProjectsItem": ".list_projects_v1response_projects_item", "ListenV1AcceptedResponse": ".listen_v1accepted_response", - "ListenV1Callback": ".listen_v1callback", - "ListenV1CallbackMethod": ".listen_v1callback_method", - "ListenV1Channels": ".listen_v1channels", - "ListenV1DetectEntities": ".listen_v1detect_entities", - "ListenV1Diarize": ".listen_v1diarize", - "ListenV1Dictation": ".listen_v1dictation", - "ListenV1Encoding": ".listen_v1encoding", - "ListenV1Endpointing": ".listen_v1endpointing", - "ListenV1Extra": ".listen_v1extra", - "ListenV1InterimResults": ".listen_v1interim_results", - "ListenV1Keyterm": ".listen_v1keyterm", - "ListenV1Keywords": ".listen_v1keywords", - "ListenV1Language": ".listen_v1language", - "ListenV1MipOptOut": ".listen_v1mip_opt_out", - "ListenV1Model": ".listen_v1model", - "ListenV1Multichannel": ".listen_v1multichannel", - "ListenV1Numerals": ".listen_v1numerals", - "ListenV1ProfanityFilter": ".listen_v1profanity_filter", - "ListenV1Punctuate": ".listen_v1punctuate", - "ListenV1Redact": ".listen_v1redact", - "ListenV1Replace": ".listen_v1replace", "ListenV1RequestFile": ".listen_v1request_file", "ListenV1Response": ".listen_v1response", "ListenV1ResponseMetadata": ".listen_v1response_metadata", @@ -332,22 +270,6 @@ "ListenV1ResponseResultsUtterances": ".listen_v1response_results_utterances", "ListenV1ResponseResultsUtterancesItem": ".listen_v1response_results_utterances_item", "ListenV1ResponseResultsUtterancesItemWordsItem": ".listen_v1response_results_utterances_item_words_item", - "ListenV1SampleRate": ".listen_v1sample_rate", - "ListenV1Search": ".listen_v1search", - "ListenV1SmartFormat": ".listen_v1smart_format", - "ListenV1Tag": ".listen_v1tag", - "ListenV1UtteranceEndMs": ".listen_v1utterance_end_ms", - "ListenV1VadEvents": ".listen_v1vad_events", - "ListenV1Version": ".listen_v1version", - "ListenV2EagerEotThreshold": ".listen_v2eager_eot_threshold", - "ListenV2Encoding": ".listen_v2encoding", - "ListenV2EotThreshold": ".listen_v2eot_threshold", - "ListenV2EotTimeoutMs": ".listen_v2eot_timeout_ms", - "ListenV2Keyterm": ".listen_v2keyterm", - "ListenV2MipOptOut": ".listen_v2mip_opt_out", - "ListenV2Model": ".listen_v2model", - "ListenV2SampleRate": ".listen_v2sample_rate", - "ListenV2Tag": ".listen_v2tag", "ProjectRequestResponse": ".project_request_response", "ReadV1Request": ".read_v1request", "ReadV1RequestText": ".read_v1request_text", @@ -376,11 +298,7 @@ "SharedTopicsResultsTopics": ".shared_topics_results_topics", "SharedTopicsResultsTopicsSegmentsItem": ".shared_topics_results_topics_segments_item", "SharedTopicsResultsTopicsSegmentsItemTopicsItem": ".shared_topics_results_topics_segments_item_topics_item", - "SpeakV1Encoding": ".speak_v1encoding", - "SpeakV1MipOptOut": ".speak_v1mip_opt_out", - "SpeakV1Model": ".speak_v1model", "SpeakV1Response": ".speak_v1response", - "SpeakV1SampleRate": ".speak_v1sample_rate", "UpdateProjectMemberScopesV1Response": ".update_project_member_scopes_v1response", "UpdateProjectV1Response": ".update_project_v1response", "UsageBreakdownV1Response": ".usage_breakdown_v1response", @@ -487,27 +405,6 @@ def __dir__(): "ListProjectsV1Response", "ListProjectsV1ResponseProjectsItem", "ListenV1AcceptedResponse", - "ListenV1Callback", - "ListenV1CallbackMethod", - "ListenV1Channels", - "ListenV1DetectEntities", - "ListenV1Diarize", - "ListenV1Dictation", - "ListenV1Encoding", - "ListenV1Endpointing", - "ListenV1Extra", - "ListenV1InterimResults", - "ListenV1Keyterm", - "ListenV1Keywords", - "ListenV1Language", - "ListenV1MipOptOut", - "ListenV1Model", - "ListenV1Multichannel", - "ListenV1Numerals", - "ListenV1ProfanityFilter", - "ListenV1Punctuate", - "ListenV1Redact", - "ListenV1Replace", "ListenV1RequestFile", "ListenV1Response", "ListenV1ResponseMetadata", @@ -532,22 +429,6 @@ def __dir__(): "ListenV1ResponseResultsUtterances", "ListenV1ResponseResultsUtterancesItem", "ListenV1ResponseResultsUtterancesItemWordsItem", - "ListenV1SampleRate", - "ListenV1Search", - "ListenV1SmartFormat", - "ListenV1Tag", - "ListenV1UtteranceEndMs", - "ListenV1VadEvents", - "ListenV1Version", - "ListenV2EagerEotThreshold", - "ListenV2Encoding", - "ListenV2EotThreshold", - "ListenV2EotTimeoutMs", - "ListenV2Keyterm", - "ListenV2MipOptOut", - "ListenV2Model", - "ListenV2SampleRate", - "ListenV2Tag", "ProjectRequestResponse", "ReadV1Request", "ReadV1RequestText", @@ -576,11 +457,7 @@ def __dir__(): "SharedTopicsResultsTopics", "SharedTopicsResultsTopicsSegmentsItem", "SharedTopicsResultsTopicsSegmentsItemTopicsItem", - "SpeakV1Encoding", - "SpeakV1MipOptOut", - "SpeakV1Model", "SpeakV1Response", - "SpeakV1SampleRate", "UpdateProjectMemberScopesV1Response", "UpdateProjectV1Response", "UsageBreakdownV1Response", diff --git a/src/deepgram/types/listen_v1callback.py b/src/deepgram/types/listen_v1callback.py deleted file mode 100644 index a561c5f7..00000000 --- a/src/deepgram/types/listen_v1callback.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Callback = typing.Any diff --git a/src/deepgram/types/listen_v1callback_method.py b/src/deepgram/types/listen_v1callback_method.py deleted file mode 100644 index f760ee62..00000000 --- a/src/deepgram/types/listen_v1callback_method.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1CallbackMethod = typing.Union[typing.Literal["POST", "GET", "PUT", "DELETE"], typing.Any] diff --git a/src/deepgram/types/listen_v1channels.py b/src/deepgram/types/listen_v1channels.py deleted file mode 100644 index 6c2d1dd1..00000000 --- a/src/deepgram/types/listen_v1channels.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Channels = typing.Any diff --git a/src/deepgram/types/listen_v1detect_entities.py b/src/deepgram/types/listen_v1detect_entities.py deleted file mode 100644 index 107337dd..00000000 --- a/src/deepgram/types/listen_v1detect_entities.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1DetectEntities = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1diarize.py b/src/deepgram/types/listen_v1diarize.py deleted file mode 100644 index a624c023..00000000 --- a/src/deepgram/types/listen_v1diarize.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Diarize = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1dictation.py b/src/deepgram/types/listen_v1dictation.py deleted file mode 100644 index 811ee1d1..00000000 --- a/src/deepgram/types/listen_v1dictation.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Dictation = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1encoding.py b/src/deepgram/types/listen_v1encoding.py deleted file mode 100644 index 6d0ca4d4..00000000 --- a/src/deepgram/types/listen_v1encoding.py +++ /dev/null @@ -1,10 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Encoding = typing.Union[ - typing.Literal[ - "linear16", "linear32", "flac", "alaw", "mulaw", "amr-nb", "amr-wb", "opus", "ogg-opus", "speex", "g729" - ], - typing.Any, -] diff --git a/src/deepgram/types/listen_v1endpointing.py b/src/deepgram/types/listen_v1endpointing.py deleted file mode 100644 index 72097702..00000000 --- a/src/deepgram/types/listen_v1endpointing.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Endpointing = typing.Any diff --git a/src/deepgram/types/listen_v1extra.py b/src/deepgram/types/listen_v1extra.py deleted file mode 100644 index e7ca9ae3..00000000 --- a/src/deepgram/types/listen_v1extra.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Extra = typing.Any diff --git a/src/deepgram/types/listen_v1interim_results.py b/src/deepgram/types/listen_v1interim_results.py deleted file mode 100644 index 2c431733..00000000 --- a/src/deepgram/types/listen_v1interim_results.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1InterimResults = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1keyterm.py b/src/deepgram/types/listen_v1keyterm.py deleted file mode 100644 index 5bbffd49..00000000 --- a/src/deepgram/types/listen_v1keyterm.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Keyterm = typing.Any diff --git a/src/deepgram/types/listen_v1keywords.py b/src/deepgram/types/listen_v1keywords.py deleted file mode 100644 index d5a5f7cf..00000000 --- a/src/deepgram/types/listen_v1keywords.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Keywords = typing.Any diff --git a/src/deepgram/types/listen_v1language.py b/src/deepgram/types/listen_v1language.py deleted file mode 100644 index 78d7ad03..00000000 --- a/src/deepgram/types/listen_v1language.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Language = typing.Any diff --git a/src/deepgram/types/listen_v1mip_opt_out.py b/src/deepgram/types/listen_v1mip_opt_out.py deleted file mode 100644 index 1b548f7b..00000000 --- a/src/deepgram/types/listen_v1mip_opt_out.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1MipOptOut = typing.Any diff --git a/src/deepgram/types/listen_v1model.py b/src/deepgram/types/listen_v1model.py deleted file mode 100644 index ea15699a..00000000 --- a/src/deepgram/types/listen_v1model.py +++ /dev/null @@ -1,39 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Model = typing.Union[ - typing.Literal[ - "nova-3", - "nova-3-general", - "nova-3-medical", - "nova-2", - "nova-2-general", - "nova-2-meeting", - "nova-2-finance", - "nova-2-conversationalai", - "nova-2-voicemail", - "nova-2-video", - "nova-2-medical", - "nova-2-drivethru", - "nova-2-automotive", - "nova", - "nova-general", - "nova-phonecall", - "nova-medical", - "enhanced", - "enhanced-general", - "enhanced-meeting", - "enhanced-phonecall", - "enhanced-finance", - "base", - "meeting", - "phonecall", - "finance", - "conversationalai", - "voicemail", - "video", - "custom", - ], - typing.Any, -] diff --git a/src/deepgram/types/listen_v1multichannel.py b/src/deepgram/types/listen_v1multichannel.py deleted file mode 100644 index 4afd7627..00000000 --- a/src/deepgram/types/listen_v1multichannel.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Multichannel = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1numerals.py b/src/deepgram/types/listen_v1numerals.py deleted file mode 100644 index 1c84c9ac..00000000 --- a/src/deepgram/types/listen_v1numerals.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Numerals = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1profanity_filter.py b/src/deepgram/types/listen_v1profanity_filter.py deleted file mode 100644 index 1f2729de..00000000 --- a/src/deepgram/types/listen_v1profanity_filter.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1ProfanityFilter = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1punctuate.py b/src/deepgram/types/listen_v1punctuate.py deleted file mode 100644 index c2e6ad9f..00000000 --- a/src/deepgram/types/listen_v1punctuate.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Punctuate = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1redact.py b/src/deepgram/types/listen_v1redact.py deleted file mode 100644 index 7bf572f3..00000000 --- a/src/deepgram/types/listen_v1redact.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Redact = typing.Union[ - typing.Literal["true", "false", "pci", "numbers", "aggressive_numbers", "ssn"], typing.Any -] diff --git a/src/deepgram/types/listen_v1replace.py b/src/deepgram/types/listen_v1replace.py deleted file mode 100644 index a1424264..00000000 --- a/src/deepgram/types/listen_v1replace.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Replace = typing.Any diff --git a/src/deepgram/types/listen_v1sample_rate.py b/src/deepgram/types/listen_v1sample_rate.py deleted file mode 100644 index ab4a2a92..00000000 --- a/src/deepgram/types/listen_v1sample_rate.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1SampleRate = typing.Any diff --git a/src/deepgram/types/listen_v1search.py b/src/deepgram/types/listen_v1search.py deleted file mode 100644 index 4f31cb4d..00000000 --- a/src/deepgram/types/listen_v1search.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Search = typing.Any diff --git a/src/deepgram/types/listen_v1smart_format.py b/src/deepgram/types/listen_v1smart_format.py deleted file mode 100644 index fa248ed0..00000000 --- a/src/deepgram/types/listen_v1smart_format.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1SmartFormat = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1tag.py b/src/deepgram/types/listen_v1tag.py deleted file mode 100644 index e8871d0d..00000000 --- a/src/deepgram/types/listen_v1tag.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Tag = typing.Any diff --git a/src/deepgram/types/listen_v1utterance_end_ms.py b/src/deepgram/types/listen_v1utterance_end_ms.py deleted file mode 100644 index b774a294..00000000 --- a/src/deepgram/types/listen_v1utterance_end_ms.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1UtteranceEndMs = typing.Any diff --git a/src/deepgram/types/listen_v1vad_events.py b/src/deepgram/types/listen_v1vad_events.py deleted file mode 100644 index 92d5c72f..00000000 --- a/src/deepgram/types/listen_v1vad_events.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1VadEvents = typing.Union[typing.Literal["true", "false"], typing.Any] diff --git a/src/deepgram/types/listen_v1version.py b/src/deepgram/types/listen_v1version.py deleted file mode 100644 index 2085b633..00000000 --- a/src/deepgram/types/listen_v1version.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Version = typing.Any diff --git a/src/deepgram/types/listen_v2eager_eot_threshold.py b/src/deepgram/types/listen_v2eager_eot_threshold.py deleted file mode 100644 index cd09e7fb..00000000 --- a/src/deepgram/types/listen_v2eager_eot_threshold.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2EagerEotThreshold = typing.Any diff --git a/src/deepgram/types/listen_v2encoding.py b/src/deepgram/types/listen_v2encoding.py deleted file mode 100644 index 6dedb7db..00000000 --- a/src/deepgram/types/listen_v2encoding.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2Encoding = typing.Union[typing.Literal["linear16", "linear32", "mulaw", "alaw", "opus", "ogg-opus"], typing.Any] diff --git a/src/deepgram/types/listen_v2eot_threshold.py b/src/deepgram/types/listen_v2eot_threshold.py deleted file mode 100644 index eb5d3887..00000000 --- a/src/deepgram/types/listen_v2eot_threshold.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2EotThreshold = typing.Any diff --git a/src/deepgram/types/listen_v2eot_timeout_ms.py b/src/deepgram/types/listen_v2eot_timeout_ms.py deleted file mode 100644 index 19a6924d..00000000 --- a/src/deepgram/types/listen_v2eot_timeout_ms.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2EotTimeoutMs = typing.Any diff --git a/src/deepgram/types/listen_v2keyterm.py b/src/deepgram/types/listen_v2keyterm.py deleted file mode 100644 index 4ff18177..00000000 --- a/src/deepgram/types/listen_v2keyterm.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2Keyterm = typing.Union[str, typing.List[str]] diff --git a/src/deepgram/types/listen_v2mip_opt_out.py b/src/deepgram/types/listen_v2mip_opt_out.py deleted file mode 100644 index 689450da..00000000 --- a/src/deepgram/types/listen_v2mip_opt_out.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2MipOptOut = typing.Any diff --git a/src/deepgram/types/listen_v2model.py b/src/deepgram/types/listen_v2model.py deleted file mode 100644 index a631e705..00000000 --- a/src/deepgram/types/listen_v2model.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2Model = typing.Literal["flux-general-en"] diff --git a/src/deepgram/types/listen_v2sample_rate.py b/src/deepgram/types/listen_v2sample_rate.py deleted file mode 100644 index 053a3e03..00000000 --- a/src/deepgram/types/listen_v2sample_rate.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2SampleRate = typing.Any diff --git a/src/deepgram/types/listen_v2tag.py b/src/deepgram/types/listen_v2tag.py deleted file mode 100644 index 5a535a77..00000000 --- a/src/deepgram/types/listen_v2tag.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV2Tag = typing.Any diff --git a/src/deepgram/types/speak_v1encoding.py b/src/deepgram/types/speak_v1encoding.py deleted file mode 100644 index b7ad6ea6..00000000 --- a/src/deepgram/types/speak_v1encoding.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SpeakV1Encoding = typing.Union[typing.Literal["linear16", "mulaw", "alaw"], typing.Any] diff --git a/src/deepgram/types/speak_v1mip_opt_out.py b/src/deepgram/types/speak_v1mip_opt_out.py deleted file mode 100644 index 80089874..00000000 --- a/src/deepgram/types/speak_v1mip_opt_out.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SpeakV1MipOptOut = typing.Any diff --git a/src/deepgram/types/speak_v1model.py b/src/deepgram/types/speak_v1model.py deleted file mode 100644 index 88e76d61..00000000 --- a/src/deepgram/types/speak_v1model.py +++ /dev/null @@ -1,72 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SpeakV1Model = typing.Union[ - typing.Literal[ - "aura-asteria-en", - "aura-luna-en", - "aura-stella-en", - "aura-athena-en", - "aura-hera-en", - "aura-orion-en", - "aura-arcas-en", - "aura-perseus-en", - "aura-angus-en", - "aura-orpheus-en", - "aura-helios-en", - "aura-zeus-en", - "aura-2-amalthea-en", - "aura-2-andromeda-en", - "aura-2-apollo-en", - "aura-2-arcas-en", - "aura-2-aries-en", - "aura-2-asteria-en", - "aura-2-athena-en", - "aura-2-atlas-en", - "aura-2-aurora-en", - "aura-2-callista-en", - "aura-2-cordelia-en", - "aura-2-cora-en", - "aura-2-delia-en", - "aura-2-draco-en", - "aura-2-electra-en", - "aura-2-harmonia-en", - "aura-2-helena-en", - "aura-2-hera-en", - "aura-2-hermes-en", - "aura-2-hyperion-en", - "aura-2-iris-en", - "aura-2-janus-en", - "aura-2-juno-en", - "aura-2-jupiter-en", - "aura-2-luna-en", - "aura-2-mars-en", - "aura-2-minerva-en", - "aura-2-neptune-en", - "aura-2-odysseus-en", - "aura-2-ophelia-en", - "aura-2-orion-en", - "aura-2-orpheus-en", - "aura-2-pandora-en", - "aura-2-phoebe-en", - "aura-2-pluto-en", - "aura-2-saturn-en", - "aura-2-selene-en", - "aura-2-thalia-en", - "aura-2-theia-en", - "aura-2-vesta-en", - "aura-2-zeus-en", - "aura-2-sirio-es", - "aura-2-nestor-es", - "aura-2-carina-es", - "aura-2-celeste-es", - "aura-2-alvaro-es", - "aura-2-diana-es", - "aura-2-aquila-es", - "aura-2-selena-es", - "aura-2-estrella-es", - "aura-2-javier-es", - ], - typing.Any, -] diff --git a/src/deepgram/types/speak_v1sample_rate.py b/src/deepgram/types/speak_v1sample_rate.py deleted file mode 100644 index 3b8036fc..00000000 --- a/src/deepgram/types/speak_v1sample_rate.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -SpeakV1SampleRate = typing.Union[typing.Literal["8000", "16000", "24000", "32000", "48000"], typing.Any] diff --git a/tests/conftest.py b/tests/conftest.py index 2103b1be..dd48d29f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,6 +15,7 @@ import pytest _STARTED: bool = False +_WIREMOCK_PORT: str = "8080" # Default, will be updated after container starts def _compose_file() -> str: @@ -26,22 +27,54 @@ def _compose_file() -> str: return os.path.join(wiremock_dir, "docker-compose.test.yml") +def _project_name() -> str: + """Returns a unique project name for this test fixture to avoid container name conflicts.""" + tests_dir = os.path.dirname(__file__) + project_root = os.path.abspath(os.path.join(tests_dir, "..")) + # Use the last two directory names to create a unique project name + # e.g., "python-streaming-parameter-openapi-with-wire-tests" + parent = os.path.basename(os.path.dirname(project_root)) + current = os.path.basename(project_root) + return f"{parent}-{current}".replace("_", "-").lower() + + +def _get_wiremock_port() -> str: + """Gets the dynamically assigned port for the WireMock container.""" + compose_file = _compose_file() + project = _project_name() + try: + result = subprocess.run( + ["docker", "compose", "-f", compose_file, "-p", project, "port", "wiremock", "8080"], + check=True, + capture_output=True, + text=True, + ) + # Output is like "0.0.0.0:32768" or "[::]:32768" + port = result.stdout.strip().split(":")[-1] + return port + except subprocess.CalledProcessError: + return "8080" # Fallback to default + + def _start_wiremock() -> None: """Starts the WireMock container using docker-compose.""" - global _STARTED + global _STARTED, _WIREMOCK_PORT if _STARTED: return compose_file = _compose_file() - print("\nStarting WireMock container...") + project = _project_name() + print(f"\nStarting WireMock container (project: {project})...") try: subprocess.run( - ["docker", "compose", "-f", compose_file, "up", "-d", "--wait"], + ["docker", "compose", "-f", compose_file, "-p", project, "up", "-d", "--wait"], check=True, capture_output=True, text=True, ) - print("WireMock container is ready") + _WIREMOCK_PORT = _get_wiremock_port() + os.environ["WIREMOCK_PORT"] = _WIREMOCK_PORT + print(f"WireMock container is ready on port {_WIREMOCK_PORT}") _STARTED = True except subprocess.CalledProcessError as e: print(f"Failed to start WireMock: {e.stderr}") @@ -51,9 +84,10 @@ def _start_wiremock() -> None: def _stop_wiremock() -> None: """Stops and removes the WireMock container.""" compose_file = _compose_file() + project = _project_name() print("\nStopping WireMock container...") subprocess.run( - ["docker", "compose", "-f", compose_file, "down", "-v"], + ["docker", "compose", "-f", compose_file, "-p", project, "down", "-v"], check=False, capture_output=True, ) diff --git a/tests/custom/test_proxy_engine.py b/tests/custom/test_proxy_engine.py new file mode 100644 index 00000000..0031595b --- /dev/null +++ b/tests/custom/test_proxy_engine.py @@ -0,0 +1,167 @@ +"""Tests for the core DeepgramProxy engine.""" + +import httpx +import pytest + +from deepgram.proxy import DeepgramProxy, Scope +from deepgram.proxy.errors import AuthenticationError, AuthorizationError, UpstreamError + +API_KEY = "test-api-key-for-engine" + + +@pytest.fixture +def proxy(): + p = DeepgramProxy(api_key=API_KEY, require_auth=True) + yield p + p.close() + + +@pytest.fixture +def proxy_no_auth(): + p = DeepgramProxy(api_key=API_KEY, require_auth=False) + yield p + p.close() + + +class TestInit: + def test_requires_api_key(self): + import os + old = os.environ.pop("DEEPGRAM_API_KEY", None) + try: + with pytest.raises(ValueError, match="api_key is required"): + DeepgramProxy(api_key="") + finally: + if old: + os.environ["DEEPGRAM_API_KEY"] = old + + def test_env_var_fallback(self): + import os + os.environ["DEEPGRAM_API_KEY"] = "env-key" + try: + p = DeepgramProxy() + assert p.api_key == "env-key" + finally: + del os.environ["DEEPGRAM_API_KEY"] + + +class TestCreateToken: + def test_returns_string(self, proxy): + token = proxy.create_token([Scope.LISTEN]) + assert isinstance(token, str) + + +class TestAuthenticate: + def test_missing_header_required(self, proxy): + with pytest.raises(AuthenticationError, match="Missing"): + proxy.authenticate(None) + + def test_missing_header_not_required(self, proxy_no_auth): + result = proxy_no_auth.authenticate(None) + assert result is None + + def test_valid_token(self, proxy): + token = proxy.create_token([Scope.LISTEN, Scope.SPEAK]) + scopes = proxy.authenticate(f"Bearer {token}") + assert Scope.LISTEN in scopes + assert Scope.SPEAK in scopes + + def test_invalid_token(self, proxy): + with pytest.raises(AuthenticationError, match="Invalid token"): + proxy.authenticate("Bearer bad.token.here") + + +class TestAuthorize: + def test_permits_matching_scope(self, proxy): + # Should not raise + proxy.authorize("/v1/listen", [Scope.LISTEN]) + + def test_rejects_wrong_scope(self, proxy): + with pytest.raises(AuthorizationError, match="do not permit"): + proxy.authorize("/v1/listen", [Scope.SPEAK]) + + def test_none_scopes_allows_all(self, proxy): + # None means auth was not required and no token was provided + proxy.authorize("/v1/listen", None) + + +class TestForwardRestSync: + def test_strips_auth_header_and_injects_api_key(self, proxy): + """Verify the proxy replaces Authorization header with its own.""" + captured = {} + + def handler(request: httpx.Request) -> httpx.Response: + captured["auth"] = request.headers.get("authorization") + captured["url"] = str(request.url) + return httpx.Response(200, content=b'{"ok": true}') + + proxy._sync_client = httpx.Client(transport=httpx.MockTransport(handler)) + + status, headers, body = proxy.forward_rest_sync( + method="POST", + path="/v1/listen", + headers={"Authorization": "Bearer client-jwt", "Content-Type": "application/json"}, + query_string="model=nova-3", + body=b'{"url": "https://example.com/audio.wav"}', + ) + + assert status == 200 + assert captured["auth"] == f"Token {API_KEY}" + assert "api.deepgram.com" in captured["url"] + assert "model=nova-3" in captured["url"] + + def test_upstream_error_passthrough(self, proxy): + """Upstream 4xx/5xx are returned as-is.""" + + def handler(request: httpx.Request) -> httpx.Response: + return httpx.Response(400, content=b"Bad Request") + + proxy._sync_client = httpx.Client(transport=httpx.MockTransport(handler)) + + status, headers, body = proxy.forward_rest_sync( + method="POST", path="/v1/listen", headers={}, body=b"", + ) + assert status == 400 + assert body == b"Bad Request" + + def test_connect_error_raises_upstream_error(self, proxy): + def handler(request: httpx.Request) -> httpx.Response: + raise httpx.ConnectError("Connection refused") + + proxy._sync_client = httpx.Client(transport=httpx.MockTransport(handler)) + + with pytest.raises(UpstreamError, match="Failed to connect"): + proxy.forward_rest_sync(method="GET", path="/v1/listen", headers={}) + + def test_agent_path_routes_to_agent_host(self, proxy): + captured = {} + + def handler(request: httpx.Request) -> httpx.Response: + captured["url"] = str(request.url) + return httpx.Response(200, content=b"ok") + + proxy._sync_client = httpx.Client(transport=httpx.MockTransport(handler)) + proxy.forward_rest_sync(method="POST", path="/v1/agent", headers={}) + + assert "agent.deepgram.com" in captured["url"] + + +class TestForwardRestAsync: + @pytest.mark.asyncio + async def test_async_forward(self, proxy): + captured = {} + + async def handler(request: httpx.Request) -> httpx.Response: + captured["auth"] = request.headers.get("authorization") + return httpx.Response(200, content=b'{"result": "ok"}') + + proxy._async_client = httpx.AsyncClient(transport=httpx.MockTransport(handler)) + + status, headers, body = await proxy.forward_rest_async( + method="POST", + path="/v1/speak", + headers={"Authorization": "Bearer jwt"}, + body=b"Hello world", + ) + + assert status == 200 + assert captured["auth"] == f"Token {API_KEY}" diff --git a/tests/custom/test_proxy_fastapi.py b/tests/custom/test_proxy_fastapi.py new file mode 100644 index 00000000..071ef7c4 --- /dev/null +++ b/tests/custom/test_proxy_fastapi.py @@ -0,0 +1,87 @@ +"""End-to-end tests for the FastAPI proxy adapter.""" + +import httpx +import pytest + +from deepgram.proxy import DeepgramProxy, Scope + +API_KEY = "test-api-key-for-fastapi" + + +@pytest.fixture +def app(): + """Create a FastAPI app with the proxy router and mocked upstream.""" + from fastapi import FastAPI + + from deepgram.proxy.adapters.fastapi import create_deepgram_router + + proxy = DeepgramProxy(api_key=API_KEY, require_auth=True) + router = create_deepgram_router(proxy) + + application = FastAPI() + application.include_router(router, prefix="/deepgram") + + # Mock the async HTTP client on the proxy + def mock_handler(request: httpx.Request) -> httpx.Response: + return httpx.Response( + 200, + content=b'{"results": "ok"}', + headers={"content-type": "application/json"}, + ) + + proxy._async_client = httpx.AsyncClient(transport=httpx.MockTransport(mock_handler)) + + application.state.proxy = proxy + return application + + +@pytest.fixture +def client(app): + from starlette.testclient import TestClient + return TestClient(app) + + +class TestRESTProxy: + def _make_token(self): + proxy = DeepgramProxy(api_key=API_KEY) + return proxy.create_token([Scope.LISTEN, Scope.SPEAK]) + + def test_authenticated_request(self, client): + token = self._make_token() + resp = client.post( + "/deepgram/v1/listen", + headers={"Authorization": f"Bearer {token}"}, + content=b"audio data", + ) + assert resp.status_code == 200 + assert resp.json() == {"results": "ok"} + + def test_missing_auth(self, client): + resp = client.post("/deepgram/v1/listen", content=b"audio data") + assert resp.status_code == 401 + + def test_invalid_token(self, client): + resp = client.post( + "/deepgram/v1/listen", + headers={"Authorization": "Bearer invalid.jwt.token"}, + content=b"audio data", + ) + assert resp.status_code == 401 + + def test_scope_mismatch(self, client): + """Token scoped to LISTEN can't access /v1/agent.""" + proxy = DeepgramProxy(api_key=API_KEY) + token = proxy.create_token([Scope.LISTEN]) # no AGENT scope + resp = client.post( + "/deepgram/v1/agent", + headers={"Authorization": f"Bearer {token}"}, + ) + assert resp.status_code == 403 + + def test_get_request(self, client): + token = self._make_token() + resp = client.get( + "/deepgram/v1/listen", + headers={"Authorization": f"Bearer {token}"}, + ) + assert resp.status_code == 200 diff --git a/tests/custom/test_proxy_jwt.py b/tests/custom/test_proxy_jwt.py new file mode 100644 index 00000000..2440433f --- /dev/null +++ b/tests/custom/test_proxy_jwt.py @@ -0,0 +1,92 @@ +"""Tests for proxy JWT creation and validation.""" + + +import jwt as pyjwt +import pytest + +from deepgram.proxy.jwt import JWTManager, TokenPayload +from deepgram.proxy.scopes import Scope + +API_KEY = "test-api-key-for-jwt" + + +@pytest.fixture +def manager(): + return JWTManager(API_KEY) + + +class TestCreateToken: + def test_returns_string(self, manager): + token = manager.create_token([Scope.LISTEN]) + assert isinstance(token, str) + + def test_contains_scopes(self, manager): + token = manager.create_token([Scope.LISTEN, Scope.SPEAK]) + payload = pyjwt.decode(token, API_KEY, algorithms=["HS256"]) + assert payload["scopes"] == ["listen", "speak"] + + def test_contains_exp(self, manager): + token = manager.create_token([Scope.LISTEN], expires_in=600) + payload = pyjwt.decode(token, API_KEY, algorithms=["HS256"]) + assert payload["exp"] - payload["iat"] == 600 + + def test_contains_jti(self, manager): + token = manager.create_token([Scope.LISTEN]) + payload = pyjwt.decode(token, API_KEY, algorithms=["HS256"]) + assert "jti" in payload + assert len(payload["jti"]) > 0 + + def test_unique_jti(self, manager): + t1 = manager.create_token([Scope.LISTEN]) + t2 = manager.create_token([Scope.LISTEN]) + p1 = pyjwt.decode(t1, API_KEY, algorithms=["HS256"]) + p2 = pyjwt.decode(t2, API_KEY, algorithms=["HS256"]) + assert p1["jti"] != p2["jti"] + + +class TestValidateToken: + def test_valid_token(self, manager): + token = manager.create_token([Scope.LISTEN]) + payload = manager.validate_token(token) + assert isinstance(payload, TokenPayload) + assert payload.scopes == ["listen"] + + def test_expired_token(self, manager): + token = manager.create_token([Scope.LISTEN], expires_in=-1) + with pytest.raises(pyjwt.ExpiredSignatureError): + manager.validate_token(token) + + def test_bad_signature(self, manager): + other = JWTManager("wrong-key") + token = other.create_token([Scope.LISTEN]) + with pytest.raises(pyjwt.InvalidSignatureError): + manager.validate_token(token) + + def test_malformed_token(self, manager): + with pytest.raises(pyjwt.DecodeError): + manager.validate_token("not.a.valid.jwt") + + def test_multiple_scopes(self, manager): + token = manager.create_token([Scope.LISTEN, Scope.SPEAK, Scope.AGENT]) + payload = manager.validate_token(token) + assert payload.scopes == ["listen", "speak", "agent"] + + +class TestExtractTokenFromHeader: + def test_bearer_token(self): + assert JWTManager.extract_token_from_header("Bearer abc123") == "abc123" + + def test_bearer_lowercase(self): + assert JWTManager.extract_token_from_header("bearer abc123") == "abc123" + + def test_no_header(self): + assert JWTManager.extract_token_from_header(None) is None + + def test_empty_header(self): + assert JWTManager.extract_token_from_header("") is None + + def test_wrong_scheme(self): + assert JWTManager.extract_token_from_header("Token abc123") is None + + def test_no_space(self): + assert JWTManager.extract_token_from_header("Bearerabc123") is None diff --git a/tests/custom/test_proxy_scopes.py b/tests/custom/test_proxy_scopes.py new file mode 100644 index 00000000..adde91d7 --- /dev/null +++ b/tests/custom/test_proxy_scopes.py @@ -0,0 +1,78 @@ +"""Tests for proxy scope definitions and path matching.""" + + +from deepgram.proxy.scopes import ( + Scope, + get_target_base_url, + path_matches_any_scope, + path_matches_scope, +) + + +class TestPathMatchesScope: + def test_listen_v1(self): + assert path_matches_scope("/v1/listen", Scope.LISTEN) + + def test_listen_v2(self): + assert path_matches_scope("/v2/listen", Scope.LISTEN) + + def test_listen_with_subpath(self): + assert path_matches_scope("/v1/listen/stream", Scope.LISTEN) + + def test_speak(self): + assert path_matches_scope("/v1/speak", Scope.SPEAK) + + def test_read(self): + assert path_matches_scope("/v1/read", Scope.READ) + + def test_agent(self): + assert path_matches_scope("/v1/agent", Scope.AGENT) + + def test_manage_projects(self): + assert path_matches_scope("/v1/projects", Scope.MANAGE) + + def test_manage_usage(self): + assert path_matches_scope("/v1/usage", Scope.MANAGE) + + def test_self_hosted(self): + assert path_matches_scope("/v1/onprem", Scope.SELF_HOSTED) + + def test_no_match_wrong_scope(self): + assert not path_matches_scope("/v1/listen", Scope.SPEAK) + + def test_no_match_unrecognised_path(self): + assert not path_matches_scope("/v1/unknown", Scope.LISTEN) + + +class TestPathMatchesAnyScope: + def test_matches_first(self): + assert path_matches_any_scope("/v1/listen", [Scope.LISTEN, Scope.SPEAK]) + + def test_matches_second(self): + assert path_matches_any_scope("/v1/speak", [Scope.LISTEN, Scope.SPEAK]) + + def test_no_match(self): + assert not path_matches_any_scope("/v1/agent", [Scope.LISTEN, Scope.SPEAK]) + + def test_empty_scopes(self): + assert not path_matches_any_scope("/v1/listen", []) + + +class TestGetTargetBaseUrl: + def test_default_api(self): + assert get_target_base_url("/v1/listen") == "https://api.deepgram.com" + + def test_agent_path(self): + assert get_target_base_url("/v1/agent") == "https://agent.deepgram.com" + + def test_agent_subpath(self): + assert get_target_base_url("/v1/agent/sessions") == "https://agent.deepgram.com" + + def test_custom_production_url(self): + assert get_target_base_url("/v1/listen", production_url="https://custom.api.com") == "https://custom.api.com" + + def test_custom_agent_url(self): + assert get_target_base_url("/v1/agent", agent_url="https://custom.agent.com") == "https://custom.agent.com" + + def test_speak_goes_to_api(self): + assert get_target_base_url("/v1/speak") == "https://api.deepgram.com" diff --git a/wiremock/docker-compose.test.yml b/wiremock/docker-compose.test.yml index f80c6b0a..58747d54 100644 --- a/wiremock/docker-compose.test.yml +++ b/wiremock/docker-compose.test.yml @@ -2,7 +2,7 @@ services: wiremock: image: wiremock/wiremock:3.9.1 ports: - - "8080:8080" + - "0:8080" # Use dynamic port to avoid conflicts with concurrent tests volumes: - ./wiremock-mappings.json:/home/wiremock/mappings/wiremock-mappings.json command: ["--global-response-templating", "--verbose"]