deepgram / deepgram-python-sdk

Official Python SDK for Deepgram's automated speech recognition APIs.
https://developers.deepgram.com
MIT License
242 stars 63 forks source link

mip_opt_out is not supported as an option #474

Closed ggrossman closed 4 weeks ago

ggrossman commented 1 month ago

What is the current behavior?

The Model Improvement Program documentation says that to opt out of the Model Improvement Program using the Deepgram Python SDK, you can add mip_opt_out: true to the PrerecordedOptions:

#  Install the SDK: pip install deepgram-sdk

import asyncio
import os
from dotenv import load_dotenv

from deepgram import DeepgramClient, PrerecordedOptions

load_dotenv()

API_KEY = os.getenv("DEEPGRAM_API_KEY")
AUDIO_URL = {
    "url": "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav"
}

options: PrerecordedOptions = PrerecordedOptions(
    model="nova-2",
    mip_opt_out: true
)

deepgram: DeepgramClient = DeepgramClient(API_KEY)

async def transcribe_url():
    url_response = await deepgram.listen.asyncprerecorded.v("1").transcribe_url(
        AUDIO_URL, options
    )
    return url_response

async def main():
    try:
        response = await transcribe_url()
        print(response.to_json(indent=4))
    except Exception as e:
        print(f"Exception: {e}")

if __name__ == "__main__":
    asyncio.run(main())

The sample appears to have a syntax error; it should read mip_opt_out=True. Perhaps copy and pasted from Javascript?

But even with that fixed, it fails with an error because mip_opt_out is not expected as a keyword argument.

Steps to reproduce

Attempt to run the above code sample. (The code sample also needs to be fixed to use proper Python syntax.)

Expected behavior

mip_opt_out is part of the Deepgram API and should be accepted by the Python SDK.

Please tell us about your environment

macOS Sequoia 15.0.1, Python 3.12.4

Other information

ggrossman commented 1 month ago

Please see pull request: https://github.com/deepgram/deepgram-python-sdk/pull/475

ggrossman commented 4 weeks ago

Documentation has been updated to use custom_options and addons, so closing this issue

davidvonthenen commented 4 weeks ago

Link for those that are interested: https://developers.deepgram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out