interhumanai 3.2.1__tar.gz → 3.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,17 @@ All notable changes to `interhumanai` are documented here. The package follows
5
5
  the TypeScript SDK (`@interhumanai/sdk`): both packages always carry the same
6
6
  version and release together.
7
7
 
8
+ ## 3.3.0
9
+
10
+ - Added the ``language`` argument to ``UploadClient.submit``: the spoken
11
+ language as an ISO 639 code such as ``"en"``. An ``UploadModel.INTER_2_DEEP``
12
+ job's transcript is then made in that language rather than a detected one.
13
+ Any other model raises ``ih4005``.
14
+ - Added ``UploadJobTranscript.language_source`` (``"requested"`` or
15
+ ``"detected"``) and ``UploadJobTranscript.language_probability`` (the
16
+ recognizer's 0–1 confidence in a detected language, where it reports one).
17
+ A detected ``language`` is best-effort.
18
+
8
19
  ## 3.2.1
9
20
 
10
21
  - Documentation only: when no speaker could be identified as on camera, the
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: interhumanai
3
- Version: 3.2.1
3
+ Version: 3.3.0
4
4
  Summary: First-party Python SDK for the Interhuman API: upload and stream social-signal analysis.
5
5
  Project-URL: Homepage, https://docs.interhuman.ai
6
6
  Project-URL: Repository, https://github.com/interhuman-core/interhuman-api
@@ -172,11 +172,15 @@ else:
172
172
  (`text`, `start`, `end`, `speaker`, `speaker_role`) and the speaker
173
173
  segments. Check `transcript.status` first: `FAILED` means no transcript
174
174
  could be produced, carries `error`, and leaves the job completed.
175
+ `transcript.language_source` says whether `language` is the one you named
176
+ (`"requested"`) or the recognizer's guess (`"detected"`), which is
177
+ best-effort: pass `language="en"` (any ISO 639 code) to `submit` wherever
178
+ you know the spoken language. Only `INTER_2_DEEP` takes it.
175
179
  `VISUAL_CUES`, `LEXICAL_CUES` and `SPEECH_CUES` add `visual_cues`,
176
180
  `lexical_cues` and `speech_cues`: timestamped cue lists, each with its own
177
- `status`. The API defines them ahead of serving them, so a submit that names
178
- one is refused with `ih1003` until the deployment serves it. Without a flag
179
- the result has no such section.
181
+ `status`. A deployment serves each list only where it is enabled; a submit
182
+ that names a list the deployment does not serve is refused with `ih1003`. Without a flag the result has no
183
+ such section.
180
184
  - `get_job(job_id)` — one status read. Raises `InterhumanAPIError` with
181
185
  `error_id` `ih4021` once the job has expired (`job.expires_at`).
182
186
  - `wait_for_job(job_id, timeout=None, poll_interval=2.0)` — returns the
@@ -146,11 +146,15 @@ else:
146
146
  (`text`, `start`, `end`, `speaker`, `speaker_role`) and the speaker
147
147
  segments. Check `transcript.status` first: `FAILED` means no transcript
148
148
  could be produced, carries `error`, and leaves the job completed.
149
+ `transcript.language_source` says whether `language` is the one you named
150
+ (`"requested"`) or the recognizer's guess (`"detected"`), which is
151
+ best-effort: pass `language="en"` (any ISO 639 code) to `submit` wherever
152
+ you know the spoken language. Only `INTER_2_DEEP` takes it.
149
153
  `VISUAL_CUES`, `LEXICAL_CUES` and `SPEECH_CUES` add `visual_cues`,
150
154
  `lexical_cues` and `speech_cues`: timestamped cue lists, each with its own
151
- `status`. The API defines them ahead of serving them, so a submit that names
152
- one is refused with `ih1003` until the deployment serves it. Without a flag
153
- the result has no such section.
155
+ `status`. A deployment serves each list only where it is enabled; a submit
156
+ that names a list the deployment does not serve is refused with `ih1003`. Without a flag the result has no
157
+ such section.
154
158
  - `get_job(job_id)` — one status read. Raises `InterhumanAPIError` with
155
159
  `error_id` `ih4021` once the job has expired (`job.expires_at`).
156
160
  - `wait_for_job(job_id, timeout=None, poll_interval=2.0)` — returns the
@@ -1,3 +1,3 @@
1
1
  """Package version (single source of truth, read by hatchling at build time)."""
2
2
 
3
- __version__ = "3.2.1"
3
+ __version__ = "3.3.0"
@@ -444,7 +444,17 @@ class UploadJobTranscript(BaseModel):
444
444
 
445
445
  Attributes:
446
446
  status: Whether the file was transcribed.
447
- language: The language detected in the speech, as an ISO 639 code.
447
+ language: The language the speech was transcribed in, as an ISO 639
448
+ code. When ``language_source`` is ``"detected"`` it is the speech
449
+ recognizer's own guess, which is best-effort and can be wrong:
450
+ pass ``language`` to :meth:`UploadClient.submit` where you know it.
451
+ language_source: Where ``language`` came from: ``"requested"``, the
452
+ language the submit named, or ``"detected"``, the recognizer's
453
+ own guess. ``None`` when ``language`` is, or when the speech
454
+ service did not report it.
455
+ language_probability: The recognizer's confidence, from 0 to 1, in a
456
+ detected language. ``None`` for a requested language and wherever
457
+ the recognizer reports no confidence.
448
458
  speaker_roles_status: Whether the speakers could be told apart as on
449
459
  camera or off it: ``"mapped"`` when at least one speaker has a
450
460
  role, ``"unmapped"`` when none could be told, ``"no_face"`` when no
@@ -462,6 +472,8 @@ class UploadJobTranscript(BaseModel):
462
472
 
463
473
  status: UploadJobTranscriptStatus
464
474
  language: str | None = None
475
+ language_source: str | None = None
476
+ language_probability: float | None = None
465
477
  speaker_roles_status: str | None = None
466
478
  word_timing: str | None = None
467
479
  words: list[UploadJobTranscriptWord] = Field(default_factory=list)
@@ -127,6 +127,7 @@ class UploadClient:
127
127
  model: UploadModel | str,
128
128
  wait_seconds: int = 0,
129
129
  include: Sequence[UploadJobIncludeFlag | IncludeFlag | str] | None = None,
130
+ language: str | None = None,
130
131
  filename: str | None = None,
131
132
  content_type: str | None = None,
132
133
  ) -> UploadJob:
@@ -174,6 +175,12 @@ class UploadClient:
174
175
  :meth:`analyze` takes, so :class:`IncludeFlag` members work
175
176
  too) for the quality block, and ``SIGNALS`` for the signal
176
177
  list. Omit a flag for no such section.
178
+ language: The language spoken in the file, as a two- or
179
+ three-letter ISO 639 code such as ``"en"``.
180
+ ``UploadModel.INTER_2_DEEP`` accepts it, and its transcript is
181
+ then made in that language. Without it the speech recognizer
182
+ detects the language, which is best-effort. Any other model
183
+ raises ``ih4005``.
177
184
  filename: Filename reported to the API. Defaults to the path or
178
185
  file object's name, else ``video``.
179
186
  content_type: MIME type of the file (e.g. ``video/mp4``).
@@ -194,6 +201,8 @@ class UploadClient:
194
201
  flag.value if isinstance(flag, (IncludeFlag, UploadJobIncludeFlag)) else flag
195
202
  for flag in include
196
203
  ]
204
+ if language:
205
+ data["language"] = language
197
206
  headers = {"Authorization": f"Bearer {token}"}
198
207
  url = self._base_url + "/v2/upload/analyze"
199
208
  payload = await self._request(
File without changes
File without changes