Skip to content

feat: add prepare_extension() for batch video extension#141

Merged
double-di merged 1 commit into
mainfrom
lbi/batch-api-video-extension
May 16, 2026
Merged

feat: add prepare_extension() for batch video extension#141
double-di merged 1 commit into
mainfrom
lbi/batch-api-video-extension

Conversation

@double-di
Copy link
Copy Markdown
Contributor

@double-di double-di commented May 8, 2026

Add prepare_extension() method to both async and sync video clients for preparing video extension requests for the Batch API.

This enables users to prepare /video/extend requests for batch processing via:

  • client.video.prepare_extension() (async)
  • client.video.prepare_extension() (sync)

Changes

  • src/xai_sdk/aio/video.py: Added prepare_extension() to async video client
  • src/xai_sdk/sync/video.py: Added prepare_extension() to sync video client
  • src/xai_sdk/proto/v{5,6}/batch_pb2*: Regenerated batch proto with video_extension_request oneof field
  • CHANGELOG.md: Added entry under [Unreleased]

@double-di double-di requested a review from a team as a code owner May 8, 2026 08:12
@double-di double-di force-pushed the lbi/batch-api-video-extension branch 2 times, most recently from 46a7274 to 274f3dd Compare May 8, 2026 14:28
@double-di double-di force-pushed the lbi/batch-api-video-extension branch from a409cb3 to 693744c Compare May 11, 2026 11:48
double-di added a commit to xai-org/xai-proto that referenced this pull request May 14, 2026
Add image, video, and video extension request/response types to the
batch proto oneofs.

**BatchRequest oneof:**
- `image_request` (field 3) — `GenerateImageRequest`
- `video_request` (field 4) — `GenerateVideoRequest`
- `video_extension_request` (field 5) — `ExtendVideoRequest` (already
defined in video.proto)

**BatchResultData oneof:**
- `image_response` (field 3) — `ImageResponse`
- `video_response` (field 4) — `VideoResponse`

Required by
[xai-sdk-python#141](xai-org/xai-sdk-python#141)
for batch video extension support.
double-di added a commit to xai-org/xai-proto that referenced this pull request May 16, 2026
## Summary

Adds three fields to `batch.proto` that ship in the published Python SDK
but were never declared here.

| Field | Where | Status before this PR |
|---|---|---|
| `Batch.input_file_id` (optional string, field 10) | `Batch` message |
absent in xai-proto, present in SDK |
| `CreateBatchRequest.input_file_id` (string, field 2) |
`CreateBatchRequest` | same |
| `ListBatchRequestMetadataRequest.status` (repeated
`BatchRequestMetadata.State`, field 4) | filter param on metadata
listing | same |

## Import order

Keeps xai-proto's existing convention — alphabetical by full import path
(`google.protobuf.*` → `google.rpc.*` → `xai/api/v1/*`). Matches every
other file in `proto/xai/api/v1/` and keeps the `google.protobuf.*`
imports adjacent in the generated Python.

## Wire compatibility

- Existing fields and field numbers unchanged → all current clients keep
working byte-for-byte
- New fields are additive (proto3 default behavior: unknown fields are
tolerated on decode, omitted fields encode as zero bytes)
- gRPC method paths unchanged

## Effect on
[xai-org/xai-sdk-python#141](xai-org/xai-sdk-python#141)

After this lands, that PR can regen cleanly from xai-proto and the diff
will collapse to just the actual feature additions
(`video_extension_request` field + `prepare_extension()` method + tests
+ CHANGELOG).
- Add prepare_extension() to async and sync video clients
- Update batch proto definitions
- Add changelog entry
@double-di double-di force-pushed the lbi/batch-api-video-extension branch from d96a11f to 7acf490 Compare May 16, 2026 17:53
@double-di double-di merged commit 9838109 into main May 16, 2026
7 checks passed
@double-di double-di deleted the lbi/batch-api-video-extension branch May 16, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants