Skip to content

Commit b74987a

Browse files
committed
Allow arbitrary kwargs in job requests (#3)
1 parent a1c0556 commit b74987a

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## Version 0.1.1 (2025-06-04)
4+
5+
- Allow arbitrary kwargs in `diarize`, `identify` and `voiceprint`
6+
37
## Version 0.1.0 (2025-03-14)
48

59
- *Hello world!*

src/pyannoteai/sdk/client.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ def diarize(
328328
min_speakers: Optional[int] = None,
329329
max_speakers: Optional[int] = None,
330330
confidence: bool = False,
331+
**kwargs,
331332
) -> str:
332333
"""Initiate a diarization job on the pyannoteAI web API
333334
@@ -345,6 +346,8 @@ def diarize(
345346
Not supported yet. Maximum number of speakers. Has no effect when `num_speakers` is provided.
346347
confidence : bool, optional
347348
Defaults to False
349+
**kwargs : optional
350+
Extra arguments to send in the body of the request.
348351
349352
Returns
350353
-------
@@ -360,6 +363,8 @@ def diarize(
360363
assert max_speakers is None, "`max_speakers` is not supported yet"
361364

362365
json = {"url": media_url, "numSpeakers": num_speakers, "confidence": confidence}
366+
# add extra arguments to the request body
367+
json.update(kwargs)
363368

364369
response = self._authenticated_post("/diarize", json=json)
365370
data = response.json()
@@ -368,6 +373,7 @@ def diarize(
368373
def voiceprint(
369374
self,
370375
media_url: str,
376+
**kwargs,
371377
) -> str:
372378
"""Initiate a voiceprint job on the pyannoteAI web API
373379
@@ -376,6 +382,8 @@ def voiceprint(
376382
media_url : str
377383
media://{...} URL created with the `upload` method or
378384
any other public URL pointing to an audio file.
385+
**kwargs : optional
386+
Extra arguments to send in the body of the request.
379387
380388
Returns
381389
-------
@@ -388,6 +396,8 @@ def voiceprint(
388396
"""
389397

390398
json = {"url": media_url}
399+
# add extra arguments to the request body
400+
json.update(kwargs)
391401

392402
response = self._authenticated_post("/voiceprint", json=json)
393403
data = response.json()
@@ -403,6 +413,7 @@ def identify(
403413
min_speakers: Optional[int] = None,
404414
max_speakers: Optional[int] = None,
405415
confidence: bool = False,
416+
**kwargs,
406417
) -> str:
407418
"""Initiate an identification job on the pyannoteAI web API
408419
@@ -427,6 +438,8 @@ def identify(
427438
Not supported yet. Maximum number of speakers. Has no effect when `num_speakers` is provided.
428439
confidence : bool, optional
429440
Defaults to False
441+
**kwargs : optional
442+
Extra arguments to send in the body of the request.
430443
431444
Returns
432445
-------
@@ -454,6 +467,8 @@ def identify(
454467
"threshold": matching_threshold,
455468
},
456469
}
470+
# add extra arguments to the request body
471+
json.update(kwargs)
457472

458473
response = self._authenticated_post("/identify", json=json)
459474
data = response.json()

uv.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)