diff --git a/README.md b/README.md index 423f05b..8fcde6e 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ project = client.create_project( generation = client.create_generation( apiProjectId=project.apiProjectId, - model="diffio-3.5", + model="diffio-4.0-flash", sampling={"steps": 12, "guidance": 1.5}, idempotencyKey="restore-job-2026-001", requestOptions={"maxRetries": 2}, @@ -89,7 +89,7 @@ from diffio import DiffioClient client = DiffioClient(apiKey="diffio_live_...") result = client.audio_isolation.isolate( filePath="sample.wav", - model="diffio-3.5", + model="diffio-4.0-flash", sampling={"steps": 12, "guidance": 1.5}, ) @@ -106,7 +106,7 @@ from diffio import DiffioClient client = DiffioClient(apiKey="diffio_live_...") audio_bytes, info = client.restore_audio( filePath="sample.wav", - model="diffio-3.5", + model="diffio-4.0-flash", sampling={"steps": 12, "guidance": 1.5}, onProgress=lambda progress: print(progress.status), ) diff --git a/src/diffio/__pycache__/__init__.cpython-312.pyc b/src/diffio/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..34d5e29 Binary files /dev/null and b/src/diffio/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/diffio/__pycache__/client.cpython-312.pyc b/src/diffio/__pycache__/client.cpython-312.pyc new file mode 100644 index 0000000..f8a093d Binary files /dev/null and b/src/diffio/__pycache__/client.cpython-312.pyc differ diff --git a/src/diffio/__pycache__/errors.cpython-312.pyc b/src/diffio/__pycache__/errors.cpython-312.pyc new file mode 100644 index 0000000..2e6daa5 Binary files /dev/null and b/src/diffio/__pycache__/errors.cpython-312.pyc differ diff --git a/src/diffio/__pycache__/types.cpython-312.pyc b/src/diffio/__pycache__/types.cpython-312.pyc new file mode 100644 index 0000000..3dca6ca Binary files /dev/null and b/src/diffio/__pycache__/types.cpython-312.pyc differ diff --git a/src/diffio/client.py b/src/diffio/client.py index 9a48da7..6a3c774 100644 --- a/src/diffio/client.py +++ b/src/diffio/client.py @@ -38,6 +38,8 @@ "diffio-2-flash": "diffio-2.0-flash-generation", "diffio-3.4": "diffio-3.4-generation", "diffio-3.5": "diffio-3.5-generation", + "diffio-4.0-flash": "diffio-4.0-flash-generation", + "diffio-4.0-pro": "diffio-4.0-pro-generation", } DEFAULT_RETRY_STATUS_CODES = [408, 429, 500, 502, 503, 504] DEFAULT_RETRY_BACKOFF = 0.5 diff --git a/src/diffio/types.py b/src/diffio/types.py index 227c7e3..14e8fba 100644 --- a/src/diffio/types.py +++ b/src/diffio/types.py @@ -451,7 +451,7 @@ def __init__(self, project, generation): self.generation = generation -ModelKey = ("diffio-2", "diffio-2-flash", "diffio-3.4", "diffio-3.5") +ModelKey = ("diffio-2", "diffio-2-flash", "diffio-3.4", "diffio-3.5", "diffio-4.0-flash", "diffio-4.0-pro") DownloadType = ("audio", "mp3", "video", "transcript") WebhookMode = ("test", "live") WebhookEventType = ( diff --git a/tests/__pycache__/conftest.cpython-312-pytest-9.1.1.pyc b/tests/__pycache__/conftest.cpython-312-pytest-9.1.1.pyc new file mode 100644 index 0000000..40eb1a5 Binary files /dev/null and b/tests/__pycache__/conftest.cpython-312-pytest-9.1.1.pyc differ diff --git a/tests/__pycache__/test_client.cpython-312-pytest-9.1.1.pyc b/tests/__pycache__/test_client.cpython-312-pytest-9.1.1.pyc new file mode 100644 index 0000000..f591ca2 Binary files /dev/null and b/tests/__pycache__/test_client.cpython-312-pytest-9.1.1.pyc differ diff --git a/tests/__pycache__/test_diffio40_models.cpython-312-pytest-9.1.1.pyc b/tests/__pycache__/test_diffio40_models.cpython-312-pytest-9.1.1.pyc new file mode 100644 index 0000000..aadfaca Binary files /dev/null and b/tests/__pycache__/test_diffio40_models.cpython-312-pytest-9.1.1.pyc differ diff --git a/tests/__pycache__/test_transcription.cpython-312-pytest-9.1.1.pyc b/tests/__pycache__/test_transcription.cpython-312-pytest-9.1.1.pyc new file mode 100644 index 0000000..38493d9 Binary files /dev/null and b/tests/__pycache__/test_transcription.cpython-312-pytest-9.1.1.pyc differ diff --git a/tests/test_diffio40_models.py b/tests/test_diffio40_models.py new file mode 100644 index 0000000..8484062 --- /dev/null +++ b/tests/test_diffio40_models.py @@ -0,0 +1,34 @@ +import json + +import httpx +import pytest + +from diffio import DiffioClient + + +@pytest.mark.parametrize( + ("model", "path"), + [ + ("diffio-4.0-flash", "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/v1/diffio-4.0-flash-generation"), + ("diffio-4.0-pro", "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/v1/diffio-4.0-pro-generation"), + ], +) +def test_create_generation_routes_each_diffio_4_0_model_to_its_endpoint(model, path): + received = {} + + def handler(request: httpx.Request) -> httpx.Response: + received["path"] = request.url.path + received["payload"] = json.loads(request.content.decode("utf-8")) + return httpx.Response( + 200, + json={"generationId": "gen_40", "apiProjectId": "proj_40", "modelKey": model, "status": "queued"}, + ) + + http_client = httpx.Client(base_url="https://api.test", transport=httpx.MockTransport(handler)) + client = DiffioClient(apiKey="diffio_live_test", baseUrl="https://api.test", httpClient=http_client) + + response = client.create_generation(apiProjectId="proj_40", model=model) + + assert received["path"] == path + assert received["payload"]["apiProjectId"] == "proj_40" + assert response.modelKey == model