diff --git a/.fern/metadata.json b/.fern/metadata.json new file mode 100644 index 00000000..b98313a7 --- /dev/null +++ b/.fern/metadata.json @@ -0,0 +1,15 @@ +{ + "cliVersion": "3.1.0", + "generatorName": "fernapi/fern-python-sdk", + "generatorVersion": "4.42.0", + "generatorConfig": { + "client": { + "class_name": "BaseClient", + "filename": "base_client.py", + "exported_class_name": "DeepgramClient", + "exported_filename": "client.py" + }, + "use_typeddict_requests": true, + "should_generate_websocket_clients": true + } +} \ No newline at end of file diff --git a/LICENSE b/LICENSE index 853b289d..9c02c16d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Deepgram. +Copyright (c) 2026 Deepgram. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/poetry.lock b/poetry.lock index 7b42b5ff..2f8666b3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -38,13 +38,13 @@ trio = ["trio (>=0.26.1)"] [[package]] name = "certifi" -version = "2025.10.5" +version = "2026.1.4" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.7" files = [ - {file = "certifi-2025.10.5-py3-none-any.whl", hash = "sha256:0f212c2744a9bb6de0c56639a6f68afe01ecd92d91f14ae897c4fe7bbeeef0de"}, - {file = "certifi-2025.10.5.tar.gz", hash = "sha256:47c09d31ccf2acf0be3f701ea53595ee7e0b8fa08801c6624be771df09ae7b43"}, + {file = "certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c"}, + {file = "certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120"}, ] [[package]] @@ -60,13 +60,13 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.3.0" +version = "1.3.1" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, - {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, + {file = "exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598"}, + {file = "exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219"}, ] [package.dependencies] @@ -75,6 +75,20 @@ typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""} [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "execnet" +version = "2.1.2" +description = "execnet: rapid multi-Python deployment" +optional = false +python-versions = ">=3.8" +files = [ + {file = "execnet-2.1.2-py3-none-any.whl", hash = "sha256:67fba928dd5a544b783f6056f449e5e3931a5c378b128bc18501f7ea79e296ec"}, + {file = "execnet-2.1.2.tar.gz", hash = "sha256:63d83bfdd9a23e35b9c6a3261412324f964c2ec8dcd8d3c6916ee9373e0befcd"}, +] + +[package.extras] +testing = ["hatch", "pre-commit", "pytest", "tox"] + [[package]] name = "h11" version = "0.16.0" @@ -222,13 +236,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]] @@ -418,6 +432,26 @@ pytest = ">=7.0.0,<9" docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] testing = ["coverage (>=6.2)", "hypothesis (>=5.7.1)"] +[[package]] +name = "pytest-xdist" +version = "3.6.1" +description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest_xdist-3.6.1-py3-none-any.whl", hash = "sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7"}, + {file = "pytest_xdist-3.6.1.tar.gz", hash = "sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d"}, +] + +[package.dependencies] +execnet = ">=2.1" +pytest = ">=7.0.0" + +[package.extras] +psutil = ["psutil (>=3.0)"] +setproctitle = ["setproctitle"] +testing = ["filelock"] + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -483,53 +517,58 @@ files = [ [[package]] name = "tomli" -version = "2.3.0" +version = "2.4.0" description = "A lil' TOML parser" optional = false python-versions = ">=3.8" files = [ - {file = "tomli-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:88bd15eb972f3664f5ed4b57c1634a97153b4bac4479dcb6a495f41921eb7f45"}, - {file = "tomli-2.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:883b1c0d6398a6a9d29b508c331fa56adbcdff647f6ace4dfca0f50e90dfd0ba"}, - {file = "tomli-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d1381caf13ab9f300e30dd8feadb3de072aeb86f1d34a8569453ff32a7dea4bf"}, - {file = "tomli-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0e285d2649b78c0d9027570d4da3425bdb49830a6156121360b3f8511ea3441"}, - {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a154a9ae14bfcf5d8917a59b51ffd5a3ac1fd149b71b47a3a104ca4edcfa845"}, - {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:74bf8464ff93e413514fefd2be591c3b0b23231a77f901db1eb30d6f712fc42c"}, - {file = "tomli-2.3.0-cp311-cp311-win32.whl", hash = "sha256:00b5f5d95bbfc7d12f91ad8c593a1659b6387b43f054104cda404be6bda62456"}, - {file = "tomli-2.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:4dc4ce8483a5d429ab602f111a93a6ab1ed425eae3122032db7e9acf449451be"}, - {file = "tomli-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7d86942e56ded512a594786a5ba0a5e521d02529b3826e7761a05138341a2ac"}, - {file = "tomli-2.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:73ee0b47d4dad1c5e996e3cd33b8a76a50167ae5f96a2607cbe8cc773506ab22"}, - {file = "tomli-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:792262b94d5d0a466afb5bc63c7daa9d75520110971ee269152083270998316f"}, - {file = "tomli-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f195fe57ecceac95a66a75ac24d9d5fbc98ef0962e09b2eddec5d39375aae52"}, - {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e31d432427dcbf4d86958c184b9bfd1e96b5b71f8eb17e6d02531f434fd335b8"}, - {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b0882799624980785240ab732537fcfc372601015c00f7fc367c55308c186f6"}, - {file = "tomli-2.3.0-cp312-cp312-win32.whl", hash = "sha256:ff72b71b5d10d22ecb084d345fc26f42b5143c5533db5e2eaba7d2d335358876"}, - {file = "tomli-2.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:1cb4ed918939151a03f33d4242ccd0aa5f11b3547d0cf30f7c74a408a5b99878"}, - {file = "tomli-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5192f562738228945d7b13d4930baffda67b69425a7f0da96d360b0a3888136b"}, - {file = "tomli-2.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:be71c93a63d738597996be9528f4abe628d1adf5e6eb11607bc8fe1a510b5dae"}, - {file = "tomli-2.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4665508bcbac83a31ff8ab08f424b665200c0e1e645d2bd9ab3d3e557b6185b"}, - {file = "tomli-2.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4021923f97266babc6ccab9f5068642a0095faa0a51a246a6a02fccbb3514eaf"}, - {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4ea38c40145a357d513bffad0ed869f13c1773716cf71ccaa83b0fa0cc4e42f"}, - {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ad805ea85eda330dbad64c7ea7a4556259665bdf9d2672f5dccc740eb9d3ca05"}, - {file = "tomli-2.3.0-cp313-cp313-win32.whl", hash = "sha256:97d5eec30149fd3294270e889b4234023f2c69747e555a27bd708828353ab606"}, - {file = "tomli-2.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:0c95ca56fbe89e065c6ead5b593ee64b84a26fca063b5d71a1122bf26e533999"}, - {file = "tomli-2.3.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:cebc6fe843e0733ee827a282aca4999b596241195f43b4cc371d64fc6639da9e"}, - {file = "tomli-2.3.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4c2ef0244c75aba9355561272009d934953817c49f47d768070c3c94355c2aa3"}, - {file = "tomli-2.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c22a8bf253bacc0cf11f35ad9808b6cb75ada2631c2d97c971122583b129afbc"}, - {file = "tomli-2.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0eea8cc5c5e9f89c9b90c4896a8deefc74f518db5927d0e0e8d4a80953d774d0"}, - {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b74a0e59ec5d15127acdabd75ea17726ac4c5178ae51b85bfe39c4f8a278e879"}, - {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b5870b50c9db823c595983571d1296a6ff3e1b88f734a4c8f6fc6188397de005"}, - {file = "tomli-2.3.0-cp314-cp314-win32.whl", hash = "sha256:feb0dacc61170ed7ab602d3d972a58f14ee3ee60494292d384649a3dc38ef463"}, - {file = "tomli-2.3.0-cp314-cp314-win_amd64.whl", hash = "sha256:b273fcbd7fc64dc3600c098e39136522650c49bca95df2d11cf3b626422392c8"}, - {file = "tomli-2.3.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:940d56ee0410fa17ee1f12b817b37a4d4e4dc4d27340863cc67236c74f582e77"}, - {file = "tomli-2.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f85209946d1fe94416debbb88d00eb92ce9cd5266775424ff81bc959e001acaf"}, - {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a56212bdcce682e56b0aaf79e869ba5d15a6163f88d5451cbde388d48b13f530"}, - {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c5f3ffd1e098dfc032d4d3af5c0ac64f6d286d98bc148698356847b80fa4de1b"}, - {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e01decd096b1530d97d5d85cb4dff4af2d8347bd35686654a004f8dea20fc67"}, - {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8a35dd0e643bb2610f156cca8db95d213a90015c11fee76c946aa62b7ae7e02f"}, - {file = "tomli-2.3.0-cp314-cp314t-win32.whl", hash = "sha256:a1f7f282fe248311650081faafa5f4732bdbfef5d45fe3f2e702fbc6f2d496e0"}, - {file = "tomli-2.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:70a251f8d4ba2d9ac2542eecf008b3c8a9fc5c3f9f02c56a9d7952612be2fdba"}, - {file = "tomli-2.3.0-py3-none-any.whl", hash = "sha256:e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b"}, - {file = "tomli-2.3.0.tar.gz", hash = "sha256:64be704a875d2a59753d80ee8a533c3fe183e3f06807ff7dc2232938ccb01549"}, + {file = "tomli-2.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b5ef256a3fd497d4973c11bf142e9ed78b150d36f5773f1ca6088c230ffc5867"}, + {file = "tomli-2.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5572e41282d5268eb09a697c89a7bee84fae66511f87533a6f88bd2f7b652da9"}, + {file = "tomli-2.4.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:551e321c6ba03b55676970b47cb1b73f14a0a4dce6a3e1a9458fd6d921d72e95"}, + {file = "tomli-2.4.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5e3f639a7a8f10069d0e15408c0b96a2a828cfdec6fca05296ebcdcc28ca7c76"}, + {file = "tomli-2.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1b168f2731796b045128c45982d3a4874057626da0e2ef1fdd722848b741361d"}, + {file = "tomli-2.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:133e93646ec4300d651839d382d63edff11d8978be23da4cc106f5a18b7d0576"}, + {file = "tomli-2.4.0-cp311-cp311-win32.whl", hash = "sha256:b6c78bdf37764092d369722d9946cb65b8767bfa4110f902a1b2542d8d173c8a"}, + {file = "tomli-2.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:d3d1654e11d724760cdb37a3d7691f0be9db5fbdaef59c9f532aabf87006dbaa"}, + {file = "tomli-2.4.0-cp311-cp311-win_arm64.whl", hash = "sha256:cae9c19ed12d4e8f3ebf46d1a75090e4c0dc16271c5bce1c833ac168f08fb614"}, + {file = "tomli-2.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:920b1de295e72887bafa3ad9f7a792f811847d57ea6b1215154030cf131f16b1"}, + {file = "tomli-2.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7d6d9a4aee98fac3eab4952ad1d73aee87359452d1c086b5ceb43ed02ddb16b8"}, + {file = "tomli-2.4.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:36b9d05b51e65b254ea6c2585b59d2c4cb91c8a3d91d0ed0f17591a29aaea54a"}, + {file = "tomli-2.4.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1c8a885b370751837c029ef9bc014f27d80840e48bac415f3412e6593bbc18c1"}, + {file = "tomli-2.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8768715ffc41f0008abe25d808c20c3d990f42b6e2e58305d5da280ae7d1fa3b"}, + {file = "tomli-2.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b438885858efd5be02a9a133caf5812b8776ee0c969fea02c45e8e3f296ba51"}, + {file = "tomli-2.4.0-cp312-cp312-win32.whl", hash = "sha256:0408e3de5ec77cc7f81960c362543cbbd91ef883e3138e81b729fc3eea5b9729"}, + {file = "tomli-2.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:685306e2cc7da35be4ee914fd34ab801a6acacb061b6a7abca922aaf9ad368da"}, + {file = "tomli-2.4.0-cp312-cp312-win_arm64.whl", hash = "sha256:5aa48d7c2356055feef06a43611fc401a07337d5b006be13a30f6c58f869e3c3"}, + {file = "tomli-2.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:84d081fbc252d1b6a982e1870660e7330fb8f90f676f6e78b052ad4e64714bf0"}, + {file = "tomli-2.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:9a08144fa4cba33db5255f9b74f0b89888622109bd2776148f2597447f92a94e"}, + {file = "tomli-2.4.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c73add4bb52a206fd0c0723432db123c0c75c280cbd67174dd9d2db228ebb1b4"}, + {file = "tomli-2.4.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1fb2945cbe303b1419e2706e711b7113da57b7db31ee378d08712d678a34e51e"}, + {file = "tomli-2.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:bbb1b10aa643d973366dc2cb1ad94f99c1726a02343d43cbc011edbfac579e7c"}, + {file = "tomli-2.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4cbcb367d44a1f0c2be408758b43e1ffb5308abe0ea222897d6bfc8e8281ef2f"}, + {file = "tomli-2.4.0-cp313-cp313-win32.whl", hash = "sha256:7d49c66a7d5e56ac959cb6fc583aff0651094ec071ba9ad43df785abc2320d86"}, + {file = "tomli-2.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:3cf226acb51d8f1c394c1b310e0e0e61fecdd7adcb78d01e294ac297dd2e7f87"}, + {file = "tomli-2.4.0-cp313-cp313-win_arm64.whl", hash = "sha256:d20b797a5c1ad80c516e41bc1fb0443ddb5006e9aaa7bda2d71978346aeb9132"}, + {file = "tomli-2.4.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:26ab906a1eb794cd4e103691daa23d95c6919cc2fa9160000ac02370cc9dd3f6"}, + {file = "tomli-2.4.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:20cedb4ee43278bc4f2fee6cb50daec836959aadaf948db5172e776dd3d993fc"}, + {file = "tomli-2.4.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:39b0b5d1b6dd03684b3fb276407ebed7090bbec989fa55838c98560c01113b66"}, + {file = "tomli-2.4.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a26d7ff68dfdb9f87a016ecfd1e1c2bacbe3108f4e0f8bcd2228ef9a766c787d"}, + {file = "tomli-2.4.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:20ffd184fb1df76a66e34bd1b36b4a4641bd2b82954befa32fe8163e79f1a702"}, + {file = "tomli-2.4.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:75c2f8bbddf170e8effc98f5e9084a8751f8174ea6ccf4fca5398436e0320bc8"}, + {file = "tomli-2.4.0-cp314-cp314-win32.whl", hash = "sha256:31d556d079d72db7c584c0627ff3a24c5d3fb4f730221d3444f3efb1b2514776"}, + {file = "tomli-2.4.0-cp314-cp314-win_amd64.whl", hash = "sha256:43e685b9b2341681907759cf3a04e14d7104b3580f808cfde1dfdb60ada85475"}, + {file = "tomli-2.4.0-cp314-cp314-win_arm64.whl", hash = "sha256:3d895d56bd3f82ddd6faaff993c275efc2ff38e52322ea264122d72729dca2b2"}, + {file = "tomli-2.4.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:5b5807f3999fb66776dbce568cc9a828544244a8eb84b84b9bafc080c99597b9"}, + {file = "tomli-2.4.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c084ad935abe686bd9c898e62a02a19abfc9760b5a79bc29644463eaf2840cb0"}, + {file = "tomli-2.4.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0f2e3955efea4d1cfbcb87bc321e00dc08d2bcb737fd1d5e398af111d86db5df"}, + {file = "tomli-2.4.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0e0fe8a0b8312acf3a88077a0802565cb09ee34107813bba1c7cd591fa6cfc8d"}, + {file = "tomli-2.4.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:413540dce94673591859c4c6f794dfeaa845e98bf35d72ed59636f869ef9f86f"}, + {file = "tomli-2.4.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0dc56fef0e2c1c470aeac5b6ca8cc7b640bb93e92d9803ddaf9ea03e198f5b0b"}, + {file = "tomli-2.4.0-cp314-cp314t-win32.whl", hash = "sha256:d878f2a6707cc9d53a1be1414bbb419e629c3d6e67f69230217bb663e76b5087"}, + {file = "tomli-2.4.0-cp314-cp314t-win_amd64.whl", hash = "sha256:2add28aacc7425117ff6364fe9e06a183bb0251b03f986df0e78e974047571fd"}, + {file = "tomli-2.4.0-cp314-cp314t-win_arm64.whl", hash = "sha256:2b1e3b80e1d5e52e40e9b924ec43d81570f0e7d09d11081b797bc4692765a3d4"}, + {file = "tomli-2.4.0-py3-none-any.whl", hash = "sha256:1f776e7d669ebceb01dee46484485f43a4048746235e683bcdffacdf1fb4785a"}, + {file = "tomli-2.4.0.tar.gz", hash = "sha256:aa89c3f6c277dd275d8e243ad24f3b5e701491a860d5121f2cdd399fbb31fc9c"}, ] [[package]] @@ -554,102 +593,7 @@ files = [ {file = "typing_extensions-4.13.2.tar.gz", hash = "sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"}, ] -[[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 = "a531afb5127832a42cf10cb4a62d7f98f1a85f76739d6cfec3d1033e11764a01" +content-hash = "bcf31a142c86d9e556553c8c260a93b563ac64a043076dbd48b26111d422c26e" diff --git a/reference.md b/reference.md index 54899f1e..8e7fcede 100644 --- a/reference.md +++ b/reference.md @@ -163,6 +163,41 @@ client = DeepgramClient( api_key="YOUR_API_KEY", ) client.listen.v1.media.transcribe_url( + callback="callback", + callback_method="POST", + extra="extra", + sentiment=True, + summarize="v2", + tag="tag", + topics=True, + custom_topic="custom_topic", + custom_topic_mode="extended", + intents=True, + custom_intent="custom_intent", + custom_intent_mode="extended", + detect_entities=True, + detect_language=True, + diarize=True, + dictation=True, + encoding="linear16", + filler_words=True, + keywords="keywords", + language="language", + measurements=True, + model="nova-3", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact="redact", + replace="replace", + search="search", + smart_format=True, + utterances=True, + utt_split=1.1, + version="latest", + mip_opt_out=True, url="https://dpgr.am/spacewalk.wav", ) @@ -877,7 +912,9 @@ from deepgram import DeepgramClient client = DeepgramClient( api_key="YOUR_API_KEY", ) -client.manage.v1.models.list() +client.manage.v1.models.list( + include_outdated=True, +) ``` @@ -1078,6 +1115,8 @@ client = DeepgramClient( ) client.manage.v1.projects.get( project_id="123456-7890-1234-5678-901234", + limit=1.1, + page=1.1, ) ``` @@ -1383,6 +1422,7 @@ client = DeepgramClient( ) client.manage.v1.projects.keys.list( project_id="123456-7890-1234-5678-901234", + status="active", ) ``` @@ -1849,6 +1889,7 @@ client = DeepgramClient( ) client.manage.v1.projects.models.list( project_id="123456-7890-1234-5678-901234", + include_outdated=True, ) ``` @@ -2000,6 +2041,8 @@ Generates a list of requests for a specific project
```python +import datetime + from deepgram import DeepgramClient client = DeepgramClient( @@ -2007,8 +2050,20 @@ client = DeepgramClient( ) client.manage.v1.projects.requests.list( project_id="123456-7890-1234-5678-901234", + start=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + end=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + limit=1.1, + page=1.1, accessor="12345678-1234-1234-1234-123456789012", request_id="12345678-1234-1234-1234-123456789012", + deployment="hosted", + endpoint="listen", + method="sync", + status="succeeded", ) ``` @@ -2239,10 +2294,50 @@ client = DeepgramClient( ) client.manage.v1.projects.usage.get( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", accessor="12345678-1234-1234-1234-123456789012", + alternatives=True, + callback_method=True, + callback=True, + channels=True, + custom_intent_mode=True, + custom_intent=True, + custom_topic_mode=True, + custom_topic=True, + deployment="hosted", + detect_entities=True, + detect_language=True, + diarize=True, + dictation=True, + encoding=True, + endpoint="listen", + extra=True, + filler_words=True, + intents=True, + keyterm=True, + keywords=True, + language=True, + measurements=True, + method="sync", model="6f548761-c9c0-429a-9315-11a1d28499c8", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact=True, + replace=True, sample_rate=True, + search=True, + sentiment=True, + smart_format=True, + summarize=True, tag="tag1", + topics=True, + utt_split=True, + utterances=True, + version=True, ) ``` @@ -2816,7 +2911,10 @@ client = DeepgramClient( ) client.manage.v1.projects.billing.breakdown.list( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", accessor="12345678-1234-1234-1234-123456789012", + deployment="hosted", tag="tag1", line_item="streaming::nova-3", ) @@ -2951,6 +3049,8 @@ client = DeepgramClient( ) client.manage.v1.projects.billing.fields.list( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", ) ``` @@ -3038,6 +3138,7 @@ client = DeepgramClient( ) client.manage.v1.projects.billing.purchases.list( project_id="123456-7890-1234-5678-901234", + limit=1.1, ) ``` @@ -3523,10 +3624,51 @@ client = DeepgramClient( ) client.manage.v1.projects.usage.breakdown.get( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", + grouping="accessor", accessor="12345678-1234-1234-1234-123456789012", + alternatives=True, + callback_method=True, + callback=True, + channels=True, + custom_intent_mode=True, + custom_intent=True, + custom_topic_mode=True, + custom_topic=True, + deployment="hosted", + detect_entities=True, + detect_language=True, + diarize=True, + dictation=True, + encoding=True, + endpoint="listen", + extra=True, + filler_words=True, + intents=True, + keyterm=True, + keywords=True, + language=True, + measurements=True, + method="sync", model="6f548761-c9c0-429a-9315-11a1d28499c8", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact=True, + replace=True, sample_rate=True, + search=True, + sentiment=True, + smart_format=True, + summarize=True, tag="tag1", + topics=True, + utt_split=True, + utterances=True, + version=True, ) ``` @@ -3958,6 +4100,8 @@ client = DeepgramClient( ) client.manage.v1.projects.usage.fields.list( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", ) ``` @@ -4044,6 +4188,18 @@ client = DeepgramClient( api_key="YOUR_API_KEY", ) client.read.v1.text.analyze( + callback="callback", + callback_method="POST", + sentiment=True, + summarize="v2", + tag="tag", + topics=True, + custom_topic="custom_topic", + custom_topic_mode="extended", + intents=True, + custom_intent="custom_intent", + custom_intent_mode="extended", + language="language", request={"url": "url"}, ) 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 e4d9cf16..ebb89072 100644 --- a/src/deepgram/__init__.py +++ b/src/deepgram/__init__.py @@ -78,26 +78,6 @@ ListProjectsV1Response, ListProjectsV1ResponseProjectsItem, ListenV1AcceptedResponse, - ListenV1Callback, - ListenV1CallbackMethod, - ListenV1Channels, - ListenV1Diarize, - ListenV1Dictation, - ListenV1Encoding, - ListenV1Endpointing, - ListenV1Extra, - ListenV1InterimResults, - ListenV1Keyterm, - ListenV1Keywords, - ListenV1Language, - ListenV1MipOptOut, - ListenV1Model, - ListenV1Multichannel, - ListenV1Numerals, - ListenV1ProfanityFilter, - ListenV1Punctuate, - ListenV1Redact, - ListenV1Replace, ListenV1RequestFile, ListenV1Response, ListenV1ResponseMetadata, @@ -109,6 +89,7 @@ ListenV1ResponseResultsChannels, ListenV1ResponseResultsChannelsItem, ListenV1ResponseResultsChannelsItemAlternativesItem, + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem, ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs, ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem, ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem, @@ -121,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, @@ -165,11 +130,7 @@ SharedTopicsResultsTopics, SharedTopicsResultsTopicsSegmentsItem, SharedTopicsResultsTopicsSegmentsItemTopicsItem, - SpeakV1Encoding, - SpeakV1MipOptOut, - SpeakV1Model, SpeakV1Response, - SpeakV1SampleRate, UpdateProjectMemberScopesV1Response, UpdateProjectV1Response, UsageBreakdownV1Response, @@ -257,6 +218,7 @@ ListenV1ResponseMetadataSummaryInfoParams, ListenV1ResponseMetadataTopicsInfoParams, ListenV1ResponseParams, + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams, ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams, ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams, ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams, @@ -273,7 +235,6 @@ ListenV1ResponseResultsUtterancesItemParams, ListenV1ResponseResultsUtterancesItemWordsItemParams, ListenV1ResponseResultsUtterancesParams, - ListenV2KeytermParams, ProjectRequestResponseParams, ReadV1RequestParams, ReadV1RequestTextParams, @@ -455,26 +416,6 @@ "ListProjectsV1ResponseProjectsItemParams": ".requests", "ListenV1AcceptedResponse": ".types", "ListenV1AcceptedResponseParams": ".requests", - "ListenV1Callback": ".types", - "ListenV1CallbackMethod": ".types", - "ListenV1Channels": ".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", @@ -492,6 +433,8 @@ "ListenV1ResponseResultsChannels": ".types", "ListenV1ResponseResultsChannelsItem": ".types", "ListenV1ResponseResultsChannelsItemAlternativesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem": ".types", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams": ".requests", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs": ".types", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem": ".types", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams": ".requests", @@ -520,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", @@ -593,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", @@ -791,26 +713,6 @@ def __dir__(): "ListProjectsV1ResponseProjectsItemParams", "ListenV1AcceptedResponse", "ListenV1AcceptedResponseParams", - "ListenV1Callback", - "ListenV1CallbackMethod", - "ListenV1Channels", - "ListenV1Diarize", - "ListenV1Dictation", - "ListenV1Encoding", - "ListenV1Endpointing", - "ListenV1Extra", - "ListenV1InterimResults", - "ListenV1Keyterm", - "ListenV1Keywords", - "ListenV1Language", - "ListenV1MipOptOut", - "ListenV1Model", - "ListenV1Multichannel", - "ListenV1Numerals", - "ListenV1ProfanityFilter", - "ListenV1Punctuate", - "ListenV1Redact", - "ListenV1Replace", "ListenV1RequestFile", "ListenV1Response", "ListenV1ResponseMetadata", @@ -828,6 +730,8 @@ def __dir__(): "ListenV1ResponseResultsChannels", "ListenV1ResponseResultsChannelsItem", "ListenV1ResponseResultsChannelsItemAlternativesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams", @@ -856,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", @@ -929,11 +816,7 @@ def __dir__(): "SharedTopicsResultsTopicsSegmentsItemParams", "SharedTopicsResultsTopicsSegmentsItemTopicsItem", "SharedTopicsResultsTopicsSegmentsItemTopicsItemParams", - "SpeakV1Encoding", - "SpeakV1MipOptOut", - "SpeakV1Model", "SpeakV1Response", - "SpeakV1SampleRate", "UpdateProjectMemberScopesV1Response", "UpdateProjectMemberScopesV1ResponseParams", "UpdateProjectV1Response", diff --git a/src/deepgram/agent/v1/client.py b/src/deepgram/agent/v1/client.py index 05f2854d..3288510b 100644 --- a/src/deepgram/agent/v1/client.py +++ b/src/deepgram/agent/v1/client.py @@ -3,24 +3,13 @@ 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): @@ -39,50 +28,6 @@ def with_raw_response(self) -> 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: @@ -109,50 +54,6 @@ def with_raw_response(self) -> 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 index cd8e8d06..82da8718 100644 --- a/src/deepgram/agent/v1/raw_client.py +++ b/src/deepgram/agent/v1/raw_client.py @@ -1,114 +1,13 @@ # 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/settings/think/models/raw_client.py b/src/deepgram/agent/v1/settings/think/models/raw_client.py index 5f01114b..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, ) @@ -52,9 +51,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -105,9 +103,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/auth/v1/tokens/raw_client.py b/src/deepgram/auth/v1/tokens/raw_client.py index ee5c535a..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, @@ -65,9 +64,9 @@ def grant( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -128,9 +126,9 @@ async def grant( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), 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/http_client.py b/src/deepgram/core/http_client.py index e4173f99..f4a7c071 100644 --- a/src/deepgram/core/http_client.py +++ b/src/deepgram/core/http_client.py @@ -14,13 +14,13 @@ from .force_multipart import FORCE_MULTIPART from .jsonable_encoder import jsonable_encoder from .query_encoder import encode_query -from .remove_none_from_dict import remove_none_from_dict +from .remove_none_from_dict import remove_none_from_dict as remove_none_from_dict from .request_options import RequestOptions from httpx._types import RequestFiles -INITIAL_RETRY_DELAY_SECONDS = 0.5 -MAX_RETRY_DELAY_SECONDS = 10 -MAX_RETRY_DELAY_SECONDS_FROM_HEADER = 30 +INITIAL_RETRY_DELAY_SECONDS = 1.0 +MAX_RETRY_DELAY_SECONDS = 60.0 +JITTER_FACTOR = 0.2 # 20% random jitter def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float]: @@ -64,6 +64,38 @@ def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float return seconds +def _add_positive_jitter(delay: float) -> float: + """Add positive jitter (0-20%) to prevent thundering herd.""" + jitter_multiplier = 1 + random() * JITTER_FACTOR + return delay * jitter_multiplier + + +def _add_symmetric_jitter(delay: float) -> float: + """Add symmetric jitter (±10%) for exponential backoff.""" + jitter_multiplier = 1 + (random() - 0.5) * JITTER_FACTOR + return delay * jitter_multiplier + + +def _parse_x_ratelimit_reset(response_headers: httpx.Headers) -> typing.Optional[float]: + """ + Parse the X-RateLimit-Reset header (Unix timestamp in seconds). + Returns seconds to wait, or None if header is missing/invalid. + """ + reset_time_str = response_headers.get("x-ratelimit-reset") + if reset_time_str is None: + return None + + try: + reset_time = int(reset_time_str) + delay = reset_time - time.time() + if delay > 0: + return delay + except (ValueError, TypeError): + pass + + return None + + def _retry_timeout(response: httpx.Response, retries: int) -> float: """ Determine the amount of time to wait before retrying a request. @@ -71,17 +103,19 @@ def _retry_timeout(response: httpx.Response, retries: int) -> float: with a jitter to determine the number of seconds to wait. """ - # If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says. + # 1. Check Retry-After header first retry_after = _parse_retry_after(response.headers) - if retry_after is not None and retry_after <= MAX_RETRY_DELAY_SECONDS_FROM_HEADER: - return retry_after + if retry_after is not None and retry_after > 0: + return min(retry_after, MAX_RETRY_DELAY_SECONDS) - # Apply exponential backoff, capped at MAX_RETRY_DELAY_SECONDS. - retry_delay = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + # 2. Check X-RateLimit-Reset header (with positive jitter) + ratelimit_reset = _parse_x_ratelimit_reset(response.headers) + if ratelimit_reset is not None: + return _add_positive_jitter(min(ratelimit_reset, MAX_RETRY_DELAY_SECONDS)) - # Add a randomness / jitter to the retry delay to avoid overwhelming the server with retries. - timeout = retry_delay * (1 - 0.25 * random()) - return timeout if timeout >= 0 else 0 + # 3. Fall back to exponential backoff (with symmetric jitter) + backoff = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + return _add_symmetric_jitter(backoff) def _should_retry(response: httpx.Response) -> bool: @@ -89,6 +123,21 @@ def _should_retry(response: httpx.Response) -> bool: return response.status_code >= 500 or response.status_code in retryable_400s +def _maybe_filter_none_from_multipart_data( + data: typing.Optional[typing.Any], + request_files: typing.Optional[RequestFiles], + force_multipart: typing.Optional[bool], +) -> typing.Optional[typing.Any]: + """ + Filter None values from data body for multipart/form requests. + This prevents httpx from converting None to empty strings in multipart encoding. + Only applies when files are present or force_multipart is True. + """ + if data is not None and isinstance(data, typing.Mapping) and (request_files or force_multipart): + return remove_none_from_dict(data) + return data + + def remove_omit_from_dict( original: typing.Dict[str, typing.Optional[typing.Any]], omit: typing.Optional[typing.Any], @@ -210,6 +259,8 @@ def request( if (request_files is None or len(request_files) == 0) and force_multipart: request_files = FORCE_MULTIPART + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + response = self.httpx_client.request( method=method, url=urllib.parse.urljoin(f"{base_url}/", path), @@ -307,6 +358,8 @@ def stream( json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + with self.httpx_client.stream( method=method, url=urllib.parse.urljoin(f"{base_url}/", path), @@ -353,12 +406,19 @@ def __init__( base_timeout: typing.Callable[[], typing.Optional[float]], base_headers: typing.Callable[[], typing.Dict[str, str]], base_url: typing.Optional[typing.Callable[[], str]] = None, + async_base_headers: typing.Optional[typing.Callable[[], typing.Awaitable[typing.Dict[str, str]]]] = None, ): self.base_url = base_url self.base_timeout = base_timeout self.base_headers = base_headers + self.async_base_headers = async_base_headers self.httpx_client = httpx_client + async def _get_headers(self) -> typing.Dict[str, str]: + if self.async_base_headers is not None: + return await self.async_base_headers() + return self.base_headers() + def get_base_url(self, maybe_base_url: typing.Optional[str]) -> str: base_url = maybe_base_url if self.base_url is not None and base_url is None: @@ -408,6 +468,11 @@ async def request( json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Get headers (supports async token providers) + _headers = await self._get_headers() + # Add the input to each of these and do None-safety checks response = await self.httpx_client.request( method=method, @@ -415,7 +480,7 @@ async def request( headers=jsonable_encoder( remove_none_from_dict( { - **self.base_headers(), + **_headers, **(headers if headers is not None else {}), **(request_options.get("additional_headers", {}) or {} if request_options is not None else {}), } @@ -505,13 +570,18 @@ async def stream( json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Get headers (supports async token providers) + _headers = await self._get_headers() + async with self.httpx_client.stream( method=method, url=urllib.parse.urljoin(f"{base_url}/", path), headers=jsonable_encoder( remove_none_from_dict( { - **self.base_headers(), + **_headers, **(headers if headers is not None else {}), **(request_options.get("additional_headers", {}) if request_options is not None else {}), } diff --git a/src/deepgram/core/http_sse/__init__.py b/src/deepgram/core/http_sse/__init__.py new file mode 100644 index 00000000..730e5a33 --- /dev/null +++ b/src/deepgram/core/http_sse/__init__.py @@ -0,0 +1,42 @@ +# 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 ._api import EventSource, aconnect_sse, connect_sse + from ._exceptions import SSEError + from ._models import ServerSentEvent +_dynamic_imports: typing.Dict[str, str] = { + "EventSource": "._api", + "SSEError": "._exceptions", + "ServerSentEvent": "._models", + "aconnect_sse": "._api", + "connect_sse": "._api", +} + + +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__ = ["EventSource", "SSEError", "ServerSentEvent", "aconnect_sse", "connect_sse"] diff --git a/src/deepgram/core/http_sse/_api.py b/src/deepgram/core/http_sse/_api.py new file mode 100644 index 00000000..f900b3b6 --- /dev/null +++ b/src/deepgram/core/http_sse/_api.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +import re +from contextlib import asynccontextmanager, contextmanager +from typing import Any, AsyncGenerator, AsyncIterator, Iterator, cast + +import httpx +from ._decoders import SSEDecoder +from ._exceptions import SSEError +from ._models import ServerSentEvent + + +class EventSource: + def __init__(self, response: httpx.Response) -> None: + self._response = response + + def _check_content_type(self) -> None: + content_type = self._response.headers.get("content-type", "").partition(";")[0] + if "text/event-stream" not in content_type: + raise SSEError( + f"Expected response header Content-Type to contain 'text/event-stream', got {content_type!r}" + ) + + def _get_charset(self) -> str: + """Extract charset from Content-Type header, fallback to UTF-8.""" + content_type = self._response.headers.get("content-type", "") + + # Parse charset parameter using regex + charset_match = re.search(r"charset=([^;\s]+)", content_type, re.IGNORECASE) + if charset_match: + charset = charset_match.group(1).strip("\"'") + # Validate that it's a known encoding + try: + # Test if the charset is valid by trying to encode/decode + "test".encode(charset).decode(charset) + return charset + except (LookupError, UnicodeError): + # If charset is invalid, fall back to UTF-8 + pass + + # Default to UTF-8 if no charset specified or invalid charset + return "utf-8" + + @property + def response(self) -> httpx.Response: + return self._response + + def iter_sse(self) -> Iterator[ServerSentEvent]: + self._check_content_type() + decoder = SSEDecoder() + charset = self._get_charset() + + buffer = "" + for chunk in self._response.iter_bytes(): + # Decode chunk using detected charset + text_chunk = chunk.decode(charset, errors="replace") + buffer += text_chunk + + # Process complete lines + while "\n" in buffer: + line, buffer = buffer.split("\n", 1) + line = line.rstrip("\r") + sse = decoder.decode(line) + # when we reach a "\n\n" => line = '' + # => decoder will attempt to return an SSE Event + if sse is not None: + yield sse + + # Process any remaining data in buffer + if buffer.strip(): + line = buffer.rstrip("\r") + sse = decoder.decode(line) + if sse is not None: + yield sse + + async def aiter_sse(self) -> AsyncGenerator[ServerSentEvent, None]: + self._check_content_type() + decoder = SSEDecoder() + lines = cast(AsyncGenerator[str, None], self._response.aiter_lines()) + try: + async for line in lines: + line = line.rstrip("\n") + sse = decoder.decode(line) + if sse is not None: + yield sse + finally: + await lines.aclose() + + +@contextmanager +def connect_sse(client: httpx.Client, method: str, url: str, **kwargs: Any) -> Iterator[EventSource]: + headers = kwargs.pop("headers", {}) + headers["Accept"] = "text/event-stream" + headers["Cache-Control"] = "no-store" + + with client.stream(method, url, headers=headers, **kwargs) as response: + yield EventSource(response) + + +@asynccontextmanager +async def aconnect_sse( + client: httpx.AsyncClient, + method: str, + url: str, + **kwargs: Any, +) -> AsyncIterator[EventSource]: + headers = kwargs.pop("headers", {}) + headers["Accept"] = "text/event-stream" + headers["Cache-Control"] = "no-store" + + async with client.stream(method, url, headers=headers, **kwargs) as response: + yield EventSource(response) diff --git a/src/deepgram/core/http_sse/_decoders.py b/src/deepgram/core/http_sse/_decoders.py new file mode 100644 index 00000000..339b0890 --- /dev/null +++ b/src/deepgram/core/http_sse/_decoders.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import List, Optional + +from ._models import ServerSentEvent + + +class SSEDecoder: + def __init__(self) -> None: + self._event = "" + self._data: List[str] = [] + self._last_event_id = "" + self._retry: Optional[int] = None + + def decode(self, line: str) -> Optional[ServerSentEvent]: + # See: https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation # noqa: E501 + + if not line: + if not self._event and not self._data and not self._last_event_id and self._retry is None: + return None + + sse = ServerSentEvent( + event=self._event, + data="\n".join(self._data), + id=self._last_event_id, + retry=self._retry, + ) + + # NOTE: as per the SSE spec, do not reset last_event_id. + self._event = "" + self._data = [] + self._retry = None + + return sse + + if line.startswith(":"): + return None + + fieldname, _, value = line.partition(":") + + if value.startswith(" "): + value = value[1:] + + if fieldname == "event": + self._event = value + elif fieldname == "data": + self._data.append(value) + elif fieldname == "id": + if "\0" in value: + pass + else: + self._last_event_id = value + elif fieldname == "retry": + try: + self._retry = int(value) + except (TypeError, ValueError): + pass + else: + pass # Field is ignored. + + return None diff --git a/src/deepgram/listen/v2/__init__.py b/src/deepgram/core/http_sse/_exceptions.py similarity index 51% rename from src/deepgram/listen/v2/__init__.py rename to src/deepgram/core/http_sse/_exceptions.py index 5cde0202..81605a8a 100644 --- a/src/deepgram/listen/v2/__init__.py +++ b/src/deepgram/core/http_sse/_exceptions.py @@ -1,4 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -# isort: skip_file +import httpx + +class SSEError(httpx.TransportError): + pass diff --git a/src/deepgram/core/http_sse/_models.py b/src/deepgram/core/http_sse/_models.py new file mode 100644 index 00000000..1af57f8f --- /dev/null +++ b/src/deepgram/core/http_sse/_models.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +from dataclasses import dataclass +from typing import Any, Optional + + +@dataclass(frozen=True) +class ServerSentEvent: + event: str = "message" + data: str = "" + id: str = "" + retry: Optional[int] = None + + def json(self) -> Any: + """Parse the data field as JSON.""" + return json.loads(self.data) diff --git a/src/deepgram/core/pydantic_utilities.py b/src/deepgram/core/pydantic_utilities.py index 8906cdfa..185e5c4f 100644 --- a/src/deepgram/core/pydantic_utilities.py +++ b/src/deepgram/core/pydantic_utilities.py @@ -220,7 +220,9 @@ def universal_root_validator( ) -> Callable[[AnyCallable], AnyCallable]: def decorator(func: AnyCallable) -> AnyCallable: if IS_PYDANTIC_V2: - return cast(AnyCallable, pydantic.model_validator(mode="before" if pre else "after")(func)) # type: ignore[attr-defined] + # In Pydantic v2, for RootModel we always use "before" mode + # The custom validators transform the input value before the model is created + return cast(AnyCallable, pydantic.model_validator(mode="before")(func)) # type: ignore[attr-defined] return cast(AnyCallable, pydantic.root_validator(pre=pre)(func)) # type: ignore[call-overload] return decorator 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/errors/bad_request_error.py b/src/deepgram/errors/bad_request_error.py index baf5be4f..ec78e269 100644 --- a/src/deepgram/errors/bad_request_error.py +++ b/src/deepgram/errors/bad_request_error.py @@ -6,5 +6,5 @@ class BadRequestError(ApiError): - def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None): + def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): super().__init__(status_code=400, headers=headers, body=body) diff --git a/src/deepgram/listen/__init__.py b/src/deepgram/listen/__init__.py index 6186f5b4..148ad154 100644 --- a/src/deepgram/listen/__init__.py +++ b/src/deepgram/listen/__init__.py @@ -6,8 +6,8 @@ from importlib import import_module if typing.TYPE_CHECKING: - from . import v1, v2 -_dynamic_imports: typing.Dict[str, str] = {"v1": ".v1", "v2": ".v2"} + from . import v1 +_dynamic_imports: typing.Dict[str, str] = {"v1": ".v1"} def __getattr__(attr_name: str) -> typing.Any: @@ -31,4 +31,4 @@ def __dir__(): return sorted(lazy_attrs) -__all__ = ["v1", "v2"] +__all__ = ["v1"] diff --git a/src/deepgram/listen/v1/client.py b/src/deepgram/listen/v1/client.py index cf0110ef..769702cc 100644 --- a/src/deepgram/listen/v1/client.py +++ b/src/deepgram/listen/v1/client.py @@ -3,25 +3,13 @@ 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): @@ -40,219 +28,6 @@ def with_raw_response(self) -> 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, - diarize: typing.Optional[str] = None, - dictation: typing.Optional[str] = None, - encoding: typing.Optional[str] = None, - endpointing: typing.Optional[str] = None, - extra: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - keywords: typing.Optional[typing.Union[str, typing.Sequence[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[typing.Union[str, typing.Sequence[str]]] = None, - replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - sample_rate: typing.Optional[str] = None, - search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - smart_format: typing.Optional[str] = None, - tag: typing.Optional[typing.Union[str, typing.Sequence[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] - - 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 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: - if isinstance(extra, (list, tuple)): - for item in extra: - query_params = query_params.add("extra", str(item)) - else: - 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: - if isinstance(keyterm, (list, tuple)): - for term in keyterm: - query_params = query_params.add("keyterm", str(term)) - else: - query_params = query_params.add("keyterm", keyterm) - if keywords is not None: - if isinstance(keywords, (list, tuple)): - for keyword in keywords: - query_params = query_params.add("keywords", str(keyword)) - else: - 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: - if isinstance(redact, (list, tuple)): - for item in redact: - query_params = query_params.add("redact", str(item)) - else: - query_params = query_params.add("redact", redact) - if replace is not None: - if isinstance(replace, (list, tuple)): - for item in replace: - query_params = query_params.add("replace", str(item)) - else: - 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: - if isinstance(search, (list, tuple)): - for item in search: - query_params = query_params.add("search", str(item)) - else: - 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: - if isinstance(tag, (list, tuple)): - for item in tag: - query_params = query_params.add("tag", str(item)) - else: - 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: @@ -279,219 +54,6 @@ def with_raw_response(self) -> 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, - diarize: typing.Optional[str] = None, - dictation: typing.Optional[str] = None, - encoding: typing.Optional[str] = None, - endpointing: typing.Optional[str] = None, - extra: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - interim_results: typing.Optional[str] = None, - keyterm: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - keywords: typing.Optional[typing.Union[str, typing.Sequence[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[typing.Union[str, typing.Sequence[str]]] = None, - replace: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - sample_rate: typing.Optional[str] = None, - search: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, - smart_format: typing.Optional[str] = None, - tag: typing.Optional[typing.Union[str, typing.Sequence[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] - - 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 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: - if isinstance(extra, (list, tuple)): - for item in extra: - query_params = query_params.add("extra", str(item)) - else: - 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: - if isinstance(keyterm, (list, tuple)): - for term in keyterm: - query_params = query_params.add("keyterm", str(term)) - else: - query_params = query_params.add("keyterm", keyterm) - if keywords is not None: - if isinstance(keywords, (list, tuple)): - for keyword in keywords: - query_params = query_params.add("keywords", str(keyword)) - else: - 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: - if isinstance(redact, (list, tuple)): - for item in redact: - query_params = query_params.add("redact", str(item)) - else: - query_params = query_params.add("redact", redact) - if replace is not None: - if isinstance(replace, (list, tuple)): - for item in replace: - query_params = query_params.add("replace", str(item)) - else: - 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: - if isinstance(search, (list, tuple)): - for item in search: - query_params = query_params.add("search", str(item)) - else: - 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: - if isinstance(tag, (list, tuple)): - for item in tag: - query_params = query_params.add("tag", str(item)) - else: - 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/client.py b/src/deepgram/listen/v1/media/client.py index 047dfac4..ab81ae3b 100644 --- a/src/deepgram/listen/v1/media/client.py +++ b/src/deepgram/listen/v1/media/client.py @@ -206,6 +206,41 @@ def transcribe_url( api_key="YOUR_API_KEY", ) client.listen.v1.media.transcribe_url( + callback="callback", + callback_method="POST", + extra="extra", + sentiment=True, + summarize="v2", + tag="tag", + topics=True, + custom_topic="custom_topic", + custom_topic_mode="extended", + intents=True, + custom_intent="custom_intent", + custom_intent_mode="extended", + detect_entities=True, + detect_language=True, + diarize=True, + dictation=True, + encoding="linear16", + filler_words=True, + keywords="keywords", + language="language", + measurements=True, + model="nova-3", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact="redact", + replace="replace", + search="search", + smart_format=True, + utterances=True, + utt_split=1.1, + version="latest", + mip_opt_out=True, url="https://dpgr.am/spacewalk.wav", ) """ @@ -661,6 +696,41 @@ async def transcribe_url( async def main() -> None: await client.listen.v1.media.transcribe_url( + callback="callback", + callback_method="POST", + extra="extra", + sentiment=True, + summarize="v2", + tag="tag", + topics=True, + custom_topic="custom_topic", + custom_topic_mode="extended", + intents=True, + custom_intent="custom_intent", + custom_intent_mode="extended", + detect_entities=True, + detect_language=True, + diarize=True, + dictation=True, + encoding="linear16", + filler_words=True, + keywords="keywords", + language="language", + measurements=True, + model="nova-3", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact="redact", + replace="replace", + search="search", + smart_format=True, + utterances=True, + utt_split=1.1, + version="latest", + mip_opt_out=True, url="https://dpgr.am/spacewalk.wav", ) diff --git a/src/deepgram/listen/v1/media/raw_client.py b/src/deepgram/listen/v1/media/raw_client.py index 6cdeccc8..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, @@ -256,9 +255,9 @@ def transcribe_url( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -496,9 +494,9 @@ def transcribe_file( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -743,9 +740,9 @@ async def transcribe_url( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -983,9 +979,9 @@ async def transcribe_file( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/listen/v1/media/types/media_transcribe_request_summarize.py b/src/deepgram/listen/v1/media/types/media_transcribe_request_summarize.py index f09d6785..cc44a279 100644 --- a/src/deepgram/listen/v1/media/types/media_transcribe_request_summarize.py +++ b/src/deepgram/listen/v1/media/types/media_transcribe_request_summarize.py @@ -2,4 +2,4 @@ import typing -MediaTranscribeRequestSummarize = typing.Union[typing.Literal["v2", "v1"], typing.Any] +MediaTranscribeRequestSummarize = typing.Union[typing.Literal["v2"], typing.Any] diff --git a/src/deepgram/listen/v1/raw_client.py b/src/deepgram/listen/v1/raw_client.py index 81311319..82da8718 100644 --- a/src/deepgram/listen/v1/raw_client.py +++ b/src/deepgram/listen/v1/raw_client.py @@ -1,397 +1,13 @@ # 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, - 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] - - 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 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, - 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] - - 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 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/v2/client.py b/src/deepgram/listen/v2/client.py deleted file mode 100644 index 415bf99e..00000000 --- a/src/deepgram/listen/v2/client.py +++ /dev/null @@ -1,260 +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[typing.Union[str, typing.Sequence[str]]] = None, - mip_opt_out: typing.Optional[str] = None, - tag: typing.Optional[typing.Union[str, typing.Sequence[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[typing.Union[str, typing.Sequence[str]]] - Keyterm prompting can improve recognition of specialized terminology. Pass a single string or a list of strings. - - mip_opt_out : typing.Optional[str] - - tag : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Label your requests for the purpose of identification during usage reporting. Pass a single string or a list of strings. - - 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: - if isinstance(keyterm, (list, tuple)): - for term in keyterm: - query_params = query_params.add("keyterm", str(term)) - else: - 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: - if isinstance(tag, (list, tuple)): - for t in tag: - query_params = query_params.add("tag", str(t)) - else: - 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[typing.Union[str, typing.Sequence[str]]] = None, - mip_opt_out: typing.Optional[str] = None, - tag: typing.Optional[typing.Union[str, typing.Sequence[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[typing.Union[str, typing.Sequence[str]]] - Keyterm prompting can improve recognition of specialized terminology. Pass a single string or a list of strings. - - mip_opt_out : typing.Optional[str] - - tag : typing.Optional[typing.Union[str, typing.Sequence[str]]] - Label your requests for the purpose of identification during usage reporting. Pass a single string or a list of strings. - - 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: - if isinstance(keyterm, (list, tuple)): - for term in keyterm: - query_params = query_params.add("keyterm", str(term)) - else: - 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: - if isinstance(tag, (list, tuple)): - for t in tag: - query_params = query_params.add("tag", str(t)) - else: - 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/manage/v1/models/client.py b/src/deepgram/manage/v1/models/client.py index bc16c9e1..9ae001ca 100644 --- a/src/deepgram/manage/v1/models/client.py +++ b/src/deepgram/manage/v1/models/client.py @@ -50,7 +50,9 @@ def list( client = DeepgramClient( api_key="YOUR_API_KEY", ) - client.manage.v1.models.list() + client.manage.v1.models.list( + include_outdated=True, + ) """ _response = self._raw_client.list(include_outdated=include_outdated, request_options=request_options) return _response.data @@ -133,7 +135,9 @@ async def list( async def main() -> None: - await client.manage.v1.models.list() + await client.manage.v1.models.list( + include_outdated=True, + ) asyncio.run(main()) diff --git a/src/deepgram/manage/v1/models/raw_client.py b/src/deepgram/manage/v1/models/raw_client.py index d45d210d..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, @@ -60,9 +59,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -111,9 +109,9 @@ def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -170,9 +167,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -221,9 +217,9 @@ async def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), 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 50850c3b..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, ) @@ -57,9 +56,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -111,9 +109,9 @@ def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -167,9 +164,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -221,9 +217,9 @@ async def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/billing/breakdown/client.py b/src/deepgram/manage/v1/projects/billing/breakdown/client.py index 5ccef016..34bfbcf0 100644 --- a/src/deepgram/manage/v1/projects/billing/breakdown/client.py +++ b/src/deepgram/manage/v1/projects/billing/breakdown/client.py @@ -86,7 +86,10 @@ def list( ) client.manage.v1.projects.billing.breakdown.list( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", accessor="12345678-1234-1234-1234-123456789012", + deployment="hosted", tag="tag1", line_item="streaming::nova-3", ) @@ -186,7 +189,10 @@ async def list( async def main() -> None: await client.manage.v1.projects.billing.breakdown.list( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", accessor="12345678-1234-1234-1234-123456789012", + deployment="hosted", tag="tag1", line_item="streaming::nova-3", ) 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 2646fe70..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, @@ -100,9 +99,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -198,9 +196,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/billing/fields/client.py b/src/deepgram/manage/v1/projects/billing/fields/client.py index 00682a0d..749103cc 100644 --- a/src/deepgram/manage/v1/projects/billing/fields/client.py +++ b/src/deepgram/manage/v1/projects/billing/fields/client.py @@ -62,6 +62,8 @@ def list( ) client.manage.v1.projects.billing.fields.list( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", ) """ _response = self._raw_client.list(project_id, start=start, end=end, request_options=request_options) @@ -127,6 +129,8 @@ async def list( async def main() -> None: await client.manage.v1.projects.billing.fields.list( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", ) 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 6ed0b2b3..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, @@ -71,9 +70,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -142,9 +140,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/billing/purchases/client.py b/src/deepgram/manage/v1/projects/billing/purchases/client.py index 7bed75c3..7afe4f92 100644 --- a/src/deepgram/manage/v1/projects/billing/purchases/client.py +++ b/src/deepgram/manage/v1/projects/billing/purchases/client.py @@ -58,6 +58,7 @@ def list( ) client.manage.v1.projects.billing.purchases.list( project_id="123456-7890-1234-5678-901234", + limit=1.1, ) """ _response = self._raw_client.list(project_id, limit=limit, request_options=request_options) @@ -119,6 +120,7 @@ async def list( async def main() -> None: await client.manage.v1.projects.billing.purchases.list( project_id="123456-7890-1234-5678-901234", + limit=1.1, ) 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 e5cd7b16..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, @@ -66,9 +65,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -132,9 +130,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/client.py b/src/deepgram/manage/v1/projects/client.py index 439f0220..33b0fc8c 100644 --- a/src/deepgram/manage/v1/projects/client.py +++ b/src/deepgram/manage/v1/projects/client.py @@ -111,6 +111,8 @@ def get( ) client.manage.v1.projects.get( project_id="123456-7890-1234-5678-901234", + limit=1.1, + page=1.1, ) """ _response = self._raw_client.get(project_id, limit=limit, page=page, request_options=request_options) @@ -371,6 +373,8 @@ async def get( async def main() -> None: await client.manage.v1.projects.get( project_id="123456-7890-1234-5678-901234", + limit=1.1, + page=1.1, ) diff --git a/src/deepgram/manage/v1/projects/keys/client.py b/src/deepgram/manage/v1/projects/keys/client.py index 88885f1e..698bf841 100644 --- a/src/deepgram/manage/v1/projects/keys/client.py +++ b/src/deepgram/manage/v1/projects/keys/client.py @@ -66,6 +66,7 @@ def list( ) client.manage.v1.projects.keys.list( project_id="123456-7890-1234-5678-901234", + status="active", ) """ _response = self._raw_client.list(project_id, status=status, request_options=request_options) @@ -241,6 +242,7 @@ async def list( async def main() -> None: await client.manage.v1.projects.keys.list( project_id="123456-7890-1234-5678-901234", + status="active", ) diff --git a/src/deepgram/manage/v1/projects/keys/raw_client.py b/src/deepgram/manage/v1/projects/keys/raw_client.py index df7164ab..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, @@ -74,9 +73,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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={ @@ -136,9 +134,9 @@ def create( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -190,9 +187,9 @@ def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -244,9 +240,9 @@ def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -310,9 +305,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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={ @@ -372,9 +366,9 @@ async def create( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -426,9 +419,9 @@ async def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -480,9 +472,9 @@ async def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), 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 73d10c43..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, ) @@ -61,9 +60,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -126,9 +124,9 @@ def create( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -180,9 +177,9 @@ def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -236,9 +232,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -301,9 +296,9 @@ async def create( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -355,9 +349,9 @@ async def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/members/raw_client.py b/src/deepgram/manage/v1/projects/members/raw_client.py index 7b9982f4..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, ) @@ -57,9 +56,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -111,9 +109,9 @@ def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -167,9 +164,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -221,9 +217,9 @@ async def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), 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 ecf3a872..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, ) @@ -63,9 +62,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -127,9 +125,9 @@ def update( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -186,9 +183,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -250,9 +246,9 @@ async def update( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/models/client.py b/src/deepgram/manage/v1/projects/models/client.py index 6ff8474f..9f78ba4d 100644 --- a/src/deepgram/manage/v1/projects/models/client.py +++ b/src/deepgram/manage/v1/projects/models/client.py @@ -59,6 +59,7 @@ def list( ) client.manage.v1.projects.models.list( project_id="123456-7890-1234-5678-901234", + include_outdated=True, ) """ _response = self._raw_client.list( @@ -159,6 +160,7 @@ async def list( async def main() -> None: await client.manage.v1.projects.models.list( project_id="123456-7890-1234-5678-901234", + include_outdated=True, ) diff --git a/src/deepgram/manage/v1/projects/models/raw_client.py b/src/deepgram/manage/v1/projects/models/raw_client.py index 15313ceb..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, @@ -67,9 +66,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -121,9 +119,9 @@ def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -187,9 +184,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -241,9 +237,9 @@ async def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/raw_client.py b/src/deepgram/manage/v1/projects/raw_client.py index 935c3d4a..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, ) @@ -58,9 +57,9 @@ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> Ht raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -124,9 +122,9 @@ def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -175,9 +172,9 @@ def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -240,9 +236,9 @@ def update( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -291,9 +286,9 @@ def leave( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -344,9 +338,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -410,9 +403,9 @@ async def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -461,9 +453,9 @@ async def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -526,9 +517,9 @@ async def update( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -577,9 +567,9 @@ async def leave( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/requests/client.py b/src/deepgram/manage/v1/projects/requests/client.py index a8e0246d..6d1435aa 100644 --- a/src/deepgram/manage/v1/projects/requests/client.py +++ b/src/deepgram/manage/v1/projects/requests/client.py @@ -93,6 +93,8 @@ def list( Examples -------- + import datetime + from deepgram import DeepgramClient client = DeepgramClient( @@ -100,8 +102,20 @@ def list( ) client.manage.v1.projects.requests.list( project_id="123456-7890-1234-5678-901234", + start=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + end=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + limit=1.1, + page=1.1, accessor="12345678-1234-1234-1234-123456789012", request_id="12345678-1234-1234-1234-123456789012", + deployment="hosted", + endpoint="listen", + method="sync", + status="succeeded", ) """ _response = self._raw_client.list( @@ -238,6 +252,7 @@ async def list( Examples -------- import asyncio + import datetime from deepgram import AsyncDeepgramClient @@ -249,8 +264,20 @@ async def list( async def main() -> None: await client.manage.v1.projects.requests.list( project_id="123456-7890-1234-5678-901234", + start=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + end=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + limit=1.1, + page=1.1, accessor="12345678-1234-1234-1234-123456789012", request_id="12345678-1234-1234-1234-123456789012", + deployment="hosted", + endpoint="listen", + method="sync", + status="succeeded", ) diff --git a/src/deepgram/manage/v1/projects/requests/raw_client.py b/src/deepgram/manage/v1/projects/requests/raw_client.py index d1b335c6..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, @@ -118,9 +117,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -172,9 +170,9 @@ def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -283,9 +280,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -337,9 +333,9 @@ async def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/usage/breakdown/client.py b/src/deepgram/manage/v1/projects/usage/breakdown/client.py index 57532bbd..1f0822cb 100644 --- a/src/deepgram/manage/v1/projects/usage/breakdown/client.py +++ b/src/deepgram/manage/v1/projects/usage/breakdown/client.py @@ -238,10 +238,51 @@ def get( ) client.manage.v1.projects.usage.breakdown.get( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", + grouping="accessor", accessor="12345678-1234-1234-1234-123456789012", + alternatives=True, + callback_method=True, + callback=True, + channels=True, + custom_intent_mode=True, + custom_intent=True, + custom_topic_mode=True, + custom_topic=True, + deployment="hosted", + detect_entities=True, + detect_language=True, + diarize=True, + dictation=True, + encoding=True, + endpoint="listen", + extra=True, + filler_words=True, + intents=True, + keyterm=True, + keywords=True, + language=True, + measurements=True, + method="sync", model="6f548761-c9c0-429a-9315-11a1d28499c8", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact=True, + replace=True, sample_rate=True, + search=True, + sentiment=True, + smart_format=True, + summarize=True, tag="tag1", + topics=True, + utt_split=True, + utterances=True, + version=True, ) """ _response = self._raw_client.get( @@ -527,10 +568,51 @@ async def get( async def main() -> None: await client.manage.v1.projects.usage.breakdown.get( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", + grouping="accessor", accessor="12345678-1234-1234-1234-123456789012", + alternatives=True, + callback_method=True, + callback=True, + channels=True, + custom_intent_mode=True, + custom_intent=True, + custom_topic_mode=True, + custom_topic=True, + deployment="hosted", + detect_entities=True, + detect_language=True, + diarize=True, + dictation=True, + encoding=True, + endpoint="listen", + extra=True, + filler_words=True, + intents=True, + keyterm=True, + keywords=True, + language=True, + measurements=True, + method="sync", model="6f548761-c9c0-429a-9315-11a1d28499c8", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact=True, + replace=True, sample_rate=True, + search=True, + sentiment=True, + smart_format=True, + summarize=True, tag="tag1", + topics=True, + utt_split=True, + utterances=True, + version=True, ) 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 93cfb095..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, @@ -290,9 +289,9 @@ def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -576,9 +574,9 @@ async def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/usage/client.py b/src/deepgram/manage/v1/projects/usage/client.py index d2c1c7e0..6ffad7f2 100644 --- a/src/deepgram/manage/v1/projects/usage/client.py +++ b/src/deepgram/manage/v1/projects/usage/client.py @@ -242,10 +242,50 @@ def get( ) client.manage.v1.projects.usage.get( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", accessor="12345678-1234-1234-1234-123456789012", + alternatives=True, + callback_method=True, + callback=True, + channels=True, + custom_intent_mode=True, + custom_intent=True, + custom_topic_mode=True, + custom_topic=True, + deployment="hosted", + detect_entities=True, + detect_language=True, + diarize=True, + dictation=True, + encoding=True, + endpoint="listen", + extra=True, + filler_words=True, + intents=True, + keyterm=True, + keywords=True, + language=True, + measurements=True, + method="sync", model="6f548761-c9c0-429a-9315-11a1d28499c8", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact=True, + replace=True, sample_rate=True, + search=True, + sentiment=True, + smart_format=True, + summarize=True, tag="tag1", + topics=True, + utt_split=True, + utterances=True, + version=True, ) """ _response = self._raw_client.get( @@ -545,10 +585,50 @@ async def get( async def main() -> None: await client.manage.v1.projects.usage.get( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", accessor="12345678-1234-1234-1234-123456789012", + alternatives=True, + callback_method=True, + callback=True, + channels=True, + custom_intent_mode=True, + custom_intent=True, + custom_topic_mode=True, + custom_topic=True, + deployment="hosted", + detect_entities=True, + detect_language=True, + diarize=True, + dictation=True, + encoding=True, + endpoint="listen", + extra=True, + filler_words=True, + intents=True, + keyterm=True, + keywords=True, + language=True, + measurements=True, + method="sync", model="6f548761-c9c0-429a-9315-11a1d28499c8", + multichannel=True, + numerals=True, + paragraphs=True, + profanity_filter=True, + punctuate=True, + redact=True, + replace=True, sample_rate=True, + search=True, + sentiment=True, + smart_format=True, + summarize=True, tag="tag1", + topics=True, + utt_split=True, + utterances=True, + version=True, ) diff --git a/src/deepgram/manage/v1/projects/usage/fields/client.py b/src/deepgram/manage/v1/projects/usage/fields/client.py index d810f50f..c1e144ab 100644 --- a/src/deepgram/manage/v1/projects/usage/fields/client.py +++ b/src/deepgram/manage/v1/projects/usage/fields/client.py @@ -62,6 +62,8 @@ def list( ) client.manage.v1.projects.usage.fields.list( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", ) """ _response = self._raw_client.list(project_id, start=start, end=end, request_options=request_options) @@ -127,6 +129,8 @@ async def list( async def main() -> None: await client.manage.v1.projects.usage.fields.list( project_id="123456-7890-1234-5678-901234", + start="start", + end="end", ) 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 ad0b4131..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, @@ -71,9 +70,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -142,9 +140,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/manage/v1/projects/usage/raw_client.py b/src/deepgram/manage/v1/projects/usage/raw_client.py index dc2e88ef..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, @@ -284,9 +283,9 @@ def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -565,9 +563,9 @@ async def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/read/v1/text/client.py b/src/deepgram/read/v1/text/client.py index b906e76a..d04b8a7c 100644 --- a/src/deepgram/read/v1/text/client.py +++ b/src/deepgram/read/v1/text/client.py @@ -108,6 +108,18 @@ def analyze( api_key="YOUR_API_KEY", ) client.read.v1.text.analyze( + callback="callback", + callback_method="POST", + sentiment=True, + summarize="v2", + tag="tag", + topics=True, + custom_topic="custom_topic", + custom_topic_mode="extended", + intents=True, + custom_intent="custom_intent", + custom_intent_mode="extended", + language="language", request={"url": "url"}, ) """ @@ -227,6 +239,18 @@ async def analyze( async def main() -> None: await client.read.v1.text.analyze( + callback="callback", + callback_method="POST", + sentiment=True, + summarize="v2", + tag="tag", + topics=True, + custom_topic="custom_topic", + custom_topic_mode="extended", + intents=True, + custom_intent="custom_intent", + custom_intent_mode="extended", + language="language", request={"url": "url"}, ) diff --git a/src/deepgram/read/v1/text/raw_client.py b/src/deepgram/read/v1/text/raw_client.py index 349a797d..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, @@ -135,9 +134,9 @@ def analyze( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -262,9 +260,9 @@ async def analyze( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/read/v1/text/types/text_analyze_request_summarize.py b/src/deepgram/read/v1/text/types/text_analyze_request_summarize.py index 96cbdc28..74aa7e3b 100644 --- a/src/deepgram/read/v1/text/types/text_analyze_request_summarize.py +++ b/src/deepgram/read/v1/text/types/text_analyze_request_summarize.py @@ -2,4 +2,4 @@ import typing -TextAnalyzeRequestSummarize = typing.Union[typing.Literal["v2", "v1"], typing.Any] +TextAnalyzeRequestSummarize = typing.Union[typing.Literal["v2"], typing.Any] diff --git a/src/deepgram/requests/__init__.py b/src/deepgram/requests/__init__.py index 42b13057..97de54c2 100644 --- a/src/deepgram/requests/__init__.py +++ b/src/deepgram/requests/__init__.py @@ -97,6 +97,9 @@ from .listen_v1response_results_channels_item_alternatives_item import ( ListenV1ResponseResultsChannelsItemAlternativesItemParams, ) + from .listen_v1response_results_channels_item_alternatives_item_entities_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams, + ) from .listen_v1response_results_channels_item_alternatives_item_paragraphs import ( ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams, ) @@ -125,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 @@ -240,6 +242,7 @@ "ListenV1ResponseMetadataSummaryInfoParams": ".listen_v1response_metadata_summary_info", "ListenV1ResponseMetadataTopicsInfoParams": ".listen_v1response_metadata_topics_info", "ListenV1ResponseParams": ".listen_v1response", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams": ".listen_v1response_results_channels_item_alternatives_item_entities_item", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item_sentences_item", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams": ".listen_v1response_results_channels_item_alternatives_item_paragraphs", @@ -256,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", @@ -391,6 +393,7 @@ def __dir__(): "ListenV1ResponseMetadataSummaryInfoParams", "ListenV1ResponseMetadataTopicsInfoParams", "ListenV1ResponseParams", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemParams", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItemParams", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams", @@ -407,7 +410,6 @@ def __dir__(): "ListenV1ResponseResultsUtterancesItemParams", "ListenV1ResponseResultsUtterancesItemWordsItemParams", "ListenV1ResponseResultsUtterancesParams", - "ListenV2KeytermParams", "ProjectRequestResponseParams", "ReadV1RequestParams", "ReadV1RequestTextParams", diff --git a/src/deepgram/requests/listen_v1response_metadata.py b/src/deepgram/requests/listen_v1response_metadata.py index cb987643..7a1671ac 100644 --- a/src/deepgram/requests/listen_v1response_metadata.py +++ b/src/deepgram/requests/listen_v1response_metadata.py @@ -18,7 +18,7 @@ class ListenV1ResponseMetadataParams(typing_extensions.TypedDict): duration: float channels: float models: typing.Sequence[str] - model_info: typing.Dict[str, typing.Optional[typing.Any]] + model_info: typing.Dict[str, typing.Any] summary_info: typing_extensions.NotRequired[ListenV1ResponseMetadataSummaryInfoParams] sentiment_info: typing_extensions.NotRequired[ListenV1ResponseMetadataSentimentInfoParams] topics_info: typing_extensions.NotRequired[ListenV1ResponseMetadataTopicsInfoParams] diff --git a/src/deepgram/requests/listen_v1response_results_channels_item_alternatives_item.py b/src/deepgram/requests/listen_v1response_results_channels_item_alternatives_item.py index 915381e8..f5c10f75 100644 --- a/src/deepgram/requests/listen_v1response_results_channels_item_alternatives_item.py +++ b/src/deepgram/requests/listen_v1response_results_channels_item_alternatives_item.py @@ -3,6 +3,9 @@ import typing import typing_extensions +from .listen_v1response_results_channels_item_alternatives_item_entities_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams, +) from .listen_v1response_results_channels_item_alternatives_item_paragraphs import ( ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams, ) @@ -24,6 +27,9 @@ class ListenV1ResponseResultsChannelsItemAlternativesItemParams(typing_extension typing.Sequence[ListenV1ResponseResultsChannelsItemAlternativesItemWordsItemParams] ] paragraphs: typing_extensions.NotRequired[ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParams] + entities: typing_extensions.NotRequired[ + typing.Sequence[ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams] + ] summaries: typing_extensions.NotRequired[ typing.Sequence[ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItemParams] ] diff --git a/src/deepgram/requests/listen_v1response_results_channels_item_alternatives_item_entities_item.py b/src/deepgram/requests/listen_v1response_results_channels_item_alternatives_item_entities_item.py new file mode 100644 index 00000000..ef253971 --- /dev/null +++ b/src/deepgram/requests/listen_v1response_results_channels_item_alternatives_item_entities_item.py @@ -0,0 +1,12 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions + + +class ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItemParams(typing_extensions.TypedDict): + label: typing_extensions.NotRequired[str] + value: typing_extensions.NotRequired[str] + raw_value: typing_extensions.NotRequired[str] + confidence: typing_extensions.NotRequired[float] + start_word: typing_extensions.NotRequired[float] + end_word: typing_extensions.NotRequired[float] 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/requests/project_request_response.py b/src/deepgram/requests/project_request_response.py index fef8ae38..ab64684d 100644 --- a/src/deepgram/requests/project_request_response.py +++ b/src/deepgram/requests/project_request_response.py @@ -36,7 +36,7 @@ class ProjectRequestResponseParams(typing_extensions.TypedDict): The unique identifier of the API key """ - response: typing_extensions.NotRequired[typing.Dict[str, typing.Optional[typing.Any]]] + response: typing_extensions.NotRequired[typing.Dict[str, typing.Any]] """ The response of the request """ 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 8b656d70..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, ) @@ -62,9 +61,9 @@ def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -144,9 +142,9 @@ def create( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -202,9 +199,9 @@ def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -260,9 +256,9 @@ def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -316,9 +311,9 @@ async def list( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -398,9 +392,9 @@ async def create( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -456,9 +449,9 @@ async def get( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, ) @@ -514,9 +506,9 @@ async def delete( raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/speak/v1/audio/raw_client.py b/src/deepgram/speak/v1/audio/raw_client.py index f426311c..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, @@ -119,9 +118,9 @@ def _stream() -> HttpResponse[typing.Iterator[bytes]]: raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), @@ -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, @@ -237,9 +235,9 @@ async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: raise BadRequestError( headers=dict(_response.headers), body=typing.cast( - typing.Optional[typing.Any], + typing.Any, parse_obj_as( - type_=typing.Optional[typing.Any], # type: ignore + type_=typing.Any, # type: ignore object_=_response.json(), ), ), diff --git a/src/deepgram/speak/v1/client.py b/src/deepgram/speak/v1/client.py index 3cc0e7dc..b76a0926 100644 --- a/src/deepgram/speak/v1/client.py +++ b/src/deepgram/speak/v1/client.py @@ -3,25 +3,13 @@ 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): @@ -40,75 +28,6 @@ def with_raw_response(self) -> 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: @@ -135,75 +54,6 @@ def with_raw_response(self) -> 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 index ca69a44b..82da8718 100644 --- a/src/deepgram/speak/v1/raw_client.py +++ b/src/deepgram/speak/v1/raw_client.py @@ -1,165 +1,13 @@ # 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/types/__init__.py b/src/deepgram/types/__init__.py index bed947cd..23f30703 100644 --- a/src/deepgram/types/__init__.py +++ b/src/deepgram/types/__init__.py @@ -91,26 +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_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 @@ -124,6 +104,9 @@ from .listen_v1response_results_channels_item_alternatives_item import ( ListenV1ResponseResultsChannelsItemAlternativesItem, ) + from .listen_v1response_results_channels_item_alternatives_item_entities_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem, + ) from .listen_v1response_results_channels_item_alternatives_item_paragraphs import ( ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs, ) @@ -150,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 @@ -196,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 @@ -283,26 +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", - "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", @@ -314,6 +257,7 @@ "ListenV1ResponseResultsChannels": ".listen_v1response_results_channels", "ListenV1ResponseResultsChannelsItem": ".listen_v1response_results_channels_item", "ListenV1ResponseResultsChannelsItemAlternativesItem": ".listen_v1response_results_channels_item_alternatives_item", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem": ".listen_v1response_results_channels_item_alternatives_item_entities_item", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs": ".listen_v1response_results_channels_item_alternatives_item_paragraphs", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem": ".listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item_sentences_item", @@ -326,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", @@ -370,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", @@ -481,26 +405,6 @@ def __dir__(): "ListProjectsV1Response", "ListProjectsV1ResponseProjectsItem", "ListenV1AcceptedResponse", - "ListenV1Callback", - "ListenV1CallbackMethod", - "ListenV1Channels", - "ListenV1Diarize", - "ListenV1Dictation", - "ListenV1Encoding", - "ListenV1Endpointing", - "ListenV1Extra", - "ListenV1InterimResults", - "ListenV1Keyterm", - "ListenV1Keywords", - "ListenV1Language", - "ListenV1MipOptOut", - "ListenV1Model", - "ListenV1Multichannel", - "ListenV1Numerals", - "ListenV1ProfanityFilter", - "ListenV1Punctuate", - "ListenV1Redact", - "ListenV1Replace", "ListenV1RequestFile", "ListenV1Response", "ListenV1ResponseMetadata", @@ -512,6 +416,7 @@ def __dir__(): "ListenV1ResponseResultsChannels", "ListenV1ResponseResultsChannelsItem", "ListenV1ResponseResultsChannelsItemAlternativesItem", + "ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem", "ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem", @@ -524,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", @@ -568,11 +457,7 @@ def __dir__(): "SharedTopicsResultsTopics", "SharedTopicsResultsTopicsSegmentsItem", "SharedTopicsResultsTopicsSegmentsItemTopicsItem", - "SpeakV1Encoding", - "SpeakV1MipOptOut", - "SpeakV1Model", "SpeakV1Response", - "SpeakV1SampleRate", "UpdateProjectMemberScopesV1Response", "UpdateProjectV1Response", "UsageBreakdownV1Response", diff --git a/src/deepgram/types/create_key_v1request_one.py b/src/deepgram/types/create_key_v1request_one.py index 90293b87..0a5d546a 100644 --- a/src/deepgram/types/create_key_v1request_one.py +++ b/src/deepgram/types/create_key_v1request_one.py @@ -2,4 +2,4 @@ import typing -CreateKeyV1RequestOne = typing.Optional[typing.Any] +CreateKeyV1RequestOne = typing.Any diff --git a/src/deepgram/types/listen_v1callback.py b/src/deepgram/types/listen_v1callback.py deleted file mode 100644 index 0109163b..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.Optional[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 d39d19a9..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.Optional[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 0163c3ab..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.Optional[typing.Any] diff --git a/src/deepgram/types/listen_v1extra.py b/src/deepgram/types/listen_v1extra.py deleted file mode 100644 index 6c4248ce..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.Optional[typing.Union[str, typing.Sequence[str]]] 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 5651069a..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.Optional[typing.Union[str, typing.Sequence[str]]] diff --git a/src/deepgram/types/listen_v1keywords.py b/src/deepgram/types/listen_v1keywords.py deleted file mode 100644 index 4c4330db..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.Optional[typing.Union[str, typing.Sequence[str]]] diff --git a/src/deepgram/types/listen_v1language.py b/src/deepgram/types/listen_v1language.py deleted file mode 100644 index cf06645d..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.Optional[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 f3843c76..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.Optional[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 9187906c..00000000 --- a/src/deepgram/types/listen_v1redact.py +++ /dev/null @@ -1,11 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -ListenV1Redact = typing.Optional[ - typing.Union[ - typing.Literal["true", "false", "pci", "numbers", "aggressive_numbers", "ssn"], - str, - typing.Sequence[str], - ] -] diff --git a/src/deepgram/types/listen_v1replace.py b/src/deepgram/types/listen_v1replace.py deleted file mode 100644 index 4bd11cc4..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.Optional[typing.Union[str, typing.Sequence[str]]] diff --git a/src/deepgram/types/listen_v1response_metadata.py b/src/deepgram/types/listen_v1response_metadata.py index beb3d9d0..4a0463ee 100644 --- a/src/deepgram/types/listen_v1response_metadata.py +++ b/src/deepgram/types/listen_v1response_metadata.py @@ -19,7 +19,7 @@ class ListenV1ResponseMetadata(UniversalBaseModel): duration: float channels: float models: typing.List[str] - model_info: typing.Dict[str, typing.Optional[typing.Any]] + model_info: typing.Dict[str, typing.Any] summary_info: typing.Optional[ListenV1ResponseMetadataSummaryInfo] = None sentiment_info: typing.Optional[ListenV1ResponseMetadataSentimentInfo] = None topics_info: typing.Optional[ListenV1ResponseMetadataTopicsInfo] = None diff --git a/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item.py b/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item.py index 87ca1ca3..ddf91b60 100644 --- a/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item.py +++ b/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item.py @@ -4,6 +4,9 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .listen_v1response_results_channels_item_alternatives_item_entities_item import ( + ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem, +) from .listen_v1response_results_channels_item_alternatives_item_paragraphs import ( ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs, ) @@ -23,6 +26,7 @@ class ListenV1ResponseResultsChannelsItemAlternativesItem(UniversalBaseModel): confidence: typing.Optional[float] = None words: typing.Optional[typing.List[ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem]] = None paragraphs: typing.Optional[ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs] = None + entities: typing.Optional[typing.List[ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem]] = None summaries: typing.Optional[typing.List[ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem]] = None topics: typing.Optional[typing.List[ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem]] = None diff --git a/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item_entities_item.py b/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item_entities_item.py new file mode 100644 index 00000000..6fb26e5a --- /dev/null +++ b/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item_entities_item.py @@ -0,0 +1,24 @@ +# 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 ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem(UniversalBaseModel): + label: typing.Optional[str] = None + value: typing.Optional[str] = None + raw_value: typing.Optional[str] = None + confidence: typing.Optional[float] = None + start_word: typing.Optional[float] = None + end_word: 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 diff --git a/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item.py b/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item.py index d38e7e39..1ba52c63 100644 --- a/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item.py +++ b/src/deepgram/types/listen_v1response_results_channels_item_alternatives_item_paragraphs_paragraphs_item.py @@ -13,8 +13,8 @@ class ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsIte sentences: typing.Optional[ typing.List[ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem] ] = None - speaker: typing.Optional[int] = None - num_words: typing.Optional[int] = None + speaker: typing.Optional[float] = None + num_words: typing.Optional[float] = None start: typing.Optional[float] = None end: typing.Optional[float] = None diff --git a/src/deepgram/types/listen_v1response_results_utterances_item.py b/src/deepgram/types/listen_v1response_results_utterances_item.py index a9ce5e77..a570ac99 100644 --- a/src/deepgram/types/listen_v1response_results_utterances_item.py +++ b/src/deepgram/types/listen_v1response_results_utterances_item.py @@ -11,10 +11,10 @@ class ListenV1ResponseResultsUtterancesItem(UniversalBaseModel): start: typing.Optional[float] = None end: typing.Optional[float] = None confidence: typing.Optional[float] = None - channel: typing.Optional[int] = None + channel: typing.Optional[float] = None transcript: typing.Optional[str] = None words: typing.Optional[typing.List[ListenV1ResponseResultsUtterancesItemWordsItem]] = None - speaker: typing.Optional[int] = None + speaker: typing.Optional[float] = None id: typing.Optional[str] = None if IS_PYDANTIC_V2: diff --git a/src/deepgram/types/listen_v1response_results_utterances_item_words_item.py b/src/deepgram/types/listen_v1response_results_utterances_item_words_item.py index 7c3cfc84..21633fd3 100644 --- a/src/deepgram/types/listen_v1response_results_utterances_item_words_item.py +++ b/src/deepgram/types/listen_v1response_results_utterances_item_words_item.py @@ -11,7 +11,7 @@ class ListenV1ResponseResultsUtterancesItemWordsItem(UniversalBaseModel): start: typing.Optional[float] = None end: typing.Optional[float] = None confidence: typing.Optional[float] = None - speaker: typing.Optional[int] = None + speaker: typing.Optional[float] = None speaker_confidence: typing.Optional[float] = None punctuated_word: typing.Optional[str] = None diff --git a/src/deepgram/types/listen_v1sample_rate.py b/src/deepgram/types/listen_v1sample_rate.py deleted file mode 100644 index 5f503202..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.Optional[typing.Any] diff --git a/src/deepgram/types/listen_v1search.py b/src/deepgram/types/listen_v1search.py deleted file mode 100644 index 45012296..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.Optional[typing.Union[str, typing.Sequence[str]]] 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 5de7abaf..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.Optional[typing.Union[str, typing.Sequence[str]]] 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 ee111eca..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.Optional[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 3000be04..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.Optional[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 9f5bd4fc..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.Optional[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 1212083e..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.Optional[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 9dcc3298..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.Optional[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 18caf04d..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.Optional[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 78d73d0b..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.Optional[typing.Any] diff --git a/src/deepgram/types/listen_v2tag.py b/src/deepgram/types/listen_v2tag.py deleted file mode 100644 index 956053a0..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.Optional[typing.Union[str, typing.Sequence[str]]] diff --git a/src/deepgram/types/project_request_response.py b/src/deepgram/types/project_request_response.py index 9b45765a..fde3ca2d 100644 --- a/src/deepgram/types/project_request_response.py +++ b/src/deepgram/types/project_request_response.py @@ -37,7 +37,7 @@ class ProjectRequestResponse(UniversalBaseModel): The unique identifier of the API key """ - response: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + response: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ The response of the request """ 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 d7312ba7..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.Optional[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 a0031cb1..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", "44100", "48000"], typing.Any] diff --git a/tests/utils/test_http_client.py b/tests/utils/test_http_client.py index 31bde0b7..8c89c234 100644 --- a/tests/utils/test_http_client.py +++ b/tests/utils/test_http_client.py @@ -1,6 +1,6 @@ # This file was auto-generated by Fern from our API Definition. -from deepgram.core.http_client import get_request_body +from deepgram.core.http_client import get_request_body, remove_none_from_dict from deepgram.core.request_options import RequestOptions @@ -8,6 +8,10 @@ def get_request_options() -> RequestOptions: return {"additional_body_parameters": {"see you": "later"}} +def get_request_options_with_none() -> RequestOptions: + return {"additional_body_parameters": {"see you": "later", "optional": None}} + + def test_get_json_request_body() -> None: json_body, data_body = get_request_body(json={"hello": "world"}, data=None, request_options=None, omit=None) assert json_body == {"hello": "world"} @@ -59,3 +63,47 @@ def test_get_empty_json_request_body() -> None: assert json_body_extras is None assert data_body_extras is None + + +def test_json_body_preserves_none_values() -> None: + """Test that JSON bodies preserve None values (they become JSON null).""" + json_body, data_body = get_request_body( + json={"hello": "world", "optional": None}, data=None, request_options=None, omit=None + ) + # JSON bodies should preserve None values + assert json_body == {"hello": "world", "optional": None} + assert data_body is None + + +def test_data_body_preserves_none_values_without_multipart() -> None: + """Test that data bodies preserve None values when not using multipart. + + The filtering of None values happens in HttpClient.request/stream methods, + not in get_request_body. This test verifies get_request_body doesn't filter None. + """ + json_body, data_body = get_request_body( + json=None, data={"hello": "world", "optional": None}, request_options=None, omit=None + ) + # get_request_body should preserve None values in data body + # The filtering happens later in HttpClient.request when multipart is detected + assert data_body == {"hello": "world", "optional": None} + assert json_body is None + + +def test_remove_none_from_dict_filters_none_values() -> None: + """Test that remove_none_from_dict correctly filters out None values.""" + original = {"hello": "world", "optional": None, "another": "value", "also_none": None} + filtered = remove_none_from_dict(original) + assert filtered == {"hello": "world", "another": "value"} + # Original should not be modified + assert original == {"hello": "world", "optional": None, "another": "value", "also_none": None} + + +def test_remove_none_from_dict_empty_dict() -> None: + """Test that remove_none_from_dict handles empty dict.""" + assert remove_none_from_dict({}) == {} + + +def test_remove_none_from_dict_all_none() -> None: + """Test that remove_none_from_dict handles dict with all None values.""" + assert remove_none_from_dict({"a": None, "b": None}) == {}