From 5704d6b63fd9e57d04c87073d74635b2e0fe4537 Mon Sep 17 00:00:00 2001 From: Serge Mosin Date: Thu, 19 Feb 2026 12:56:12 +0000 Subject: [PATCH 1/4] REVAI-4573: Add tests for source_config migration and verbatim fix TDD red phase: tests expect source_config instead of media_url in STT payload, verbatim=False to be included, and media_url/source_config conflict to raise ValueError. Co-Authored-By: Claude Opus 4.6 --- tests/test_async_summarization.py | 2 +- tests/test_async_translation.py | 2 +- tests/test_job.py | 75 ++++++++++++++++++++++++++++++- 3 files changed, 75 insertions(+), 4 deletions(-) diff --git a/tests/test_async_summarization.py b/tests/test_async_summarization.py index 7b1746e8..ab6d2803 100644 --- a/tests/test_async_summarization.py +++ b/tests/test_async_summarization.py @@ -112,7 +112,7 @@ def test_submit_source_url(self, mock_session, make_mock_response): "POST", JOBS_URL, json={ - 'media_url': 'https://example.com/test.mp3', + 'source_config': {'url': 'https://example.com/test.mp3'}, 'language': 'en', 'summarization_config': { 'prompt': "Try to summarize this transcript as good as you possibly can", diff --git a/tests/test_async_translation.py b/tests/test_async_translation.py index 0e368898..0dfdede6 100644 --- a/tests/test_async_translation.py +++ b/tests/test_async_translation.py @@ -147,7 +147,7 @@ def test_submit_source_url(self, mock_session, make_mock_response): "POST", JOBS_URL, json={ - 'media_url': 'https://example.com/test.mp3', + 'source_config': {'url': 'https://example.com/test.mp3'}, 'language': 'en', 'translation_config': { 'target_languages': [ diff --git a/tests/test_job.py b/tests/test_job.py index 4f0cdf2d..1dc0ff0c 100644 --- a/tests/test_job.py +++ b/tests/test_job.py @@ -162,7 +162,7 @@ def test_submit_job_url_with_success(self, mock_session, make_mock_response): "POST", JOBS_URL, json={ - 'media_url': SOURCE_URL, + 'source_config': {'url': SOURCE_URL}, 'callback_url': NOTIFICATION_URL, 'metadata': METADATA, 'skip_diarization': True, @@ -276,7 +276,7 @@ def test_submit_job_url_with_human_transcription_and_success(self, mock_session, 'POST', JOBS_URL, json={ - 'media_url': SOURCE_URL, + 'source_config': {'url': SOURCE_URL}, 'transcriber': 'human', 'verbatim': True, 'segments_to_transcribe': segments, @@ -284,6 +284,77 @@ def test_submit_job_url_with_human_transcription_and_success(self, mock_session, }, headers=client.default_headers) + def test_submit_job_url_with_media_url_and_source_config_conflict(self, mock_session): + """Passing both media_url and source_config should raise ValueError.""" + client = RevAiAPIClient(TOKEN) + + with pytest.raises(ValueError, match='media_url is not compatible with source_config'): + client.submit_job_url( + media_url=SOURCE_URL, + source_config=SOURCE_CONFIG + ) + + def test_submit_job_url_verbatim_false(self, mock_session, make_mock_response): + """verbatim=False should be included in payload.""" + data = { + 'id': JOB_ID, + 'status': 'in_progress', + 'created_on': CREATED_ON, + } + response = make_mock_response(url=JOB_ID_URL, json_data=data) + mock_session.request.return_value = response + client = RevAiAPIClient(TOKEN) + + client.submit_job_url(SOURCE_URL, verbatim=False) + + mock_session.request.assert_called_once_with( + 'POST', + JOBS_URL, + json={ + 'source_config': {'url': SOURCE_URL}, + 'verbatim': False, + }, + headers=client.default_headers) + + def test_submit_job_url_verbatim_true(self, mock_session, make_mock_response): + """verbatim=True should be included in payload.""" + data = { + 'id': JOB_ID, + 'status': 'in_progress', + 'created_on': CREATED_ON, + } + response = make_mock_response(url=JOB_ID_URL, json_data=data) + mock_session.request.return_value = response + client = RevAiAPIClient(TOKEN) + + client.submit_job_url(SOURCE_URL, verbatim=True) + + mock_session.request.assert_called_once_with( + 'POST', + JOBS_URL, + json={ + 'source_config': {'url': SOURCE_URL}, + 'verbatim': True, + }, + headers=client.default_headers) + + def test_submit_job_url_verbatim_none(self, mock_session, make_mock_response): + """verbatim=None (default) should NOT be included in payload.""" + data = { + 'id': JOB_ID, + 'status': 'in_progress', + 'created_on': CREATED_ON, + } + response = make_mock_response(url=JOB_ID_URL, json_data=data) + mock_session.request.return_value = response + client = RevAiAPIClient(TOKEN) + + client.submit_job_url(SOURCE_URL) + + call_kwargs = mock_session.request.call_args + payload = call_kwargs[1]['json'] if 'json' in call_kwargs[1] else call_kwargs[0][2] + assert 'verbatim' not in payload + def test_submit_job_local_file_with_success(self, mocker, mock_session, make_mock_response): created_on = '2018-05-05T23:23:22.29Z' data = { From 59732241f1d627819d6f451c0275457f47f18b9d Mon Sep 17 00:00:00 2001 From: Serge Mosin Date: Thu, 19 Feb 2026 12:56:36 +0000 Subject: [PATCH 2/4] REVAI-4573: Migrate media_url to source_config, fix verbatim for STT API - submit_job_url now sends source_config: {url: media_url} instead of media_url directly, enabling v3 transcriber (machine_v3) support - Raise ValueError when both media_url and source_config are provided - Fix verbatim to be sent when False (was skipped due to falsy check) Co-Authored-By: Claude Opus 4.6 --- src/rev_ai/apiclient.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rev_ai/apiclient.py b/src/rev_ai/apiclient.py index 8f4d91fb..4c41d97b 100644 --- a/src/rev_ai/apiclient.py +++ b/src/rev_ai/apiclient.py @@ -817,7 +817,11 @@ def _create_job_options_payload( translation_config: TranslationOptions = None): payload = {} if media_url: - payload['media_url'] = media_url + if source_config: + raise ValueError( + 'media_url is not compatible with source_config. ' + 'Use source_config for all URL-based submissions.') + payload['source_config'] = {'url': media_url} if skip_diarization: payload['skip_diarization'] = skip_diarization if skip_punctuation: @@ -842,7 +846,7 @@ def _create_job_options_payload( payload['custom_vocabulary_id'] = custom_vocabulary_id if transcriber: payload['transcriber'] = transcriber - if verbatim: + if verbatim is not None: payload['verbatim'] = verbatim if rush: payload['rush'] = rush From d9a053b56169b2dd22741ee7f64304b52972f21d Mon Sep 17 00:00:00 2001 From: Serge Mosin Date: Thu, 19 Feb 2026 13:26:24 +0000 Subject: [PATCH 3/4] REVAI-4573: Bump version to 2.22.0 Co-Authored-By: Claude Opus 4.6 --- src/rev_ai/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rev_ai/__init__.py b/src/rev_ai/__init__.py index 30e64704..7cc7fa04 100644 --- a/src/rev_ai/__init__.py +++ b/src/rev_ai/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Top-level package for rev_ai""" -__version__ = '2.21.0' +__version__ = '2.22.0' from .models import Job, JobStatus, Account, Transcript, Monologue, Element, MediaConfig, \ CaptionType, GroupChannelsType, CustomVocabulary, TopicExtractionJob, TopicExtractionResult, \ From cd6ec152773dd4cec3b9d52e15629d80a4e3f92b Mon Sep 17 00:00:00 2001 From: Serge Mosin Date: Thu, 19 Feb 2026 18:39:26 +0000 Subject: [PATCH 4/4] REVAI-4573: Fix CI by replacing deprecated setup.py test with pytest The pytest-runner package and setup.py's tests_require/test_suite options are deprecated and incompatible with newer setuptools versions. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/build_test.yml | 2 +- setup.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index a6ed364c..fd909b32 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -38,7 +38,7 @@ jobs: pip install --upgrade pip pip install -r requirements.txt -r requirements_dev.txt - name: Test - run: python setup.py test + run: pytest tests/ - name: Lint run: | flake8 tests --ignore=F401,W504,E731,E123,E125,E127,E128,E501 diff --git a/setup.py b/setup.py index 4b2096ca..ce3f5f30 100644 --- a/setup.py +++ b/setup.py @@ -68,8 +68,5 @@ def parse_requirements(filehandle): 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', ], - setup_requires=['pytest-runner==4.2'], - test_suite='tests', - tests_require=test_requirements, url='https://github.com/revdotcom/revai-python-sdk', )