Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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},
)

Expand All @@ -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),
)
Expand Down
Binary file added src/diffio/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file added src/diffio/__pycache__/client.cpython-312.pyc
Binary file not shown.
Binary file added src/diffio/__pycache__/errors.cpython-312.pyc
Binary file not shown.
Binary file added src/diffio/__pycache__/types.cpython-312.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions src/diffio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/diffio/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
34 changes: 34 additions & 0 deletions tests/test_diffio40_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import json

import httpx
import pytest

from diffio import DiffioClient


@pytest.mark.parametrize(
("model", "path"),
[
("diffio-4.0-flash", "/v1/diffio-4.0-flash-generation"),
("diffio-4.0-pro", "/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