Skip to content

[Bug]: Issue in sending multiple Keyterms #629

@AghashNair

Description

@AghashNair

Summary

Issue in sending multiple keyterms.

What happened?

Actual
Currently using v5.3 of the sdk. While attempting to send multiple keyterms (keywords for nova2) for AsyncDeepgramClient.listen.v1.connect and AsyncDeepgramClient.listen.v2.connect. Accepted param is string. not list of string, raises an unexpected body error while passing a list of string.

Using both flux and nova3

Currently seen within the sdk is

query_params = httpx.QueryParams()
query_params = query_params.add("keyterm", keyterm)

gives a result of keyterm=%5B%27KEYTERM1%27%2C+%27KEYTERM2%27%5D

Expected
As per official documentation of sending keyterm, the terms that have to be considered as stand alonde need to be sent in the format
--url "https://api.deepgram.com/v1/listen?model=nova-3&keyterm=KEYTERM1&keyterm=KEYTERM2"
Is there a known alternative to send multiple keyterms

Steps to reproduce

  1. Install deepgram-sdk==5.3.0
  2. Use snippet below

Minimal code sample

from deepgram import AsyncDeepgramClient


client = AsyncDeepgramClient(api_key="USE_OWN_API_KEY")
async def connect():   
    async with client.listen.v2.connect(
         model= "flux-general-en",
         encoding= "linear16",
         sample_rate= "16000",    
         eot_threshold= "0.8",
         eager_eot_threshold= "0.8",
         keyterm=["KEYTERM1","KEYTERM2"]
    ) as connection:
                print("works")

Logs / traceback


Transport

WebSocket

API endpoint / path

/v2/listen

Model(s) used

nova-2,nova-3, flux-general-en

How often?

Always

Is this a regression?

  • Yes, it worked in an earlier version

Last working SDK version (if known)

No response

SDK version

5.3.0

Python version

3.12.3

Install method

None

OS

Linux (x86_64)

Environment details


Link to minimal repro (optional)

No response

Session ID (optional)

No response

Project ID (optional)

No response

Request ID (optional)

No response

Code of Conduct

  • I agree to follow this project’s Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions