Skip to content

Commit b037ca2

Browse files
committed
change to the openai compatible api
1 parent 0e7ba25 commit b037ca2

3 files changed

Lines changed: 27 additions & 33 deletions

File tree

src/together/resources/videos.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from together.types.videos import (
1313
CreateVideoResponse,
1414
CreateVideoBody,
15-
VideoResource,
15+
VideoJob,
1616
)
1717

1818
if sys.version_info >= (3, 8):
@@ -134,15 +134,15 @@ def create(
134134
def retrieve(
135135
self,
136136
id: str,
137-
) -> VideoResource:
137+
) -> VideoJob:
138138
"""
139139
Method to retrieve a video creation job.
140140
141141
Args:
142142
id (str): The ID of the video creation job to retrieve.
143143
144144
Returns:
145-
VideoResource: Object containing the current status and details of the video creation job
145+
VideoJob: Object containing the current status and details of the video creation job
146146
"""
147147

148148
requestor = api_requestor.APIRequestor(
@@ -152,14 +152,14 @@ def retrieve(
152152
response, _, _ = requestor.request(
153153
options=TogetherRequest(
154154
method="GET",
155-
url=f"../v2/videos/status?id={id}",
155+
url=f"../v2/videos/{id}",
156156
),
157157
stream=False,
158158
)
159159

160160
assert isinstance(response, TogetherResponse)
161161

162-
return VideoResource(**response.data)
162+
return VideoJob(**response.data)
163163

164164

165165
class AsyncVideos:
@@ -272,19 +272,18 @@ async def create(
272272

273273
return CreateVideoResponse(**response.data)
274274

275-
async def status(
275+
async def retrieve(
276276
self,
277-
*,
278277
id: str,
279-
) -> VideoResource:
278+
) -> VideoJob:
280279
"""
281-
Async method to check the status of a video generation job.
280+
Async method to retrieve a video creation job.
282281
283282
Args:
284-
id (str): The ID of the video generation job to check.
283+
id (str): The ID of the video creation job to retrieve.
285284
286285
Returns:
287-
VideoResource: Object containing the current status and details of the video generation job
286+
VideoJob: Object containing the current status and details of the video creation job
288287
"""
289288

290289
requestor = api_requestor.APIRequestor(
@@ -294,11 +293,11 @@ async def status(
294293
response, _, _ = await requestor.arequest(
295294
options=TogetherRequest(
296295
method="GET",
297-
url=f"../v2/videos/status?id={id}",
296+
url=f"../v2/videos/{id}",
298297
),
299298
stream=False,
300299
)
301300

302301
assert isinstance(response, TogetherResponse)
303302

304-
return VideoResource(**response.data)
303+
return VideoJob(**response.data)

src/together/types/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
from together.types.videos import (
7979
CreateVideoBody,
8080
CreateVideoResponse,
81-
VideoResource,
81+
VideoJob,
8282
)
8383

8484

@@ -159,5 +159,5 @@
159159
"EvaluationStatusResponse",
160160
"CreateVideoBody",
161161
"CreateVideoResponse",
162-
"VideoResource",
162+
"VideoJob",
163163
]

src/together/types/videos.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,41 +34,36 @@ class CreateVideoBody(BaseModel):
3434

3535

3636
class VideoOutputs(BaseModel):
37-
"""Response from video creation request"""
37+
"""Artifacts generated from video creation job"""
3838

3939
cost: float
4040
video_url: str
4141

4242

43-
class VideoInfoError(BaseModel):
44-
"""Error about the video creation request"""
43+
class Error(BaseModel):
44+
"""Error information about the video job"""
4545

46-
code: str
46+
code: str | None = None
4747
message: str
4848

4949

50-
class VideoInfo(BaseModel):
51-
"""Info about the video creation request"""
52-
53-
user_id: str
54-
errors: List[VideoInfoError] | None = None
55-
56-
5750
class CreateVideoResponse(BaseModel):
5851
"""Response from video generation request"""
5952

6053
id: str
6154

6255

63-
class VideoResource(BaseModel):
64-
"""Response from video status check"""
56+
class VideoJob(BaseModel):
57+
"""Structured information describing a generated video job."""
6558

6659
id: str
6760
model: str
61+
object: Literal["video"]
6862
status: Literal["queued", "in_progress", "completed", "failed", "cancelled"]
69-
info: VideoInfo | None = None
70-
inputs: Dict[str, Any]
63+
seconds: str
64+
size: str
65+
created_at: int
66+
67+
error: Error | None = None
7168
outputs: VideoOutputs | None = None
72-
created_at: str
73-
claimed_at: str
74-
done_at: str
69+
completed_at: int | None = None

0 commit comments

Comments
 (0)