diff --git a/.gitignore b/.gitignore index 0fe79fb..dfe1fe0 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ BenchmarkDotNet.Artifacts .idea local.settings.json .env +*.local *.suo *.sdf diff --git a/.netconfig b/.netconfig index 18c7590..c7d339d 100644 --- a/.netconfig +++ b/.netconfig @@ -80,8 +80,8 @@ weak [file ".gitignore"] url = https://github.com/devlooped/oss/blob/main/.gitignore - sha = 3776526342afb3f57da7e80f2095e5fdca3c31c9 - etag = 11767f73556aa4c6c8bcc153b77ee8e8114f99fa3b885b0a7d66d082f91e77b3 + sha = a225b7a9f609f26bcc24e0d84f663387be251a7d + etag = 20a8b49d57024abbd85aac5b0020c30e5eb68e0384b2761e93727c8780c4a991 weak [file "Directory.Build.rsp"] url = https://github.com/devlooped/oss/blob/main/Directory.Build.rsp @@ -152,13 +152,13 @@ weak [file "src/xAI.Protocol/chat.proto"] url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/chat.proto - sha = 712e28ae9319e881d6dd6473d22566d61fe22854 - etag = d68802a822549776b7acdc0c03a226c913375f588a7938b48741ea5d1852ef02 + sha = 6473565631bba0e29fbc11dfb3a66a98dd72d496 + etag = 881e524631d7e6d7a7244f34bf8d99ad0c3dc149146c3a89d0bb626586f99c7f weak [file "src/xAI.Protocol/deferred.proto"] url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/deferred.proto - sha = 626a3a3f22d8aa11c7a185bf8902e7d415df0462 - etag = d47b84dddfc4252abbced302fde18ea8093933a3a8d5516350db596d3ae86595 + sha = 2b1a1fc74c463f55ec92af764d4b790f4def2a24 + etag = 246c0340096b0dbc754ceb4933bde0ebf92af049ebffb06ed1fef1840d04c46b weak [file "src/xAI.Protocol/documents.proto"] url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/documents.proto @@ -197,8 +197,8 @@ weak [file "src/xAI.Protocol/video.proto"] url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/video.proto - sha = 1813f69cd0fafba12eea98996cb6da15f29396b9 - etag = 69bb5336a09ae73e22e5d1a8af2d65386953face7d0b57917478e56e1c2fc5c6 + sha = 43a1b6b731943b8f031c2f2d946f7183f0933ffd + etag = 37562e78a6d64800b09c643632a33b6bc902955b491114bd5b6ec957d23d6e64 weak [file "src/xAI.Protocol/google/protobuf/timestamp.proto"] url = https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/timestamp.proto diff --git a/readme.md b/readme.md index 3878e86..4155f76 100644 --- a/readme.md +++ b/readme.md @@ -441,9 +441,10 @@ Uses your own API Key. [![Adrian Alonso](https://avatars.githubusercontent.com/u/2027083?u=129cf516d99f5cb2fd0f4a0787a069f3446b7522&v=4&s=39 "Adrian Alonso")](https://github.com/adalon) [![Michael Hagedorn](https://avatars.githubusercontent.com/u/61711586?u=8f653dfcb641e8c18cc5f78692ebc6bb3a0c92be&v=4&s=39 "Michael Hagedorn")](https://github.com/Eule02) [![torutek](https://avatars.githubusercontent.com/u/33917059?v=4&s=39 "torutek")](https://github.com/torutek) -[![mccaffers](https://avatars.githubusercontent.com/u/16667079?u=739e110e62a75870c981640447efa5eb2cb3bc8f&v=4&s=39 "mccaffers")](https://github.com/mccaffers) +[![mccaffers](https://avatars.githubusercontent.com/u/16667079?u=f5b761303b6c7a7f18123b5bd20f06760d3fbd3e&v=4&s=39 "mccaffers")](https://github.com/mccaffers) [![Seika Logiciel](https://avatars.githubusercontent.com/u/2564602?v=4&s=39 "Seika Logiciel")](https://github.com/SeikaLogiciel) [![Andrew Grant](https://avatars.githubusercontent.com/devlooped-user?s=39 "Andrew Grant")](https://github.com/wizardness) +[![Lars](https://avatars.githubusercontent.com/u/1727124?v=4&s=39 "Lars")](https://github.com/latonz) diff --git a/src/xAI.Protocol/chat.proto b/src/xAI.Protocol/chat.proto index 190ec70..bb0c5a2 100644 --- a/src/xAI.Protocol/chat.proto +++ b/src/xAI.Protocol/chat.proto @@ -166,6 +166,10 @@ message GetCompletionsRequest { // Allow the users to control what optional fields to be returned in the response. repeated IncludeOption include = 26; + + // Number of agents to use for multi-agent models. + // Only valid when model is a `multi-agent` model. Defaults to `AGENT_COUNT_UNSPECIFIED`. + optional AgentCount agent_count = 29; } message GetChatCompletionResponse { @@ -543,6 +547,16 @@ enum ReasoningEffort { EFFORT_HIGH = 3; } +// Number of agents to use for multi-agent models. +enum AgentCount { + // Unspecified / unset value. + AGENT_COUNT_UNSPECIFIED = 0; + // Use 4 agents. + AGENT_COUNT_4 = 1; + // Use 16 agents. + AGENT_COUNT_16 = 2; +} + enum ToolMode { // Invalid tool mode. TOOL_MODE_INVALID = 0; diff --git a/src/xAI.Protocol/deferred.proto b/src/xAI.Protocol/deferred.proto index f147bde..59d96bc 100644 --- a/src/xAI.Protocol/deferred.proto +++ b/src/xAI.Protocol/deferred.proto @@ -31,4 +31,8 @@ enum DeferredStatus { // The request is still being processed. PENDING = 3; + + // The request failed due to an internal service error. + // The error message is in the `error` field of the response. + FAILED = 4; } diff --git a/src/xAI.Protocol/video.proto b/src/xAI.Protocol/video.proto index 3588a76..b12e5be 100644 --- a/src/xAI.Protocol/video.proto +++ b/src/xAI.Protocol/video.proto @@ -58,21 +58,23 @@ message VideoUrlContent { // An API service for interaction with video generation models. service Video { // Create a video based on a text prompt and optionally an image. - // If an image is provided, generates video with the image as the first frame (image-to-video). - // If no image is provided, generates video from text only (text-to-video). + // If an image is provided, generates video with the image as the first frame + // (image-to-video). If no image is provided, generates video from text only + // (text-to-video). // - // This is an asynchronous operation. The method returns immediately with a request_id - // that can be used to poll for the result using GetDeferredVideo. + // This is an asynchronous operation. The method returns immediately with a + // request_id that can be used to poll for the result using GetDeferredVideo. rpc GenerateVideo(GenerateVideoRequest) returns (StartDeferredResponse) {} - // Gets the result of a video generation started by calling `GenerateVideo`. - rpc GetDeferredVideo(GetDeferredVideoRequest) returns (GetDeferredVideoResponse) {} -} + // Extend an existing video by generating continuation content. + // + // This is an asynchronous operation. The method returns immediately with a + // request_id that can be used to poll for the result using GetDeferredVideo. + rpc ExtendVideo(ExtendVideoRequest) returns (StartDeferredResponse) {} -// Output destination for generated video. -message VideoOutput { - // Signed URL to upload the generated video via HTTP PUT. - string upload_url = 1; + // Gets the result of a video generation started by calling `GenerateVideo` or + // `ExtendVideo`. + rpc GetDeferredVideo(GetDeferredVideoRequest) returns (GetDeferredVideoResponse) {} } // Request message for generating a video. @@ -104,6 +106,11 @@ message GenerateVideoRequest { // Optional resolution for video generation. // Defaults to 480p if not specified. optional VideoResolution resolution = 8; + + // Optional reference images for reference-to-video (R2V) generation. + // When provided (and `image` is not set), generates video using these images + // as style/content references. + repeated ImageUrlContent reference_images = 13; } // Request for retrieving deferred video generation results. @@ -120,8 +127,20 @@ message VideoResponse { // The model used to generate the video (ignoring aliases). string model = 2; - // The usage of the request. + // Billing and cost information for this request. SamplingUsage usage = 3; + + // Structured error describing why video generation failed. + // Only present when the background generation encountered a failure + // (either client error 4xx or server error 5xx). + optional VideoError error = 6; + + // Approximate completion percentage for the video generation task (0-100). + // - When status is `PENDING`: progress is between 0-99, indicating current + // completion. + // - When status is `DONE`: progress is 100. + // - When status is `FAILED`: progress is 0. + int32 progress = 7; } // Contains all data related to a generated video. @@ -144,6 +163,33 @@ message GetDeferredVideoResponse { // Current status of the request. DeferredStatus status = 1; - // Response. Only present if `status=DONE` + // Response. Only present if `status=DONE` or `status=FAILED`. + // When failed, the `error` field in VideoResponse describes the failure. optional VideoResponse response = 2; } + +// Structured error returned when video generation fails. +message VideoError { + // Machine-readable error code (e.g. "invalid_argument", "internal_error"). + string code = 1; + // Human-readable error message describing the failure. + string message = 2; +} + +// Request message for extending an existing video. +message ExtendVideoRequest { + // Prompt describing what should happen next in the video. + string prompt = 1; + + // Input video to extend. The extension continues from the end of this video. + // Supports URL or base64-encoded video data. + // Input video must be between 2 and 30 seconds long. + VideoUrlContent video = 2; + + // Name or alias of the video generation model to be used. + string model = 3; + + // Duration of the extension segment to generate in seconds (1-10). + // Defaults to 6 seconds if not specified. + optional int32 duration = 4; +}