From 1d2915763dbbe6ae5798e5cbef1d25caac2c9f32 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Tue, 28 Jul 2026 16:40:57 -0700 Subject: [PATCH 1/5] Add image_generation server-side tool Adds xai_sdk.tools.image_generation() for the server-side image_generation tool, enabling image generation and editing in agentic requests. Supports an optional action parameter ("auto", "generate", "edit"). Regenerates v5/v6 chat and usage protos with the ImageGeneration tool message, TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL, and SERVER_SIDE_TOOL_IMAGE_GENERATION. Co-authored-by: Cursor --- CHANGELOG.md | 1 + src/xai_sdk/proto/v5/chat_pb2.py | 146 +++++++++++++++-------------- src/xai_sdk/proto/v5/chat_pb2.pyi | 14 ++- src/xai_sdk/proto/v5/usage_pb2.py | 4 +- src/xai_sdk/proto/v5/usage_pb2.pyi | 2 + src/xai_sdk/proto/v6/chat_pb2.py | 146 +++++++++++++++-------------- src/xai_sdk/proto/v6/chat_pb2.pyi | 14 ++- src/xai_sdk/proto/v6/usage_pb2.py | 4 +- src/xai_sdk/proto/v6/usage_pb2.pyi | 2 + src/xai_sdk/tools.py | 37 +++++++- tests/aio/chat_test.py | 8 +- tests/chat_test.py | 29 ++++++ tests/sync/chat_test.py | 8 +- 13 files changed, 257 insertions(+), 158 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64d0412..1d28cb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] ### Added +- **Image Generation Tool**: Added `xai_sdk.tools.image_generation` helper for the server-side `image_generation` tool, enabling image generation and editing in agentic requests. Accepts an optional `action` parameter (`"auto"`, `"generate"`, or `"edit"`) to control which image capabilities are exposed to the model - **Imagine File Storage**: Image and video generation (sync and async) now accept a `storage_options` parameter to persist generated assets to the Files API. It takes a dict with a required `filename` and optional `expires_after` (an `int` in seconds or a `datetime.timedelta`) and `public_url` (`True` to create a public URL with default expiry, or `{"expires_after": }` for an independent URL expiry). Image and video responses expose new `file_output`, `storage_error`, `public_url`, and `public_url_error` properties. - **File-ID Inputs for Generation**: Image and video generation now accept Files API `file_id` references as inputs alongside URLs/base64 — `image_file_id` / `image_file_ids` for `image.sample()` / `image.sample_batch()`, and `image_file_id` / `video_file_id` / `reference_image_file_ids` for `video.generate()` / `video.extend()` (and the batch `prepare` helpers). URL and file-ID lists may be mixed in the same multi-image request (file IDs are sent first). - **Public File URLs**: Added `client.files.create_public_url()` and `client.files.revoke_public_url()` (sync and async) to create and revoke publicly shareable, unauthenticated URLs for stored files. `create_public_url()` accepts an optional `expires_after` (an `int` in seconds or a `datetime.timedelta`). diff --git a/src/xai_sdk/proto/v5/chat_pb2.py b/src/xai_sdk/proto/v5/chat_pb2.py index 2803542..c5cd756 100644 --- a/src/xai_sdk/proto/v5/chat_pb2.py +++ b/src/xai_sdk/proto/v5/chat_pb2.py @@ -30,7 +30,7 @@ from . import usage_pb2 as xai_dot_api_dot_v1_dot_usage__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15xai/api/v1/chat.proto\x12\x07xai_api\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19xai/api/v1/deferred.proto\x1a\x1axai/api/v1/documents.proto\x1a\x16xai/api/v1/image.proto\x1a\x17xai/api/v1/sample.proto\x1a\x16xai/api/v1/usage.proto\"\xf1\n\n\x15GetCompletionsRequest\x12,\n\x08messages\x18\x01 \x03(\x0b\x32\x10.xai_api.MessageR\x08messages\x12\x14\n\x05model\x18\x02 \x01(\tR\x05model\x12\x12\n\x04user\x18\x10 \x01(\tR\x04user\x12\x11\n\x01n\x18\x08 \x01(\x05H\x00R\x01n\x88\x01\x01\x12\"\n\nmax_tokens\x18\x07 \x01(\x05H\x01R\tmaxTokens\x88\x01\x01\x12\x17\n\x04seed\x18\x0b \x01(\x05H\x02R\x04seed\x88\x01\x01\x12\x12\n\x04stop\x18\x0c \x03(\tR\x04stop\x12%\n\x0btemperature\x18\x0e \x01(\x02H\x03R\x0btemperature\x88\x01\x01\x12\x18\n\x05top_p\x18\x0f \x01(\x02H\x04R\x04topP\x88\x01\x01\x12\x1a\n\x08logprobs\x18\x05 \x01(\x08R\x08logprobs\x12&\n\x0ctop_logprobs\x18\x06 \x01(\x05H\x05R\x0btopLogprobs\x88\x01\x01\x12#\n\x05tools\x18\x11 \x03(\x0b\x32\r.xai_api.ToolR\x05tools\x12\x34\n\x0btool_choice\x18\x12 \x01(\x0b\x32\x13.xai_api.ToolChoiceR\ntoolChoice\x12@\n\x0fresponse_format\x18\n \x01(\x0b\x32\x17.xai_api.ResponseFormatR\x0eresponseFormat\x12\x30\n\x11\x66requency_penalty\x18\x03 \x01(\x02H\x06R\x10\x66requencyPenalty\x88\x01\x01\x12.\n\x10presence_penalty\x18\t \x01(\x02H\x07R\x0fpresencePenalty\x88\x01\x01\x12H\n\x10reasoning_effort\x18\x13 \x01(\x0e\x32\x18.xai_api.ReasoningEffortH\x08R\x0freasoningEffort\x88\x01\x01\x12K\n\x11search_parameters\x18\x14 \x01(\x0b\x32\x19.xai_api.SearchParametersH\tR\x10searchParameters\x88\x01\x01\x12\x33\n\x13parallel_tool_calls\x18\x15 \x01(\x08H\nR\x11parallelToolCalls\x88\x01\x01\x12\x35\n\x14previous_response_id\x18\x16 \x01(\tH\x0bR\x12previousResponseId\x88\x01\x01\x12%\n\x0estore_messages\x18\x17 \x01(\x08R\rstoreMessages\x12\x32\n\x15use_encrypted_content\x18\x18 \x01(\x08R\x13useEncryptedContent\x12 \n\tmax_turns\x18\x19 \x01(\x05H\x0cR\x08maxTurns\x88\x01\x01\x12\x30\n\x07include\x18\x1a \x03(\x0e\x32\x16.xai_api.IncludeOptionR\x07include\x12\x39\n\x0b\x61gent_count\x18\x1d \x01(\x0e\x32\x13.xai_api.AgentCountH\rR\nagentCount\x88\x01\x01\x12\x37\n\x0cservice_tier\x18\x1f \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTierB\x04\n\x02_nB\r\n\x0b_max_tokensB\x07\n\x05_seedB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x0f\n\r_top_logprobsB\x14\n\x12_frequency_penaltyB\x13\n\x11_presence_penaltyB\x13\n\x11_reasoning_effortB\x14\n\x12_search_parametersB\x16\n\x14_parallel_tool_callsB\x17\n\x15_previous_response_idB\x0c\n\n_max_turnsB\x0e\n\x0c_agent_countJ\x04\x08\x04\x10\x05\"\x87\x04\n\x19GetChatCompletionResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x33\n\x07outputs\x18\x02 \x03(\x0b\x32\x19.xai_api.CompletionOutputR\x07outputs\x12\x34\n\x07\x63reated\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x07\x63reated\x12\x14\n\x05model\x18\x06 \x01(\tR\x05model\x12-\n\x12system_fingerprint\x18\x07 \x01(\tR\x11systemFingerprint\x12,\n\x05usage\x18\t \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage\x12\x1c\n\tcitations\x18\n \x03(\tR\tcitations\x12\x34\n\x08settings\x18\x0b \x01(\x0b\x32\x18.xai_api.RequestSettingsR\x08settings\x12\x37\n\x0c\x64\x65\x62ug_output\x18\x0c \x01(\x0b\x32\x14.xai_api.DebugOutputR\x0b\x64\x65\x62ugOutput\x12\x36\n\x0coutput_files\x18\r \x03(\x0b\x32\x13.xai_api.OutputFileR\x0boutputFiles\x12\x37\n\x0cservice_tier\x18\x0f \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTier\"\xd3\x03\n\x16GetChatCompletionChunk\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x38\n\x07outputs\x18\x02 \x03(\x0b\x32\x1e.xai_api.CompletionOutputChunkR\x07outputs\x12\x34\n\x07\x63reated\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x07\x63reated\x12\x14\n\x05model\x18\x04 \x01(\tR\x05model\x12-\n\x12system_fingerprint\x18\x05 \x01(\tR\x11systemFingerprint\x12,\n\x05usage\x18\x06 \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage\x12\x1c\n\tcitations\x18\x07 \x03(\tR\tcitations\x12\x37\n\x0c\x64\x65\x62ug_output\x18\n \x01(\x0b\x32\x14.xai_api.DebugOutputR\x0b\x64\x65\x62ugOutput\x12\x36\n\x0coutput_files\x18\x0b \x03(\x0b\x32\x13.xai_api.OutputFileR\x0boutputFiles\x12\x37\n\x0cservice_tier\x18\x0c \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTier\"9\n\nOutputFile\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\"\xa2\x01\n\x1dGetDeferredCompletionResponse\x12/\n\x06status\x18\x02 \x01(\x0e\x32\x17.xai_api.DeferredStatusR\x06status\x12\x43\n\x08response\x18\x01 \x01(\x0b\x32\".xai_api.GetChatCompletionResponseH\x00R\x08response\x88\x01\x01\x42\x0b\n\t_response\"\xc9\x01\n\x10\x43ompletionOutput\x12:\n\rfinish_reason\x18\x01 \x01(\x0e\x32\x15.xai_api.FinishReasonR\x0c\x66inishReason\x12\x14\n\x05index\x18\x02 \x01(\x05R\x05index\x12\x34\n\x07message\x18\x03 \x01(\x0b\x32\x1a.xai_api.CompletionMessageR\x07message\x12-\n\x08logprobs\x18\x04 \x01(\x0b\x32\x11.xai_api.LogProbsR\x08logprobs\"\x9a\x02\n\x11\x43ompletionMessage\x12\x18\n\x07\x63ontent\x18\x01 \x01(\tR\x07\x63ontent\x12+\n\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x30\n\ntool_calls\x18\x03 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x05 \x01(\tR\x10\x65ncryptedContent\x12\x35\n\tcitations\x18\x06 \x03(\x0b\x32\x17.xai_api.InlineCitationR\tcitations\"\xbe\x01\n\x15\x43ompletionOutputChunk\x12$\n\x05\x64\x65lta\x18\x01 \x01(\x0b\x32\x0e.xai_api.DeltaR\x05\x64\x65lta\x12-\n\x08logprobs\x18\x02 \x01(\x0b\x32\x11.xai_api.LogProbsR\x08logprobs\x12:\n\rfinish_reason\x18\x03 \x01(\x0e\x32\x15.xai_api.FinishReasonR\x0c\x66inishReason\x12\x14\n\x05index\x18\x04 \x01(\x05R\x05index\"\x8e\x02\n\x05\x44\x65lta\x12\x18\n\x07\x63ontent\x18\x01 \x01(\tR\x07\x63ontent\x12+\n\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x30\n\ntool_calls\x18\x03 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x05 \x01(\tR\x10\x65ncryptedContent\x12\x35\n\tcitations\x18\x06 \x03(\x0b\x32\x17.xai_api.InlineCitationR\tcitations\"\xad\x02\n\x0eInlineCitation\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1f\n\x0bstart_index\x18\x02 \x01(\x05R\nstartIndex\x12\x1b\n\tend_index\x18\x06 \x01(\x05R\x08\x65ndIndex\x12\x39\n\x0cweb_citation\x18\x03 \x01(\x0b\x32\x14.xai_api.WebCitationH\x00R\x0bwebCitation\x12\x33\n\nx_citation\x18\x04 \x01(\x0b\x32\x12.xai_api.XCitationH\x00R\txCitation\x12Q\n\x14\x63ollections_citation\x18\x05 \x01(\x0b\x32\x1c.xai_api.CollectionsCitationH\x00R\x13\x63ollectionsCitationB\n\n\x08\x63itation\"\x1f\n\x0bWebCitation\x12\x10\n\x03url\x18\x01 \x01(\tR\x03url\"\x1d\n\tXCitation\x12\x10\n\x03url\x18\x01 \x01(\tR\x03url\"\xab\x01\n\x13\x43ollectionsCitation\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x19\n\x08\x63hunk_id\x18\x02 \x01(\tR\x07\x63hunkId\x12#\n\rchunk_content\x18\x03 \x01(\tR\x0c\x63hunkContent\x12\x14\n\x05score\x18\x04 \x01(\x02R\x05score\x12%\n\x0e\x63ollection_ids\x18\x05 \x03(\tR\rcollectionIds\"6\n\x08LogProbs\x12*\n\x07\x63ontent\x18\x01 \x03(\x0b\x32\x10.xai_api.LogProbR\x07\x63ontent\"\x87\x01\n\x07LogProb\x12\x14\n\x05token\x18\x01 \x01(\tR\x05token\x12\x18\n\x07logprob\x18\x02 \x01(\x02R\x07logprob\x12\x14\n\x05\x62ytes\x18\x03 \x01(\x0cR\x05\x62ytes\x12\x36\n\x0ctop_logprobs\x18\x04 \x03(\x0b\x32\x13.xai_api.TopLogProbR\x0btopLogprobs\"R\n\nTopLogProb\x12\x14\n\x05token\x18\x01 \x01(\tR\x05token\x12\x18\n\x07logprob\x18\x02 \x01(\x02R\x07logprob\x12\x14\n\x05\x62ytes\x18\x03 \x01(\x0cR\x05\x62ytes\"\x8f\x01\n\x07\x43ontent\x12\x14\n\x04text\x18\x01 \x01(\tH\x00R\x04text\x12\x37\n\timage_url\x18\x02 \x01(\x0b\x32\x18.xai_api.ImageUrlContentH\x00R\x08imageUrl\x12*\n\x04\x66ile\x18\x03 \x01(\x0b\x32\x14.xai_api.FileContentH\x00R\x04\x66ileB\t\n\x07\x63ontent\"\x85\x01\n\x0b\x46ileContent\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x12\n\x04\x64\x61ta\x18\x02 \x01(\x0cR\x04\x64\x61ta\x12\x1a\n\x08\x66ilename\x18\x03 \x01(\tR\x08\x66ilename\x12\x1b\n\tmime_type\x18\x04 \x01(\tR\x08mimeType\x12\x10\n\x03url\x18\x05 \x01(\tR\x03url\"\xd2\x02\n\x07Message\x12*\n\x07\x63ontent\x18\x01 \x03(\x0b\x32\x10.xai_api.ContentR\x07\x63ontent\x12\x30\n\x11reasoning_content\x18\x05 \x01(\tH\x00R\x10reasoningContent\x88\x01\x01\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x30\n\ntool_calls\x18\x04 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x06 \x01(\tR\x10\x65ncryptedContent\x12%\n\x0ctool_call_id\x18\x07 \x01(\tH\x01R\ntoolCallId\x88\x01\x01\x42\x14\n\x12_reasoning_contentB\x0f\n\r_tool_call_id\"k\n\nToolChoice\x12\'\n\x04mode\x18\x01 \x01(\x0e\x32\x11.xai_api.ToolModeH\x00R\x04mode\x12%\n\rfunction_name\x18\x02 \x01(\tH\x00R\x0c\x66unctionNameB\r\n\x0btool_choice\"\x9d\x03\n\x04Tool\x12/\n\x08\x66unction\x18\x01 \x01(\x0b\x32\x11.xai_api.FunctionH\x00R\x08\x66unction\x12\x33\n\nweb_search\x18\x03 \x01(\x0b\x32\x12.xai_api.WebSearchH\x00R\twebSearch\x12-\n\x08x_search\x18\x04 \x01(\x0b\x32\x10.xai_api.XSearchH\x00R\x07xSearch\x12?\n\x0e\x63ode_execution\x18\x05 \x01(\x0b\x32\x16.xai_api.CodeExecutionH\x00R\rcodeExecution\x12K\n\x12\x63ollections_search\x18\x06 \x01(\x0b\x32\x1a.xai_api.CollectionsSearchH\x00R\x11\x63ollectionsSearch\x12 \n\x03mcp\x18\x07 \x01(\x0b\x32\x0c.xai_api.MCPH\x00R\x03mcp\x12H\n\x11\x61ttachment_search\x18\x08 \x01(\x0b\x32\x19.xai_api.AttachmentSearchH\x00R\x10\x61ttachmentSearchB\x06\n\x04tool\"\xe7\x02\n\x03MCP\x12!\n\x0cserver_label\x18\x01 \x01(\tR\x0bserverLabel\x12-\n\x12server_description\x18\x02 \x01(\tR\x11serverDescription\x12\x1d\n\nserver_url\x18\x03 \x01(\tR\tserverUrl\x12,\n\x12\x61llowed_tool_names\x18\x04 \x03(\tR\x10\x61llowedToolNames\x12)\n\rauthorization\x18\x05 \x01(\tH\x00R\rauthorization\x88\x01\x01\x12\x43\n\rextra_headers\x18\x06 \x03(\x0b\x32\x1e.xai_api.MCP.ExtraHeadersEntryR\x0c\x65xtraHeaders\x1a?\n\x11\x45xtraHeadersEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x10\n\x0e_authorization\"\xea\x02\n\tWebSearch\x12)\n\x10\x65xcluded_domains\x18\x01 \x03(\tR\x0f\x65xcludedDomains\x12\'\n\x0f\x61llowed_domains\x18\x02 \x03(\tR\x0e\x61llowedDomains\x12\x41\n\x1a\x65nable_image_understanding\x18\x03 \x01(\x08H\x00R\x18\x65nableImageUnderstanding\x88\x01\x01\x12H\n\ruser_location\x18\x04 \x01(\x0b\x32\x1e.xai_api.WebSearchUserLocationH\x01R\x0cuserLocation\x88\x01\x01\x12\x33\n\x13\x65nable_image_search\x18\x05 \x01(\x08H\x02R\x11\x65nableImageSearch\x88\x01\x01\x42\x1d\n\x1b_enable_image_understandingB\x10\n\x0e_user_locationB\x16\n\x14_enable_image_search\"\xba\x01\n\x15WebSearchUserLocation\x12\x1d\n\x07\x63ountry\x18\x01 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x17\n\x04\x63ity\x18\x02 \x01(\tH\x01R\x04\x63ity\x88\x01\x01\x12\x1b\n\x06region\x18\x03 \x01(\tH\x02R\x06region\x88\x01\x01\x12\x1f\n\x08timezone\x18\x04 \x01(\tH\x03R\x08timezone\x88\x01\x01\x42\n\n\x08_countryB\x07\n\x05_cityB\t\n\x07_regionB\x0b\n\t_timezone\"\xb9\x03\n\x07XSearch\x12<\n\tfrom_date\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00R\x08\x66romDate\x88\x01\x01\x12\x38\n\x07to_date\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x01R\x06toDate\x88\x01\x01\x12*\n\x11\x61llowed_x_handles\x18\x03 \x03(\tR\x0f\x61llowedXHandles\x12,\n\x12\x65xcluded_x_handles\x18\x04 \x03(\tR\x10\x65xcludedXHandles\x12\x41\n\x1a\x65nable_image_understanding\x18\x05 \x01(\x08H\x02R\x18\x65nableImageUnderstanding\x88\x01\x01\x12\x41\n\x1a\x65nable_video_understanding\x18\x06 \x01(\x08H\x03R\x18\x65nableVideoUnderstanding\x88\x01\x01\x42\x0c\n\n_from_dateB\n\n\x08_to_dateB\x1d\n\x1b_enable_image_understandingB\x1d\n\x1b_enable_video_understanding\"\x0f\n\rCodeExecution\"\x89\x03\n\x11\x43ollectionsSearch\x12%\n\x0e\x63ollection_ids\x18\x01 \x03(\tR\rcollectionIds\x12\x19\n\x05limit\x18\x02 \x01(\x05H\x01R\x05limit\x88\x01\x01\x12\'\n\x0cinstructions\x18\x03 \x01(\tH\x02R\x0cinstructions\x88\x01\x01\x12\x45\n\x10hybrid_retrieval\x18\x04 \x01(\x0b\x32\x18.xai_api.HybridRetrievalH\x00R\x0fhybridRetrieval\x12K\n\x12semantic_retrieval\x18\x05 \x01(\x0b\x32\x1a.xai_api.SemanticRetrievalH\x00R\x11semanticRetrieval\x12H\n\x11keyword_retrieval\x18\x06 \x01(\x0b\x32\x19.xai_api.KeywordRetrievalH\x00R\x10keywordRetrievalB\x10\n\x0eretrieval_modeB\x08\n\x06_limitB\x0f\n\r_instructions\"7\n\x10\x41ttachmentSearch\x12\x19\n\x05limit\x18\x02 \x01(\x05H\x00R\x05limit\x88\x01\x01\x42\x08\n\x06_limit\"x\n\x08\x46unction\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12 \n\x0b\x64\x65scription\x18\x02 \x01(\tR\x0b\x64\x65scription\x12\x16\n\x06strict\x18\x03 \x01(\x08R\x06strict\x12\x1e\n\nparameters\x18\x04 \x01(\tR\nparameters\"\xef\x01\n\x08ToolCall\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.xai_api.ToolCallTypeR\x04type\x12/\n\x06status\x18\x03 \x01(\x0e\x32\x17.xai_api.ToolCallStatusR\x06status\x12(\n\rerror_message\x18\x04 \x01(\tH\x01R\x0c\x65rrorMessage\x88\x01\x01\x12\x33\n\x08\x66unction\x18\n \x01(\x0b\x32\x15.xai_api.FunctionCallH\x00R\x08\x66unctionB\x06\n\x04toolB\x10\n\x0e_error_message\"@\n\x0c\x46unctionCall\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1c\n\targuments\x18\x02 \x01(\tR\targuments\"n\n\x0eResponseFormat\x12\x34\n\x0b\x66ormat_type\x18\x01 \x01(\x0e\x32\x13.xai_api.FormatTypeR\nformatType\x12\x1b\n\x06schema\x18\x02 \x01(\tH\x00R\x06schema\x88\x01\x01\x42\t\n\x07_schema\"\xc9\x02\n\x10SearchParameters\x12\'\n\x04mode\x18\x01 \x01(\x0e\x32\x13.xai_api.SearchModeR\x04mode\x12)\n\x07sources\x18\t \x03(\x0b\x32\x0f.xai_api.SourceR\x07sources\x12\x37\n\tfrom_date\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x08\x66romDate\x12\x33\n\x07to_date\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x06toDate\x12)\n\x10return_citations\x18\x07 \x01(\x08R\x0freturnCitations\x12\x31\n\x12max_search_results\x18\x08 \x01(\x05H\x00R\x10maxSearchResults\x88\x01\x01\x42\x15\n\x13_max_search_results\"\xaf\x01\n\x06Source\x12&\n\x03web\x18\x01 \x01(\x0b\x32\x12.xai_api.WebSourceH\x00R\x03web\x12)\n\x04news\x18\x02 \x01(\x0b\x32\x13.xai_api.NewsSourceH\x00R\x04news\x12 \n\x01x\x18\x03 \x01(\x0b\x32\x10.xai_api.XSourceH\x00R\x01x\x12&\n\x03rss\x18\x04 \x01(\x0b\x32\x12.xai_api.RssSourceH\x00R\x03rssB\x08\n\x06source\"\xaf\x01\n\tWebSource\x12+\n\x11\x65xcluded_websites\x18\x02 \x03(\tR\x10\x65xcludedWebsites\x12)\n\x10\x61llowed_websites\x18\x05 \x03(\tR\x0f\x61llowedWebsites\x12\x1d\n\x07\x63ountry\x18\x03 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x1f\n\x0bsafe_search\x18\x04 \x01(\x08R\nsafeSearchB\n\n\x08_country\"\x85\x01\n\nNewsSource\x12+\n\x11\x65xcluded_websites\x18\x02 \x03(\tR\x10\x65xcludedWebsites\x12\x1d\n\x07\x63ountry\x18\x03 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x1f\n\x0bsafe_search\x18\x04 \x01(\x08R\nsafeSearchB\n\n\x08_country\"\xf9\x01\n\x07XSource\x12,\n\x12included_x_handles\x18\x07 \x03(\tR\x10includedXHandles\x12,\n\x12\x65xcluded_x_handles\x18\x08 \x03(\tR\x10\x65xcludedXHandles\x12\x33\n\x13post_favorite_count\x18\t \x01(\x05H\x00R\x11postFavoriteCount\x88\x01\x01\x12+\n\x0fpost_view_count\x18\n \x01(\x05H\x01R\rpostViewCount\x88\x01\x01\x42\x16\n\x14_post_favorite_countB\x12\n\x10_post_view_countJ\x04\x08\x06\x10\x07\"!\n\tRssSource\x12\x14\n\x05links\x18\x01 \x03(\tR\x05links\"\x9f\x06\n\x0fRequestSettings\x12\"\n\nmax_tokens\x18\x01 \x01(\x05H\x00R\tmaxTokens\x88\x01\x01\x12.\n\x13parallel_tool_calls\x18\x02 \x01(\x08R\x11parallelToolCalls\x12\x35\n\x14previous_response_id\x18\x03 \x01(\tH\x01R\x12previousResponseId\x88\x01\x01\x12H\n\x10reasoning_effort\x18\x04 \x01(\x0e\x32\x18.xai_api.ReasoningEffortH\x02R\x0freasoningEffort\x88\x01\x01\x12%\n\x0btemperature\x18\x05 \x01(\x02H\x03R\x0btemperature\x88\x01\x01\x12@\n\x0fresponse_format\x18\x06 \x01(\x0b\x32\x17.xai_api.ResponseFormatR\x0eresponseFormat\x12\x34\n\x0btool_choice\x18\x07 \x01(\x0b\x32\x13.xai_api.ToolChoiceR\ntoolChoice\x12#\n\x05tools\x18\x08 \x03(\x0b\x32\r.xai_api.ToolR\x05tools\x12\x18\n\x05top_p\x18\t \x01(\x02H\x04R\x04topP\x88\x01\x01\x12\x12\n\x04user\x18\n \x01(\tR\x04user\x12K\n\x11search_parameters\x18\x0b \x01(\x0b\x32\x19.xai_api.SearchParametersH\x05R\x10searchParameters\x88\x01\x01\x12%\n\x0estore_messages\x18\x0c \x01(\x08R\rstoreMessages\x12\x32\n\x15use_encrypted_content\x18\r \x01(\x08R\x13useEncryptedContent\x12\x30\n\x07include\x18\x0e \x03(\x0e\x32\x16.xai_api.IncludeOptionR\x07includeB\r\n\x0b_max_tokensB\x17\n\x15_previous_response_idB\x13\n\x11_reasoning_effortB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x14\n\x12_search_parameters\"=\n\x1aGetStoredCompletionRequest\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"@\n\x1d\x44\x65leteStoredCompletionRequest\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"A\n\x1e\x44\x65leteStoredCompletionResponse\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"\xba\x03\n\x0b\x44\x65\x62ugOutput\x12\x1a\n\x08\x61ttempts\x18\x01 \x01(\x05R\x08\x61ttempts\x12\x18\n\x07request\x18\x02 \x01(\tR\x07request\x12\x16\n\x06prompt\x18\x03 \x01(\tR\x06prompt\x12%\n\x0e\x65ngine_request\x18\t \x01(\tR\rengineRequest\x12\x1c\n\tresponses\x18\x04 \x03(\tR\tresponses\x12\x16\n\x06\x63hunks\x18\x0c \x03(\tR\x06\x63hunks\x12(\n\x10\x63\x61\x63he_read_count\x18\x05 \x01(\rR\x0e\x63\x61\x63heReadCount\x12\x33\n\x16\x63\x61\x63he_read_input_bytes\x18\x06 \x01(\x04R\x13\x63\x61\x63heReadInputBytes\x12*\n\x11\x63\x61\x63he_write_count\x18\x07 \x01(\rR\x0f\x63\x61\x63heWriteCount\x12\x35\n\x17\x63\x61\x63he_write_input_bytes\x18\x08 \x01(\x04R\x14\x63\x61\x63heWriteInputBytes\x12\x1d\n\nlb_address\x18\n \x01(\tR\tlbAddress\x12\x1f\n\x0bsampler_tag\x18\x0b \x01(\tR\nsamplerTag\"U\n\x15\x43ompactContextRequest\x12\x14\n\x05model\x18\x01 \x01(\tR\x05model\x12&\n\x05input\x18\x02 \x03(\x0b\x32\x10.xai_api.MessageR\x05input\"\xb7\x01\n\x16\x43ompactContextResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12+\n\x11\x65ncrypted_content\x18\x02 \x01(\tR\x10\x65ncryptedContent\x12\x32\n\x15\x64ropped_message_count\x18\x03 \x01(\rR\x13\x64roppedMessageCount\x12,\n\x05usage\x18\x04 \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage*\xb2\x03\n\rIncludeOption\x12\x1a\n\x16INCLUDE_OPTION_INVALID\x10\x00\x12)\n%INCLUDE_OPTION_WEB_SEARCH_CALL_OUTPUT\x10\x01\x12\'\n#INCLUDE_OPTION_X_SEARCH_CALL_OUTPUT\x10\x02\x12-\n)INCLUDE_OPTION_CODE_EXECUTION_CALL_OUTPUT\x10\x03\x12\x31\n-INCLUDE_OPTION_COLLECTIONS_SEARCH_CALL_OUTPUT\x10\x04\x12\x30\n,INCLUDE_OPTION_ATTACHMENT_SEARCH_CALL_OUTPUT\x10\x05\x12\"\n\x1eINCLUDE_OPTION_MCP_CALL_OUTPUT\x10\x06\x12#\n\x1fINCLUDE_OPTION_INLINE_CITATIONS\x10\x07\x12$\n INCLUDE_OPTION_VERBOSE_STREAMING\x10\x08\x12.\n*INCLUDE_OPTION_CODE_EXECUTION_FILES_OUTPUT\x10\t*\x8d\x01\n\x0bMessageRole\x12\x10\n\x0cINVALID_ROLE\x10\x00\x12\r\n\tROLE_USER\x10\x01\x12\x12\n\x0eROLE_ASSISTANT\x10\x02\x12\x0f\n\x0bROLE_SYSTEM\x10\x03\x12\x15\n\rROLE_FUNCTION\x10\x04\x1a\x02\x08\x01\x12\r\n\tROLE_TOOL\x10\x05\x12\x12\n\x0eROLE_DEVELOPER\x10\x06*j\n\x0fReasoningEffort\x12\x12\n\x0eINVALID_EFFORT\x10\x00\x12\x0e\n\nEFFORT_LOW\x10\x01\x12\x11\n\rEFFORT_MEDIUM\x10\x02\x12\x0f\n\x0b\x45\x46\x46ORT_HIGH\x10\x03\x12\x0f\n\x0b\x45\x46\x46ORT_NONE\x10\x04*P\n\nAgentCount\x12\x1b\n\x17\x41GENT_COUNT_UNSPECIFIED\x10\x00\x12\x11\n\rAGENT_COUNT_4\x10\x01\x12\x12\n\x0e\x41GENT_COUNT_16\x10\x02*a\n\x08ToolMode\x12\x15\n\x11TOOL_MODE_INVALID\x10\x00\x12\x12\n\x0eTOOL_MODE_AUTO\x10\x01\x12\x12\n\x0eTOOL_MODE_NONE\x10\x02\x12\x16\n\x12TOOL_MODE_REQUIRED\x10\x03*u\n\nFormatType\x12\x17\n\x13\x46ORMAT_TYPE_INVALID\x10\x00\x12\x14\n\x10\x46ORMAT_TYPE_TEXT\x10\x01\x12\x1b\n\x17\x46ORMAT_TYPE_JSON_OBJECT\x10\x02\x12\x1b\n\x17\x46ORMAT_TYPE_JSON_SCHEMA\x10\x03*\xb1\x02\n\x0cToolCallType\x12\x1a\n\x16TOOL_CALL_TYPE_INVALID\x10\x00\x12#\n\x1fTOOL_CALL_TYPE_CLIENT_SIDE_TOOL\x10\x01\x12\"\n\x1eTOOL_CALL_TYPE_WEB_SEARCH_TOOL\x10\x02\x12 \n\x1cTOOL_CALL_TYPE_X_SEARCH_TOOL\x10\x03\x12&\n\"TOOL_CALL_TYPE_CODE_EXECUTION_TOOL\x10\x04\x12*\n&TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL\x10\x05\x12\x1b\n\x17TOOL_CALL_TYPE_MCP_TOOL\x10\x06\x12)\n%TOOL_CALL_TYPE_ATTACHMENT_SEARCH_TOOL\x10\x07*\x90\x01\n\x0eToolCallStatus\x12 \n\x1cTOOL_CALL_STATUS_IN_PROGRESS\x10\x00\x12\x1e\n\x1aTOOL_CALL_STATUS_COMPLETED\x10\x01\x12\x1f\n\x1bTOOL_CALL_STATUS_INCOMPLETE\x10\x02\x12\x1b\n\x17TOOL_CALL_STATUS_FAILED\x10\x03*d\n\nSearchMode\x12\x17\n\x13INVALID_SEARCH_MODE\x10\x00\x12\x13\n\x0fOFF_SEARCH_MODE\x10\x01\x12\x12\n\x0eON_SEARCH_MODE\x10\x02\x12\x14\n\x10\x41UTO_SEARCH_MODE\x10\x03\x32\x99\x05\n\x04\x43hat\x12U\n\rGetCompletion\x12\x1e.xai_api.GetCompletionsRequest\x1a\".xai_api.GetChatCompletionResponse\"\x00\x12Y\n\x12GetCompletionChunk\x12\x1e.xai_api.GetCompletionsRequest\x1a\x1f.xai_api.GetChatCompletionChunk\"\x00\x30\x01\x12[\n\x17StartDeferredCompletion\x12\x1e.xai_api.GetCompletionsRequest\x1a\x1e.xai_api.StartDeferredResponse\"\x00\x12^\n\x15GetDeferredCompletion\x12\x1b.xai_api.GetDeferredRequest\x1a&.xai_api.GetDeferredCompletionResponse\"\x00\x12`\n\x13GetStoredCompletion\x12#.xai_api.GetStoredCompletionRequest\x1a\".xai_api.GetChatCompletionResponse\"\x00\x12k\n\x16\x44\x65leteStoredCompletion\x12&.xai_api.DeleteStoredCompletionRequest\x1a\'.xai_api.DeleteStoredCompletionResponse\"\x00\x12S\n\x0e\x43ompactContext\x12\x1e.xai_api.CompactContextRequest\x1a\x1f.xai_api.CompactContextResponse\"\x00\x42P\n\x0b\x63om.xai_apiB\tChatProtoP\x01\xa2\x02\x03XXX\xaa\x02\x06XaiApi\xca\x02\x06XaiApi\xe2\x02\x12XaiApi\\GPBMetadata\xea\x02\x06XaiApib\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15xai/api/v1/chat.proto\x12\x07xai_api\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19xai/api/v1/deferred.proto\x1a\x1axai/api/v1/documents.proto\x1a\x16xai/api/v1/image.proto\x1a\x17xai/api/v1/sample.proto\x1a\x16xai/api/v1/usage.proto\"\xf1\n\n\x15GetCompletionsRequest\x12,\n\x08messages\x18\x01 \x03(\x0b\x32\x10.xai_api.MessageR\x08messages\x12\x14\n\x05model\x18\x02 \x01(\tR\x05model\x12\x12\n\x04user\x18\x10 \x01(\tR\x04user\x12\x11\n\x01n\x18\x08 \x01(\x05H\x00R\x01n\x88\x01\x01\x12\"\n\nmax_tokens\x18\x07 \x01(\x05H\x01R\tmaxTokens\x88\x01\x01\x12\x17\n\x04seed\x18\x0b \x01(\x05H\x02R\x04seed\x88\x01\x01\x12\x12\n\x04stop\x18\x0c \x03(\tR\x04stop\x12%\n\x0btemperature\x18\x0e \x01(\x02H\x03R\x0btemperature\x88\x01\x01\x12\x18\n\x05top_p\x18\x0f \x01(\x02H\x04R\x04topP\x88\x01\x01\x12\x1a\n\x08logprobs\x18\x05 \x01(\x08R\x08logprobs\x12&\n\x0ctop_logprobs\x18\x06 \x01(\x05H\x05R\x0btopLogprobs\x88\x01\x01\x12#\n\x05tools\x18\x11 \x03(\x0b\x32\r.xai_api.ToolR\x05tools\x12\x34\n\x0btool_choice\x18\x12 \x01(\x0b\x32\x13.xai_api.ToolChoiceR\ntoolChoice\x12@\n\x0fresponse_format\x18\n \x01(\x0b\x32\x17.xai_api.ResponseFormatR\x0eresponseFormat\x12\x30\n\x11\x66requency_penalty\x18\x03 \x01(\x02H\x06R\x10\x66requencyPenalty\x88\x01\x01\x12.\n\x10presence_penalty\x18\t \x01(\x02H\x07R\x0fpresencePenalty\x88\x01\x01\x12H\n\x10reasoning_effort\x18\x13 \x01(\x0e\x32\x18.xai_api.ReasoningEffortH\x08R\x0freasoningEffort\x88\x01\x01\x12K\n\x11search_parameters\x18\x14 \x01(\x0b\x32\x19.xai_api.SearchParametersH\tR\x10searchParameters\x88\x01\x01\x12\x33\n\x13parallel_tool_calls\x18\x15 \x01(\x08H\nR\x11parallelToolCalls\x88\x01\x01\x12\x35\n\x14previous_response_id\x18\x16 \x01(\tH\x0bR\x12previousResponseId\x88\x01\x01\x12%\n\x0estore_messages\x18\x17 \x01(\x08R\rstoreMessages\x12\x32\n\x15use_encrypted_content\x18\x18 \x01(\x08R\x13useEncryptedContent\x12 \n\tmax_turns\x18\x19 \x01(\x05H\x0cR\x08maxTurns\x88\x01\x01\x12\x30\n\x07include\x18\x1a \x03(\x0e\x32\x16.xai_api.IncludeOptionR\x07include\x12\x39\n\x0b\x61gent_count\x18\x1d \x01(\x0e\x32\x13.xai_api.AgentCountH\rR\nagentCount\x88\x01\x01\x12\x37\n\x0cservice_tier\x18\x1f \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTierB\x04\n\x02_nB\r\n\x0b_max_tokensB\x07\n\x05_seedB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x0f\n\r_top_logprobsB\x14\n\x12_frequency_penaltyB\x13\n\x11_presence_penaltyB\x13\n\x11_reasoning_effortB\x14\n\x12_search_parametersB\x16\n\x14_parallel_tool_callsB\x17\n\x15_previous_response_idB\x0c\n\n_max_turnsB\x0e\n\x0c_agent_countJ\x04\x08\x04\x10\x05\"\x87\x04\n\x19GetChatCompletionResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x33\n\x07outputs\x18\x02 \x03(\x0b\x32\x19.xai_api.CompletionOutputR\x07outputs\x12\x34\n\x07\x63reated\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x07\x63reated\x12\x14\n\x05model\x18\x06 \x01(\tR\x05model\x12-\n\x12system_fingerprint\x18\x07 \x01(\tR\x11systemFingerprint\x12,\n\x05usage\x18\t \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage\x12\x1c\n\tcitations\x18\n \x03(\tR\tcitations\x12\x34\n\x08settings\x18\x0b \x01(\x0b\x32\x18.xai_api.RequestSettingsR\x08settings\x12\x37\n\x0c\x64\x65\x62ug_output\x18\x0c \x01(\x0b\x32\x14.xai_api.DebugOutputR\x0b\x64\x65\x62ugOutput\x12\x36\n\x0coutput_files\x18\r \x03(\x0b\x32\x13.xai_api.OutputFileR\x0boutputFiles\x12\x37\n\x0cservice_tier\x18\x0f \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTier\"\xd3\x03\n\x16GetChatCompletionChunk\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x38\n\x07outputs\x18\x02 \x03(\x0b\x32\x1e.xai_api.CompletionOutputChunkR\x07outputs\x12\x34\n\x07\x63reated\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x07\x63reated\x12\x14\n\x05model\x18\x04 \x01(\tR\x05model\x12-\n\x12system_fingerprint\x18\x05 \x01(\tR\x11systemFingerprint\x12,\n\x05usage\x18\x06 \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage\x12\x1c\n\tcitations\x18\x07 \x03(\tR\tcitations\x12\x37\n\x0c\x64\x65\x62ug_output\x18\n \x01(\x0b\x32\x14.xai_api.DebugOutputR\x0b\x64\x65\x62ugOutput\x12\x36\n\x0coutput_files\x18\x0b \x03(\x0b\x32\x13.xai_api.OutputFileR\x0boutputFiles\x12\x37\n\x0cservice_tier\x18\x0c \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTier\"9\n\nOutputFile\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\"\xa2\x01\n\x1dGetDeferredCompletionResponse\x12/\n\x06status\x18\x02 \x01(\x0e\x32\x17.xai_api.DeferredStatusR\x06status\x12\x43\n\x08response\x18\x01 \x01(\x0b\x32\".xai_api.GetChatCompletionResponseH\x00R\x08response\x88\x01\x01\x42\x0b\n\t_response\"\xc9\x01\n\x10\x43ompletionOutput\x12:\n\rfinish_reason\x18\x01 \x01(\x0e\x32\x15.xai_api.FinishReasonR\x0c\x66inishReason\x12\x14\n\x05index\x18\x02 \x01(\x05R\x05index\x12\x34\n\x07message\x18\x03 \x01(\x0b\x32\x1a.xai_api.CompletionMessageR\x07message\x12-\n\x08logprobs\x18\x04 \x01(\x0b\x32\x11.xai_api.LogProbsR\x08logprobs\"\x9a\x02\n\x11\x43ompletionMessage\x12\x18\n\x07\x63ontent\x18\x01 \x01(\tR\x07\x63ontent\x12+\n\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x30\n\ntool_calls\x18\x03 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x05 \x01(\tR\x10\x65ncryptedContent\x12\x35\n\tcitations\x18\x06 \x03(\x0b\x32\x17.xai_api.InlineCitationR\tcitations\"\xbe\x01\n\x15\x43ompletionOutputChunk\x12$\n\x05\x64\x65lta\x18\x01 \x01(\x0b\x32\x0e.xai_api.DeltaR\x05\x64\x65lta\x12-\n\x08logprobs\x18\x02 \x01(\x0b\x32\x11.xai_api.LogProbsR\x08logprobs\x12:\n\rfinish_reason\x18\x03 \x01(\x0e\x32\x15.xai_api.FinishReasonR\x0c\x66inishReason\x12\x14\n\x05index\x18\x04 \x01(\x05R\x05index\"\x8e\x02\n\x05\x44\x65lta\x12\x18\n\x07\x63ontent\x18\x01 \x01(\tR\x07\x63ontent\x12+\n\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x30\n\ntool_calls\x18\x03 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x05 \x01(\tR\x10\x65ncryptedContent\x12\x35\n\tcitations\x18\x06 \x03(\x0b\x32\x17.xai_api.InlineCitationR\tcitations\"\xad\x02\n\x0eInlineCitation\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1f\n\x0bstart_index\x18\x02 \x01(\x05R\nstartIndex\x12\x1b\n\tend_index\x18\x06 \x01(\x05R\x08\x65ndIndex\x12\x39\n\x0cweb_citation\x18\x03 \x01(\x0b\x32\x14.xai_api.WebCitationH\x00R\x0bwebCitation\x12\x33\n\nx_citation\x18\x04 \x01(\x0b\x32\x12.xai_api.XCitationH\x00R\txCitation\x12Q\n\x14\x63ollections_citation\x18\x05 \x01(\x0b\x32\x1c.xai_api.CollectionsCitationH\x00R\x13\x63ollectionsCitationB\n\n\x08\x63itation\"\x1f\n\x0bWebCitation\x12\x10\n\x03url\x18\x01 \x01(\tR\x03url\"\x1d\n\tXCitation\x12\x10\n\x03url\x18\x01 \x01(\tR\x03url\"\xab\x01\n\x13\x43ollectionsCitation\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x19\n\x08\x63hunk_id\x18\x02 \x01(\tR\x07\x63hunkId\x12#\n\rchunk_content\x18\x03 \x01(\tR\x0c\x63hunkContent\x12\x14\n\x05score\x18\x04 \x01(\x02R\x05score\x12%\n\x0e\x63ollection_ids\x18\x05 \x03(\tR\rcollectionIds\"6\n\x08LogProbs\x12*\n\x07\x63ontent\x18\x01 \x03(\x0b\x32\x10.xai_api.LogProbR\x07\x63ontent\"\x87\x01\n\x07LogProb\x12\x14\n\x05token\x18\x01 \x01(\tR\x05token\x12\x18\n\x07logprob\x18\x02 \x01(\x02R\x07logprob\x12\x14\n\x05\x62ytes\x18\x03 \x01(\x0cR\x05\x62ytes\x12\x36\n\x0ctop_logprobs\x18\x04 \x03(\x0b\x32\x13.xai_api.TopLogProbR\x0btopLogprobs\"R\n\nTopLogProb\x12\x14\n\x05token\x18\x01 \x01(\tR\x05token\x12\x18\n\x07logprob\x18\x02 \x01(\x02R\x07logprob\x12\x14\n\x05\x62ytes\x18\x03 \x01(\x0cR\x05\x62ytes\"\x8f\x01\n\x07\x43ontent\x12\x14\n\x04text\x18\x01 \x01(\tH\x00R\x04text\x12\x37\n\timage_url\x18\x02 \x01(\x0b\x32\x18.xai_api.ImageUrlContentH\x00R\x08imageUrl\x12*\n\x04\x66ile\x18\x03 \x01(\x0b\x32\x14.xai_api.FileContentH\x00R\x04\x66ileB\t\n\x07\x63ontent\"\x85\x01\n\x0b\x46ileContent\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x12\n\x04\x64\x61ta\x18\x02 \x01(\x0cR\x04\x64\x61ta\x12\x1a\n\x08\x66ilename\x18\x03 \x01(\tR\x08\x66ilename\x12\x1b\n\tmime_type\x18\x04 \x01(\tR\x08mimeType\x12\x10\n\x03url\x18\x05 \x01(\tR\x03url\"\xd2\x02\n\x07Message\x12*\n\x07\x63ontent\x18\x01 \x03(\x0b\x32\x10.xai_api.ContentR\x07\x63ontent\x12\x30\n\x11reasoning_content\x18\x05 \x01(\tH\x00R\x10reasoningContent\x88\x01\x01\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x30\n\ntool_calls\x18\x04 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x06 \x01(\tR\x10\x65ncryptedContent\x12%\n\x0ctool_call_id\x18\x07 \x01(\tH\x01R\ntoolCallId\x88\x01\x01\x42\x14\n\x12_reasoning_contentB\x0f\n\r_tool_call_id\"k\n\nToolChoice\x12\'\n\x04mode\x18\x01 \x01(\x0e\x32\x11.xai_api.ToolModeH\x00R\x04mode\x12%\n\rfunction_name\x18\x02 \x01(\tH\x00R\x0c\x66unctionNameB\r\n\x0btool_choice\"\xe4\x03\n\x04Tool\x12/\n\x08\x66unction\x18\x01 \x01(\x0b\x32\x11.xai_api.FunctionH\x00R\x08\x66unction\x12\x33\n\nweb_search\x18\x03 \x01(\x0b\x32\x12.xai_api.WebSearchH\x00R\twebSearch\x12-\n\x08x_search\x18\x04 \x01(\x0b\x32\x10.xai_api.XSearchH\x00R\x07xSearch\x12?\n\x0e\x63ode_execution\x18\x05 \x01(\x0b\x32\x16.xai_api.CodeExecutionH\x00R\rcodeExecution\x12K\n\x12\x63ollections_search\x18\x06 \x01(\x0b\x32\x1a.xai_api.CollectionsSearchH\x00R\x11\x63ollectionsSearch\x12 \n\x03mcp\x18\x07 \x01(\x0b\x32\x0c.xai_api.MCPH\x00R\x03mcp\x12H\n\x11\x61ttachment_search\x18\x08 \x01(\x0b\x32\x19.xai_api.AttachmentSearchH\x00R\x10\x61ttachmentSearch\x12\x45\n\x10image_generation\x18\n \x01(\x0b\x32\x18.xai_api.ImageGenerationH\x00R\x0fimageGenerationB\x06\n\x04tool\"\xe7\x02\n\x03MCP\x12!\n\x0cserver_label\x18\x01 \x01(\tR\x0bserverLabel\x12-\n\x12server_description\x18\x02 \x01(\tR\x11serverDescription\x12\x1d\n\nserver_url\x18\x03 \x01(\tR\tserverUrl\x12,\n\x12\x61llowed_tool_names\x18\x04 \x03(\tR\x10\x61llowedToolNames\x12)\n\rauthorization\x18\x05 \x01(\tH\x00R\rauthorization\x88\x01\x01\x12\x43\n\rextra_headers\x18\x06 \x03(\x0b\x32\x1e.xai_api.MCP.ExtraHeadersEntryR\x0c\x65xtraHeaders\x1a?\n\x11\x45xtraHeadersEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x10\n\x0e_authorization\"\xea\x02\n\tWebSearch\x12)\n\x10\x65xcluded_domains\x18\x01 \x03(\tR\x0f\x65xcludedDomains\x12\'\n\x0f\x61llowed_domains\x18\x02 \x03(\tR\x0e\x61llowedDomains\x12\x41\n\x1a\x65nable_image_understanding\x18\x03 \x01(\x08H\x00R\x18\x65nableImageUnderstanding\x88\x01\x01\x12H\n\ruser_location\x18\x04 \x01(\x0b\x32\x1e.xai_api.WebSearchUserLocationH\x01R\x0cuserLocation\x88\x01\x01\x12\x33\n\x13\x65nable_image_search\x18\x05 \x01(\x08H\x02R\x11\x65nableImageSearch\x88\x01\x01\x42\x1d\n\x1b_enable_image_understandingB\x10\n\x0e_user_locationB\x16\n\x14_enable_image_search\"\xba\x01\n\x15WebSearchUserLocation\x12\x1d\n\x07\x63ountry\x18\x01 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x17\n\x04\x63ity\x18\x02 \x01(\tH\x01R\x04\x63ity\x88\x01\x01\x12\x1b\n\x06region\x18\x03 \x01(\tH\x02R\x06region\x88\x01\x01\x12\x1f\n\x08timezone\x18\x04 \x01(\tH\x03R\x08timezone\x88\x01\x01\x42\n\n\x08_countryB\x07\n\x05_cityB\t\n\x07_regionB\x0b\n\t_timezone\"\xb9\x03\n\x07XSearch\x12<\n\tfrom_date\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00R\x08\x66romDate\x88\x01\x01\x12\x38\n\x07to_date\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x01R\x06toDate\x88\x01\x01\x12*\n\x11\x61llowed_x_handles\x18\x03 \x03(\tR\x0f\x61llowedXHandles\x12,\n\x12\x65xcluded_x_handles\x18\x04 \x03(\tR\x10\x65xcludedXHandles\x12\x41\n\x1a\x65nable_image_understanding\x18\x05 \x01(\x08H\x02R\x18\x65nableImageUnderstanding\x88\x01\x01\x12\x41\n\x1a\x65nable_video_understanding\x18\x06 \x01(\x08H\x03R\x18\x65nableVideoUnderstanding\x88\x01\x01\x42\x0c\n\n_from_dateB\n\n\x08_to_dateB\x1d\n\x1b_enable_image_understandingB\x1d\n\x1b_enable_video_understanding\"\x0f\n\rCodeExecution\"9\n\x0fImageGeneration\x12\x1b\n\x06\x61\x63tion\x18\x01 \x01(\tH\x00R\x06\x61\x63tion\x88\x01\x01\x42\t\n\x07_action\"\x89\x03\n\x11\x43ollectionsSearch\x12%\n\x0e\x63ollection_ids\x18\x01 \x03(\tR\rcollectionIds\x12\x19\n\x05limit\x18\x02 \x01(\x05H\x01R\x05limit\x88\x01\x01\x12\'\n\x0cinstructions\x18\x03 \x01(\tH\x02R\x0cinstructions\x88\x01\x01\x12\x45\n\x10hybrid_retrieval\x18\x04 \x01(\x0b\x32\x18.xai_api.HybridRetrievalH\x00R\x0fhybridRetrieval\x12K\n\x12semantic_retrieval\x18\x05 \x01(\x0b\x32\x1a.xai_api.SemanticRetrievalH\x00R\x11semanticRetrieval\x12H\n\x11keyword_retrieval\x18\x06 \x01(\x0b\x32\x19.xai_api.KeywordRetrievalH\x00R\x10keywordRetrievalB\x10\n\x0eretrieval_modeB\x08\n\x06_limitB\x0f\n\r_instructions\"7\n\x10\x41ttachmentSearch\x12\x19\n\x05limit\x18\x02 \x01(\x05H\x00R\x05limit\x88\x01\x01\x42\x08\n\x06_limit\"x\n\x08\x46unction\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12 \n\x0b\x64\x65scription\x18\x02 \x01(\tR\x0b\x64\x65scription\x12\x16\n\x06strict\x18\x03 \x01(\x08R\x06strict\x12\x1e\n\nparameters\x18\x04 \x01(\tR\nparameters\"\xef\x01\n\x08ToolCall\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.xai_api.ToolCallTypeR\x04type\x12/\n\x06status\x18\x03 \x01(\x0e\x32\x17.xai_api.ToolCallStatusR\x06status\x12(\n\rerror_message\x18\x04 \x01(\tH\x01R\x0c\x65rrorMessage\x88\x01\x01\x12\x33\n\x08\x66unction\x18\n \x01(\x0b\x32\x15.xai_api.FunctionCallH\x00R\x08\x66unctionB\x06\n\x04toolB\x10\n\x0e_error_message\"@\n\x0c\x46unctionCall\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1c\n\targuments\x18\x02 \x01(\tR\targuments\"n\n\x0eResponseFormat\x12\x34\n\x0b\x66ormat_type\x18\x01 \x01(\x0e\x32\x13.xai_api.FormatTypeR\nformatType\x12\x1b\n\x06schema\x18\x02 \x01(\tH\x00R\x06schema\x88\x01\x01\x42\t\n\x07_schema\"\xc9\x02\n\x10SearchParameters\x12\'\n\x04mode\x18\x01 \x01(\x0e\x32\x13.xai_api.SearchModeR\x04mode\x12)\n\x07sources\x18\t \x03(\x0b\x32\x0f.xai_api.SourceR\x07sources\x12\x37\n\tfrom_date\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x08\x66romDate\x12\x33\n\x07to_date\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x06toDate\x12)\n\x10return_citations\x18\x07 \x01(\x08R\x0freturnCitations\x12\x31\n\x12max_search_results\x18\x08 \x01(\x05H\x00R\x10maxSearchResults\x88\x01\x01\x42\x15\n\x13_max_search_results\"\xaf\x01\n\x06Source\x12&\n\x03web\x18\x01 \x01(\x0b\x32\x12.xai_api.WebSourceH\x00R\x03web\x12)\n\x04news\x18\x02 \x01(\x0b\x32\x13.xai_api.NewsSourceH\x00R\x04news\x12 \n\x01x\x18\x03 \x01(\x0b\x32\x10.xai_api.XSourceH\x00R\x01x\x12&\n\x03rss\x18\x04 \x01(\x0b\x32\x12.xai_api.RssSourceH\x00R\x03rssB\x08\n\x06source\"\xaf\x01\n\tWebSource\x12+\n\x11\x65xcluded_websites\x18\x02 \x03(\tR\x10\x65xcludedWebsites\x12)\n\x10\x61llowed_websites\x18\x05 \x03(\tR\x0f\x61llowedWebsites\x12\x1d\n\x07\x63ountry\x18\x03 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x1f\n\x0bsafe_search\x18\x04 \x01(\x08R\nsafeSearchB\n\n\x08_country\"\x85\x01\n\nNewsSource\x12+\n\x11\x65xcluded_websites\x18\x02 \x03(\tR\x10\x65xcludedWebsites\x12\x1d\n\x07\x63ountry\x18\x03 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x1f\n\x0bsafe_search\x18\x04 \x01(\x08R\nsafeSearchB\n\n\x08_country\"\xf9\x01\n\x07XSource\x12,\n\x12included_x_handles\x18\x07 \x03(\tR\x10includedXHandles\x12,\n\x12\x65xcluded_x_handles\x18\x08 \x03(\tR\x10\x65xcludedXHandles\x12\x33\n\x13post_favorite_count\x18\t \x01(\x05H\x00R\x11postFavoriteCount\x88\x01\x01\x12+\n\x0fpost_view_count\x18\n \x01(\x05H\x01R\rpostViewCount\x88\x01\x01\x42\x16\n\x14_post_favorite_countB\x12\n\x10_post_view_countJ\x04\x08\x06\x10\x07\"!\n\tRssSource\x12\x14\n\x05links\x18\x01 \x03(\tR\x05links\"\x9f\x06\n\x0fRequestSettings\x12\"\n\nmax_tokens\x18\x01 \x01(\x05H\x00R\tmaxTokens\x88\x01\x01\x12.\n\x13parallel_tool_calls\x18\x02 \x01(\x08R\x11parallelToolCalls\x12\x35\n\x14previous_response_id\x18\x03 \x01(\tH\x01R\x12previousResponseId\x88\x01\x01\x12H\n\x10reasoning_effort\x18\x04 \x01(\x0e\x32\x18.xai_api.ReasoningEffortH\x02R\x0freasoningEffort\x88\x01\x01\x12%\n\x0btemperature\x18\x05 \x01(\x02H\x03R\x0btemperature\x88\x01\x01\x12@\n\x0fresponse_format\x18\x06 \x01(\x0b\x32\x17.xai_api.ResponseFormatR\x0eresponseFormat\x12\x34\n\x0btool_choice\x18\x07 \x01(\x0b\x32\x13.xai_api.ToolChoiceR\ntoolChoice\x12#\n\x05tools\x18\x08 \x03(\x0b\x32\r.xai_api.ToolR\x05tools\x12\x18\n\x05top_p\x18\t \x01(\x02H\x04R\x04topP\x88\x01\x01\x12\x12\n\x04user\x18\n \x01(\tR\x04user\x12K\n\x11search_parameters\x18\x0b \x01(\x0b\x32\x19.xai_api.SearchParametersH\x05R\x10searchParameters\x88\x01\x01\x12%\n\x0estore_messages\x18\x0c \x01(\x08R\rstoreMessages\x12\x32\n\x15use_encrypted_content\x18\r \x01(\x08R\x13useEncryptedContent\x12\x30\n\x07include\x18\x0e \x03(\x0e\x32\x16.xai_api.IncludeOptionR\x07includeB\r\n\x0b_max_tokensB\x17\n\x15_previous_response_idB\x13\n\x11_reasoning_effortB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x14\n\x12_search_parameters\"=\n\x1aGetStoredCompletionRequest\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"@\n\x1d\x44\x65leteStoredCompletionRequest\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"A\n\x1e\x44\x65leteStoredCompletionResponse\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"\xba\x03\n\x0b\x44\x65\x62ugOutput\x12\x1a\n\x08\x61ttempts\x18\x01 \x01(\x05R\x08\x61ttempts\x12\x18\n\x07request\x18\x02 \x01(\tR\x07request\x12\x16\n\x06prompt\x18\x03 \x01(\tR\x06prompt\x12%\n\x0e\x65ngine_request\x18\t \x01(\tR\rengineRequest\x12\x1c\n\tresponses\x18\x04 \x03(\tR\tresponses\x12\x16\n\x06\x63hunks\x18\x0c \x03(\tR\x06\x63hunks\x12(\n\x10\x63\x61\x63he_read_count\x18\x05 \x01(\rR\x0e\x63\x61\x63heReadCount\x12\x33\n\x16\x63\x61\x63he_read_input_bytes\x18\x06 \x01(\x04R\x13\x63\x61\x63heReadInputBytes\x12*\n\x11\x63\x61\x63he_write_count\x18\x07 \x01(\rR\x0f\x63\x61\x63heWriteCount\x12\x35\n\x17\x63\x61\x63he_write_input_bytes\x18\x08 \x01(\x04R\x14\x63\x61\x63heWriteInputBytes\x12\x1d\n\nlb_address\x18\n \x01(\tR\tlbAddress\x12\x1f\n\x0bsampler_tag\x18\x0b \x01(\tR\nsamplerTag\"U\n\x15\x43ompactContextRequest\x12\x14\n\x05model\x18\x01 \x01(\tR\x05model\x12&\n\x05input\x18\x02 \x03(\x0b\x32\x10.xai_api.MessageR\x05input\"\xb7\x01\n\x16\x43ompactContextResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12+\n\x11\x65ncrypted_content\x18\x02 \x01(\tR\x10\x65ncryptedContent\x12\x32\n\x15\x64ropped_message_count\x18\x03 \x01(\rR\x13\x64roppedMessageCount\x12,\n\x05usage\x18\x04 \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage*\xb2\x03\n\rIncludeOption\x12\x1a\n\x16INCLUDE_OPTION_INVALID\x10\x00\x12)\n%INCLUDE_OPTION_WEB_SEARCH_CALL_OUTPUT\x10\x01\x12\'\n#INCLUDE_OPTION_X_SEARCH_CALL_OUTPUT\x10\x02\x12-\n)INCLUDE_OPTION_CODE_EXECUTION_CALL_OUTPUT\x10\x03\x12\x31\n-INCLUDE_OPTION_COLLECTIONS_SEARCH_CALL_OUTPUT\x10\x04\x12\x30\n,INCLUDE_OPTION_ATTACHMENT_SEARCH_CALL_OUTPUT\x10\x05\x12\"\n\x1eINCLUDE_OPTION_MCP_CALL_OUTPUT\x10\x06\x12#\n\x1fINCLUDE_OPTION_INLINE_CITATIONS\x10\x07\x12$\n INCLUDE_OPTION_VERBOSE_STREAMING\x10\x08\x12.\n*INCLUDE_OPTION_CODE_EXECUTION_FILES_OUTPUT\x10\t*\x8d\x01\n\x0bMessageRole\x12\x10\n\x0cINVALID_ROLE\x10\x00\x12\r\n\tROLE_USER\x10\x01\x12\x12\n\x0eROLE_ASSISTANT\x10\x02\x12\x0f\n\x0bROLE_SYSTEM\x10\x03\x12\x15\n\rROLE_FUNCTION\x10\x04\x1a\x02\x08\x01\x12\r\n\tROLE_TOOL\x10\x05\x12\x12\n\x0eROLE_DEVELOPER\x10\x06*j\n\x0fReasoningEffort\x12\x12\n\x0eINVALID_EFFORT\x10\x00\x12\x0e\n\nEFFORT_LOW\x10\x01\x12\x11\n\rEFFORT_MEDIUM\x10\x02\x12\x0f\n\x0b\x45\x46\x46ORT_HIGH\x10\x03\x12\x0f\n\x0b\x45\x46\x46ORT_NONE\x10\x04*P\n\nAgentCount\x12\x1b\n\x17\x41GENT_COUNT_UNSPECIFIED\x10\x00\x12\x11\n\rAGENT_COUNT_4\x10\x01\x12\x12\n\x0e\x41GENT_COUNT_16\x10\x02*a\n\x08ToolMode\x12\x15\n\x11TOOL_MODE_INVALID\x10\x00\x12\x12\n\x0eTOOL_MODE_AUTO\x10\x01\x12\x12\n\x0eTOOL_MODE_NONE\x10\x02\x12\x16\n\x12TOOL_MODE_REQUIRED\x10\x03*u\n\nFormatType\x12\x17\n\x13\x46ORMAT_TYPE_INVALID\x10\x00\x12\x14\n\x10\x46ORMAT_TYPE_TEXT\x10\x01\x12\x1b\n\x17\x46ORMAT_TYPE_JSON_OBJECT\x10\x02\x12\x1b\n\x17\x46ORMAT_TYPE_JSON_SCHEMA\x10\x03*\xdb\x02\n\x0cToolCallType\x12\x1a\n\x16TOOL_CALL_TYPE_INVALID\x10\x00\x12#\n\x1fTOOL_CALL_TYPE_CLIENT_SIDE_TOOL\x10\x01\x12\"\n\x1eTOOL_CALL_TYPE_WEB_SEARCH_TOOL\x10\x02\x12 \n\x1cTOOL_CALL_TYPE_X_SEARCH_TOOL\x10\x03\x12&\n\"TOOL_CALL_TYPE_CODE_EXECUTION_TOOL\x10\x04\x12*\n&TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL\x10\x05\x12\x1b\n\x17TOOL_CALL_TYPE_MCP_TOOL\x10\x06\x12)\n%TOOL_CALL_TYPE_ATTACHMENT_SEARCH_TOOL\x10\x07\x12(\n$TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL\x10\n*\x90\x01\n\x0eToolCallStatus\x12 \n\x1cTOOL_CALL_STATUS_IN_PROGRESS\x10\x00\x12\x1e\n\x1aTOOL_CALL_STATUS_COMPLETED\x10\x01\x12\x1f\n\x1bTOOL_CALL_STATUS_INCOMPLETE\x10\x02\x12\x1b\n\x17TOOL_CALL_STATUS_FAILED\x10\x03*d\n\nSearchMode\x12\x17\n\x13INVALID_SEARCH_MODE\x10\x00\x12\x13\n\x0fOFF_SEARCH_MODE\x10\x01\x12\x12\n\x0eON_SEARCH_MODE\x10\x02\x12\x14\n\x10\x41UTO_SEARCH_MODE\x10\x03\x32\x99\x05\n\x04\x43hat\x12U\n\rGetCompletion\x12\x1e.xai_api.GetCompletionsRequest\x1a\".xai_api.GetChatCompletionResponse\"\x00\x12Y\n\x12GetCompletionChunk\x12\x1e.xai_api.GetCompletionsRequest\x1a\x1f.xai_api.GetChatCompletionChunk\"\x00\x30\x01\x12[\n\x17StartDeferredCompletion\x12\x1e.xai_api.GetCompletionsRequest\x1a\x1e.xai_api.StartDeferredResponse\"\x00\x12^\n\x15GetDeferredCompletion\x12\x1b.xai_api.GetDeferredRequest\x1a&.xai_api.GetDeferredCompletionResponse\"\x00\x12`\n\x13GetStoredCompletion\x12#.xai_api.GetStoredCompletionRequest\x1a\".xai_api.GetChatCompletionResponse\"\x00\x12k\n\x16\x44\x65leteStoredCompletion\x12&.xai_api.DeleteStoredCompletionRequest\x1a\'.xai_api.DeleteStoredCompletionResponse\"\x00\x12S\n\x0e\x43ompactContext\x12\x1e.xai_api.CompactContextRequest\x1a\x1f.xai_api.CompactContextResponse\"\x00\x42P\n\x0b\x63om.xai_apiB\tChatProtoP\x01\xa2\x02\x03XXX\xaa\x02\x06XaiApi\xca\x02\x06XaiApi\xe2\x02\x12XaiApi\\GPBMetadata\xea\x02\x06XaiApib\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -42,24 +42,24 @@ _globals['_MESSAGEROLE'].values_by_name["ROLE_FUNCTION"]._serialized_options = b'\010\001' _globals['_MCP_EXTRAHEADERSENTRY']._loaded_options = None _globals['_MCP_EXTRAHEADERSENTRY']._serialized_options = b'8\001' - _globals['_INCLUDEOPTION']._serialized_start=10930 - _globals['_INCLUDEOPTION']._serialized_end=11364 - _globals['_MESSAGEROLE']._serialized_start=11367 - _globals['_MESSAGEROLE']._serialized_end=11508 - _globals['_REASONINGEFFORT']._serialized_start=11510 - _globals['_REASONINGEFFORT']._serialized_end=11616 - _globals['_AGENTCOUNT']._serialized_start=11618 - _globals['_AGENTCOUNT']._serialized_end=11698 - _globals['_TOOLMODE']._serialized_start=11700 - _globals['_TOOLMODE']._serialized_end=11797 - _globals['_FORMATTYPE']._serialized_start=11799 - _globals['_FORMATTYPE']._serialized_end=11916 - _globals['_TOOLCALLTYPE']._serialized_start=11919 - _globals['_TOOLCALLTYPE']._serialized_end=12224 - _globals['_TOOLCALLSTATUS']._serialized_start=12227 - _globals['_TOOLCALLSTATUS']._serialized_end=12371 - _globals['_SEARCHMODE']._serialized_start=12373 - _globals['_SEARCHMODE']._serialized_end=12473 + _globals['_INCLUDEOPTION']._serialized_start=11060 + _globals['_INCLUDEOPTION']._serialized_end=11494 + _globals['_MESSAGEROLE']._serialized_start=11497 + _globals['_MESSAGEROLE']._serialized_end=11638 + _globals['_REASONINGEFFORT']._serialized_start=11640 + _globals['_REASONINGEFFORT']._serialized_end=11746 + _globals['_AGENTCOUNT']._serialized_start=11748 + _globals['_AGENTCOUNT']._serialized_end=11828 + _globals['_TOOLMODE']._serialized_start=11830 + _globals['_TOOLMODE']._serialized_end=11927 + _globals['_FORMATTYPE']._serialized_start=11929 + _globals['_FORMATTYPE']._serialized_end=12046 + _globals['_TOOLCALLTYPE']._serialized_start=12049 + _globals['_TOOLCALLTYPE']._serialized_end=12396 + _globals['_TOOLCALLSTATUS']._serialized_start=12399 + _globals['_TOOLCALLSTATUS']._serialized_end=12543 + _globals['_SEARCHMODE']._serialized_start=12545 + _globals['_SEARCHMODE']._serialized_end=12645 _globals['_GETCOMPLETIONSREQUEST']._serialized_start=196 _globals['_GETCOMPLETIONSREQUEST']._serialized_end=1589 _globals['_GETCHATCOMPLETIONRESPONSE']._serialized_start=1592 @@ -101,57 +101,59 @@ _globals['_TOOLCHOICE']._serialized_start=5205 _globals['_TOOLCHOICE']._serialized_end=5312 _globals['_TOOL']._serialized_start=5315 - _globals['_TOOL']._serialized_end=5728 - _globals['_MCP']._serialized_start=5731 - _globals['_MCP']._serialized_end=6090 - _globals['_MCP_EXTRAHEADERSENTRY']._serialized_start=6009 - _globals['_MCP_EXTRAHEADERSENTRY']._serialized_end=6072 - _globals['_WEBSEARCH']._serialized_start=6093 - _globals['_WEBSEARCH']._serialized_end=6455 - _globals['_WEBSEARCHUSERLOCATION']._serialized_start=6458 - _globals['_WEBSEARCHUSERLOCATION']._serialized_end=6644 - _globals['_XSEARCH']._serialized_start=6647 - _globals['_XSEARCH']._serialized_end=7088 - _globals['_CODEEXECUTION']._serialized_start=7090 - _globals['_CODEEXECUTION']._serialized_end=7105 - _globals['_COLLECTIONSSEARCH']._serialized_start=7108 - _globals['_COLLECTIONSSEARCH']._serialized_end=7501 - _globals['_ATTACHMENTSEARCH']._serialized_start=7503 - _globals['_ATTACHMENTSEARCH']._serialized_end=7558 - _globals['_FUNCTION']._serialized_start=7560 - _globals['_FUNCTION']._serialized_end=7680 - _globals['_TOOLCALL']._serialized_start=7683 - _globals['_TOOLCALL']._serialized_end=7922 - _globals['_FUNCTIONCALL']._serialized_start=7924 - _globals['_FUNCTIONCALL']._serialized_end=7988 - _globals['_RESPONSEFORMAT']._serialized_start=7990 - _globals['_RESPONSEFORMAT']._serialized_end=8100 - _globals['_SEARCHPARAMETERS']._serialized_start=8103 - _globals['_SEARCHPARAMETERS']._serialized_end=8432 - _globals['_SOURCE']._serialized_start=8435 - _globals['_SOURCE']._serialized_end=8610 - _globals['_WEBSOURCE']._serialized_start=8613 - _globals['_WEBSOURCE']._serialized_end=8788 - _globals['_NEWSSOURCE']._serialized_start=8791 - _globals['_NEWSSOURCE']._serialized_end=8924 - _globals['_XSOURCE']._serialized_start=8927 - _globals['_XSOURCE']._serialized_end=9176 - _globals['_RSSSOURCE']._serialized_start=9178 - _globals['_RSSSOURCE']._serialized_end=9211 - _globals['_REQUESTSETTINGS']._serialized_start=9214 - _globals['_REQUESTSETTINGS']._serialized_end=10013 - _globals['_GETSTOREDCOMPLETIONREQUEST']._serialized_start=10015 - _globals['_GETSTOREDCOMPLETIONREQUEST']._serialized_end=10076 - _globals['_DELETESTOREDCOMPLETIONREQUEST']._serialized_start=10078 - _globals['_DELETESTOREDCOMPLETIONREQUEST']._serialized_end=10142 - _globals['_DELETESTOREDCOMPLETIONRESPONSE']._serialized_start=10144 - _globals['_DELETESTOREDCOMPLETIONRESPONSE']._serialized_end=10209 - _globals['_DEBUGOUTPUT']._serialized_start=10212 - _globals['_DEBUGOUTPUT']._serialized_end=10654 - _globals['_COMPACTCONTEXTREQUEST']._serialized_start=10656 - _globals['_COMPACTCONTEXTREQUEST']._serialized_end=10741 - _globals['_COMPACTCONTEXTRESPONSE']._serialized_start=10744 - _globals['_COMPACTCONTEXTRESPONSE']._serialized_end=10927 - _globals['_CHAT']._serialized_start=12476 - _globals['_CHAT']._serialized_end=13141 + _globals['_TOOL']._serialized_end=5799 + _globals['_MCP']._serialized_start=5802 + _globals['_MCP']._serialized_end=6161 + _globals['_MCP_EXTRAHEADERSENTRY']._serialized_start=6080 + _globals['_MCP_EXTRAHEADERSENTRY']._serialized_end=6143 + _globals['_WEBSEARCH']._serialized_start=6164 + _globals['_WEBSEARCH']._serialized_end=6526 + _globals['_WEBSEARCHUSERLOCATION']._serialized_start=6529 + _globals['_WEBSEARCHUSERLOCATION']._serialized_end=6715 + _globals['_XSEARCH']._serialized_start=6718 + _globals['_XSEARCH']._serialized_end=7159 + _globals['_CODEEXECUTION']._serialized_start=7161 + _globals['_CODEEXECUTION']._serialized_end=7176 + _globals['_IMAGEGENERATION']._serialized_start=7178 + _globals['_IMAGEGENERATION']._serialized_end=7235 + _globals['_COLLECTIONSSEARCH']._serialized_start=7238 + _globals['_COLLECTIONSSEARCH']._serialized_end=7631 + _globals['_ATTACHMENTSEARCH']._serialized_start=7633 + _globals['_ATTACHMENTSEARCH']._serialized_end=7688 + _globals['_FUNCTION']._serialized_start=7690 + _globals['_FUNCTION']._serialized_end=7810 + _globals['_TOOLCALL']._serialized_start=7813 + _globals['_TOOLCALL']._serialized_end=8052 + _globals['_FUNCTIONCALL']._serialized_start=8054 + _globals['_FUNCTIONCALL']._serialized_end=8118 + _globals['_RESPONSEFORMAT']._serialized_start=8120 + _globals['_RESPONSEFORMAT']._serialized_end=8230 + _globals['_SEARCHPARAMETERS']._serialized_start=8233 + _globals['_SEARCHPARAMETERS']._serialized_end=8562 + _globals['_SOURCE']._serialized_start=8565 + _globals['_SOURCE']._serialized_end=8740 + _globals['_WEBSOURCE']._serialized_start=8743 + _globals['_WEBSOURCE']._serialized_end=8918 + _globals['_NEWSSOURCE']._serialized_start=8921 + _globals['_NEWSSOURCE']._serialized_end=9054 + _globals['_XSOURCE']._serialized_start=9057 + _globals['_XSOURCE']._serialized_end=9306 + _globals['_RSSSOURCE']._serialized_start=9308 + _globals['_RSSSOURCE']._serialized_end=9341 + _globals['_REQUESTSETTINGS']._serialized_start=9344 + _globals['_REQUESTSETTINGS']._serialized_end=10143 + _globals['_GETSTOREDCOMPLETIONREQUEST']._serialized_start=10145 + _globals['_GETSTOREDCOMPLETIONREQUEST']._serialized_end=10206 + _globals['_DELETESTOREDCOMPLETIONREQUEST']._serialized_start=10208 + _globals['_DELETESTOREDCOMPLETIONREQUEST']._serialized_end=10272 + _globals['_DELETESTOREDCOMPLETIONRESPONSE']._serialized_start=10274 + _globals['_DELETESTOREDCOMPLETIONRESPONSE']._serialized_end=10339 + _globals['_DEBUGOUTPUT']._serialized_start=10342 + _globals['_DEBUGOUTPUT']._serialized_end=10784 + _globals['_COMPACTCONTEXTREQUEST']._serialized_start=10786 + _globals['_COMPACTCONTEXTREQUEST']._serialized_end=10871 + _globals['_COMPACTCONTEXTRESPONSE']._serialized_start=10874 + _globals['_COMPACTCONTEXTRESPONSE']._serialized_end=11057 + _globals['_CHAT']._serialized_start=12648 + _globals['_CHAT']._serialized_end=13313 # @@protoc_insertion_point(module_scope) diff --git a/src/xai_sdk/proto/v5/chat_pb2.pyi b/src/xai_sdk/proto/v5/chat_pb2.pyi index 4b9d4b3..080f713 100644 --- a/src/xai_sdk/proto/v5/chat_pb2.pyi +++ b/src/xai_sdk/proto/v5/chat_pb2.pyi @@ -73,6 +73,7 @@ class ToolCallType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL: _ClassVar[ToolCallType] TOOL_CALL_TYPE_MCP_TOOL: _ClassVar[ToolCallType] TOOL_CALL_TYPE_ATTACHMENT_SEARCH_TOOL: _ClassVar[ToolCallType] + TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL: _ClassVar[ToolCallType] class ToolCallStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = () @@ -128,6 +129,7 @@ TOOL_CALL_TYPE_CODE_EXECUTION_TOOL: ToolCallType TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL: ToolCallType TOOL_CALL_TYPE_MCP_TOOL: ToolCallType TOOL_CALL_TYPE_ATTACHMENT_SEARCH_TOOL: ToolCallType +TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL: ToolCallType TOOL_CALL_STATUS_IN_PROGRESS: ToolCallStatus TOOL_CALL_STATUS_COMPLETED: ToolCallStatus TOOL_CALL_STATUS_INCOMPLETE: ToolCallStatus @@ -436,7 +438,7 @@ class ToolChoice(_message.Message): def __init__(self, mode: _Optional[_Union[ToolMode, str]] = ..., function_name: _Optional[str] = ...) -> None: ... class Tool(_message.Message): - __slots__ = ("function", "web_search", "x_search", "code_execution", "collections_search", "mcp", "attachment_search") + __slots__ = ("function", "web_search", "x_search", "code_execution", "collections_search", "mcp", "attachment_search", "image_generation") FUNCTION_FIELD_NUMBER: _ClassVar[int] WEB_SEARCH_FIELD_NUMBER: _ClassVar[int] X_SEARCH_FIELD_NUMBER: _ClassVar[int] @@ -444,6 +446,7 @@ class Tool(_message.Message): COLLECTIONS_SEARCH_FIELD_NUMBER: _ClassVar[int] MCP_FIELD_NUMBER: _ClassVar[int] ATTACHMENT_SEARCH_FIELD_NUMBER: _ClassVar[int] + IMAGE_GENERATION_FIELD_NUMBER: _ClassVar[int] function: Function web_search: WebSearch x_search: XSearch @@ -451,7 +454,8 @@ class Tool(_message.Message): collections_search: CollectionsSearch mcp: MCP attachment_search: AttachmentSearch - def __init__(self, function: _Optional[_Union[Function, _Mapping]] = ..., web_search: _Optional[_Union[WebSearch, _Mapping]] = ..., x_search: _Optional[_Union[XSearch, _Mapping]] = ..., code_execution: _Optional[_Union[CodeExecution, _Mapping]] = ..., collections_search: _Optional[_Union[CollectionsSearch, _Mapping]] = ..., mcp: _Optional[_Union[MCP, _Mapping]] = ..., attachment_search: _Optional[_Union[AttachmentSearch, _Mapping]] = ...) -> None: ... + image_generation: ImageGeneration + def __init__(self, function: _Optional[_Union[Function, _Mapping]] = ..., web_search: _Optional[_Union[WebSearch, _Mapping]] = ..., x_search: _Optional[_Union[XSearch, _Mapping]] = ..., code_execution: _Optional[_Union[CodeExecution, _Mapping]] = ..., collections_search: _Optional[_Union[CollectionsSearch, _Mapping]] = ..., mcp: _Optional[_Union[MCP, _Mapping]] = ..., attachment_search: _Optional[_Union[AttachmentSearch, _Mapping]] = ..., image_generation: _Optional[_Union[ImageGeneration, _Mapping]] = ...) -> None: ... class MCP(_message.Message): __slots__ = ("server_label", "server_description", "server_url", "allowed_tool_names", "authorization", "extra_headers") @@ -522,6 +526,12 @@ class CodeExecution(_message.Message): __slots__ = () def __init__(self) -> None: ... +class ImageGeneration(_message.Message): + __slots__ = ("action",) + ACTION_FIELD_NUMBER: _ClassVar[int] + action: str + def __init__(self, action: _Optional[str] = ...) -> None: ... + class CollectionsSearch(_message.Message): __slots__ = ("collection_ids", "limit", "instructions", "hybrid_retrieval", "semantic_retrieval", "keyword_retrieval") COLLECTION_IDS_FIELD_NUMBER: _ClassVar[int] diff --git a/src/xai_sdk/proto/v5/usage_pb2.py b/src/xai_sdk/proto/v5/usage_pb2.py index 2582f87..8fa59ac 100644 --- a/src/xai_sdk/proto/v5/usage_pb2.py +++ b/src/xai_sdk/proto/v5/usage_pb2.py @@ -24,7 +24,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16xai/api/v1/usage.proto\x12\x07xai_api\"\x86\x04\n\rSamplingUsage\x12+\n\x11\x63ompletion_tokens\x18\x01 \x01(\x05R\x10\x63ompletionTokens\x12)\n\x10reasoning_tokens\x18\x06 \x01(\x05R\x0freasoningTokens\x12#\n\rprompt_tokens\x18\x02 \x01(\x05R\x0cpromptTokens\x12!\n\x0ctotal_tokens\x18\x03 \x01(\x05R\x0btotalTokens\x12,\n\x12prompt_text_tokens\x18\x04 \x01(\x05R\x10promptTextTokens\x12\x39\n\x19\x63\x61\x63hed_prompt_text_tokens\x18\x07 \x01(\x05R\x16\x63\x61\x63hedPromptTextTokens\x12.\n\x13prompt_image_tokens\x18\x05 \x01(\x05R\x11promptImageTokens\x12(\n\x10num_sources_used\x18\x08 \x01(\x05R\x0enumSourcesUsed\x12L\n\x16server_side_tools_used\x18\t \x03(\x0e\x32\x17.xai_api.ServerSideToolR\x13serverSideToolsUsed\x12.\n\x11\x63ost_in_usd_ticks\x18\x0b \x01(\x03H\x00R\x0e\x63ostInUsdTicks\x88\x01\x01\x42\x14\n\x12_cost_in_usd_ticks\"r\n\x0e\x45mbeddingUsage\x12.\n\x13num_text_embeddings\x18\x01 \x01(\x05R\x11numTextEmbeddings\x12\x30\n\x14num_image_embeddings\x18\x02 \x01(\x05R\x12numImageEmbeddings*`\n\x0bServiceTier\x12\x1c\n\x18SERVICE_TIER_UNSPECIFIED\x10\x00\x12\x18\n\x14SERVICE_TIER_DEFAULT\x10\x01\x12\x19\n\x15SERVICE_TIER_PRIORITY\x10\x02*\xe5\x02\n\x0eServerSideTool\x12\x1c\n\x18SERVER_SIDE_TOOL_INVALID\x10\x00\x12\x1f\n\x1bSERVER_SIDE_TOOL_WEB_SEARCH\x10\x01\x12\x1d\n\x19SERVER_SIDE_TOOL_X_SEARCH\x10\x02\x12#\n\x1fSERVER_SIDE_TOOL_CODE_EXECUTION\x10\x03\x12\x1f\n\x1bSERVER_SIDE_TOOL_VIEW_IMAGE\x10\x04\x12!\n\x1dSERVER_SIDE_TOOL_VIEW_X_VIDEO\x10\x05\x12\'\n#SERVER_SIDE_TOOL_COLLECTIONS_SEARCH\x10\x06\x12\x18\n\x14SERVER_SIDE_TOOL_MCP\x10\x07\x12&\n\"SERVER_SIDE_TOOL_ATTACHMENT_SEARCH\x10\x08\x12!\n\x1dSERVER_SIDE_TOOL_IMAGE_SEARCH\x10\nBQ\n\x0b\x63om.xai_apiB\nUsageProtoP\x01\xa2\x02\x03XXX\xaa\x02\x06XaiApi\xca\x02\x06XaiApi\xe2\x02\x12XaiApi\\GPBMetadata\xea\x02\x06XaiApib\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16xai/api/v1/usage.proto\x12\x07xai_api\"\x86\x04\n\rSamplingUsage\x12+\n\x11\x63ompletion_tokens\x18\x01 \x01(\x05R\x10\x63ompletionTokens\x12)\n\x10reasoning_tokens\x18\x06 \x01(\x05R\x0freasoningTokens\x12#\n\rprompt_tokens\x18\x02 \x01(\x05R\x0cpromptTokens\x12!\n\x0ctotal_tokens\x18\x03 \x01(\x05R\x0btotalTokens\x12,\n\x12prompt_text_tokens\x18\x04 \x01(\x05R\x10promptTextTokens\x12\x39\n\x19\x63\x61\x63hed_prompt_text_tokens\x18\x07 \x01(\x05R\x16\x63\x61\x63hedPromptTextTokens\x12.\n\x13prompt_image_tokens\x18\x05 \x01(\x05R\x11promptImageTokens\x12(\n\x10num_sources_used\x18\x08 \x01(\x05R\x0enumSourcesUsed\x12L\n\x16server_side_tools_used\x18\t \x03(\x0e\x32\x17.xai_api.ServerSideToolR\x13serverSideToolsUsed\x12.\n\x11\x63ost_in_usd_ticks\x18\x0b \x01(\x03H\x00R\x0e\x63ostInUsdTicks\x88\x01\x01\x42\x14\n\x12_cost_in_usd_ticks\"r\n\x0e\x45mbeddingUsage\x12.\n\x13num_text_embeddings\x18\x01 \x01(\x05R\x11numTextEmbeddings\x12\x30\n\x14num_image_embeddings\x18\x02 \x01(\x05R\x12numImageEmbeddings*`\n\x0bServiceTier\x12\x1c\n\x18SERVICE_TIER_UNSPECIFIED\x10\x00\x12\x18\n\x14SERVICE_TIER_DEFAULT\x10\x01\x12\x19\n\x15SERVICE_TIER_PRIORITY\x10\x02*\x8c\x03\n\x0eServerSideTool\x12\x1c\n\x18SERVER_SIDE_TOOL_INVALID\x10\x00\x12\x1f\n\x1bSERVER_SIDE_TOOL_WEB_SEARCH\x10\x01\x12\x1d\n\x19SERVER_SIDE_TOOL_X_SEARCH\x10\x02\x12#\n\x1fSERVER_SIDE_TOOL_CODE_EXECUTION\x10\x03\x12\x1f\n\x1bSERVER_SIDE_TOOL_VIEW_IMAGE\x10\x04\x12!\n\x1dSERVER_SIDE_TOOL_VIEW_X_VIDEO\x10\x05\x12\'\n#SERVER_SIDE_TOOL_COLLECTIONS_SEARCH\x10\x06\x12\x18\n\x14SERVER_SIDE_TOOL_MCP\x10\x07\x12&\n\"SERVER_SIDE_TOOL_ATTACHMENT_SEARCH\x10\x08\x12!\n\x1dSERVER_SIDE_TOOL_IMAGE_SEARCH\x10\n\x12%\n!SERVER_SIDE_TOOL_IMAGE_GENERATION\x10\x0b\x42Q\n\x0b\x63om.xai_apiB\nUsageProtoP\x01\xa2\x02\x03XXX\xaa\x02\x06XaiApi\xca\x02\x06XaiApi\xe2\x02\x12XaiApi\\GPBMetadata\xea\x02\x06XaiApib\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -35,7 +35,7 @@ _globals['_SERVICETIER']._serialized_start=672 _globals['_SERVICETIER']._serialized_end=768 _globals['_SERVERSIDETOOL']._serialized_start=771 - _globals['_SERVERSIDETOOL']._serialized_end=1128 + _globals['_SERVERSIDETOOL']._serialized_end=1167 _globals['_SAMPLINGUSAGE']._serialized_start=36 _globals['_SAMPLINGUSAGE']._serialized_end=554 _globals['_EMBEDDINGUSAGE']._serialized_start=556 diff --git a/src/xai_sdk/proto/v5/usage_pb2.pyi b/src/xai_sdk/proto/v5/usage_pb2.pyi index 015e7af..1a03129 100644 --- a/src/xai_sdk/proto/v5/usage_pb2.pyi +++ b/src/xai_sdk/proto/v5/usage_pb2.pyi @@ -24,6 +24,7 @@ class ServerSideTool(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): SERVER_SIDE_TOOL_MCP: _ClassVar[ServerSideTool] SERVER_SIDE_TOOL_ATTACHMENT_SEARCH: _ClassVar[ServerSideTool] SERVER_SIDE_TOOL_IMAGE_SEARCH: _ClassVar[ServerSideTool] + SERVER_SIDE_TOOL_IMAGE_GENERATION: _ClassVar[ServerSideTool] SERVICE_TIER_UNSPECIFIED: ServiceTier SERVICE_TIER_DEFAULT: ServiceTier SERVICE_TIER_PRIORITY: ServiceTier @@ -37,6 +38,7 @@ SERVER_SIDE_TOOL_COLLECTIONS_SEARCH: ServerSideTool SERVER_SIDE_TOOL_MCP: ServerSideTool SERVER_SIDE_TOOL_ATTACHMENT_SEARCH: ServerSideTool SERVER_SIDE_TOOL_IMAGE_SEARCH: ServerSideTool +SERVER_SIDE_TOOL_IMAGE_GENERATION: ServerSideTool class SamplingUsage(_message.Message): __slots__ = ("completion_tokens", "reasoning_tokens", "prompt_tokens", "total_tokens", "prompt_text_tokens", "cached_prompt_text_tokens", "prompt_image_tokens", "num_sources_used", "server_side_tools_used", "cost_in_usd_ticks") diff --git a/src/xai_sdk/proto/v6/chat_pb2.py b/src/xai_sdk/proto/v6/chat_pb2.py index cb7a463..3c75ce4 100644 --- a/src/xai_sdk/proto/v6/chat_pb2.py +++ b/src/xai_sdk/proto/v6/chat_pb2.py @@ -30,7 +30,7 @@ from . import usage_pb2 as xai_dot_api_dot_v1_dot_usage__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15xai/api/v1/chat.proto\x12\x07xai_api\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19xai/api/v1/deferred.proto\x1a\x1axai/api/v1/documents.proto\x1a\x16xai/api/v1/image.proto\x1a\x17xai/api/v1/sample.proto\x1a\x16xai/api/v1/usage.proto\"\xf1\n\n\x15GetCompletionsRequest\x12,\n\x08messages\x18\x01 \x03(\x0b\x32\x10.xai_api.MessageR\x08messages\x12\x14\n\x05model\x18\x02 \x01(\tR\x05model\x12\x12\n\x04user\x18\x10 \x01(\tR\x04user\x12\x11\n\x01n\x18\x08 \x01(\x05H\x00R\x01n\x88\x01\x01\x12\"\n\nmax_tokens\x18\x07 \x01(\x05H\x01R\tmaxTokens\x88\x01\x01\x12\x17\n\x04seed\x18\x0b \x01(\x05H\x02R\x04seed\x88\x01\x01\x12\x12\n\x04stop\x18\x0c \x03(\tR\x04stop\x12%\n\x0btemperature\x18\x0e \x01(\x02H\x03R\x0btemperature\x88\x01\x01\x12\x18\n\x05top_p\x18\x0f \x01(\x02H\x04R\x04topP\x88\x01\x01\x12\x1a\n\x08logprobs\x18\x05 \x01(\x08R\x08logprobs\x12&\n\x0ctop_logprobs\x18\x06 \x01(\x05H\x05R\x0btopLogprobs\x88\x01\x01\x12#\n\x05tools\x18\x11 \x03(\x0b\x32\r.xai_api.ToolR\x05tools\x12\x34\n\x0btool_choice\x18\x12 \x01(\x0b\x32\x13.xai_api.ToolChoiceR\ntoolChoice\x12@\n\x0fresponse_format\x18\n \x01(\x0b\x32\x17.xai_api.ResponseFormatR\x0eresponseFormat\x12\x30\n\x11\x66requency_penalty\x18\x03 \x01(\x02H\x06R\x10\x66requencyPenalty\x88\x01\x01\x12.\n\x10presence_penalty\x18\t \x01(\x02H\x07R\x0fpresencePenalty\x88\x01\x01\x12H\n\x10reasoning_effort\x18\x13 \x01(\x0e\x32\x18.xai_api.ReasoningEffortH\x08R\x0freasoningEffort\x88\x01\x01\x12K\n\x11search_parameters\x18\x14 \x01(\x0b\x32\x19.xai_api.SearchParametersH\tR\x10searchParameters\x88\x01\x01\x12\x33\n\x13parallel_tool_calls\x18\x15 \x01(\x08H\nR\x11parallelToolCalls\x88\x01\x01\x12\x35\n\x14previous_response_id\x18\x16 \x01(\tH\x0bR\x12previousResponseId\x88\x01\x01\x12%\n\x0estore_messages\x18\x17 \x01(\x08R\rstoreMessages\x12\x32\n\x15use_encrypted_content\x18\x18 \x01(\x08R\x13useEncryptedContent\x12 \n\tmax_turns\x18\x19 \x01(\x05H\x0cR\x08maxTurns\x88\x01\x01\x12\x30\n\x07include\x18\x1a \x03(\x0e\x32\x16.xai_api.IncludeOptionR\x07include\x12\x39\n\x0b\x61gent_count\x18\x1d \x01(\x0e\x32\x13.xai_api.AgentCountH\rR\nagentCount\x88\x01\x01\x12\x37\n\x0cservice_tier\x18\x1f \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTierB\x04\n\x02_nB\r\n\x0b_max_tokensB\x07\n\x05_seedB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x0f\n\r_top_logprobsB\x14\n\x12_frequency_penaltyB\x13\n\x11_presence_penaltyB\x13\n\x11_reasoning_effortB\x14\n\x12_search_parametersB\x16\n\x14_parallel_tool_callsB\x17\n\x15_previous_response_idB\x0c\n\n_max_turnsB\x0e\n\x0c_agent_countJ\x04\x08\x04\x10\x05\"\x87\x04\n\x19GetChatCompletionResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x33\n\x07outputs\x18\x02 \x03(\x0b\x32\x19.xai_api.CompletionOutputR\x07outputs\x12\x34\n\x07\x63reated\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x07\x63reated\x12\x14\n\x05model\x18\x06 \x01(\tR\x05model\x12-\n\x12system_fingerprint\x18\x07 \x01(\tR\x11systemFingerprint\x12,\n\x05usage\x18\t \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage\x12\x1c\n\tcitations\x18\n \x03(\tR\tcitations\x12\x34\n\x08settings\x18\x0b \x01(\x0b\x32\x18.xai_api.RequestSettingsR\x08settings\x12\x37\n\x0c\x64\x65\x62ug_output\x18\x0c \x01(\x0b\x32\x14.xai_api.DebugOutputR\x0b\x64\x65\x62ugOutput\x12\x36\n\x0coutput_files\x18\r \x03(\x0b\x32\x13.xai_api.OutputFileR\x0boutputFiles\x12\x37\n\x0cservice_tier\x18\x0f \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTier\"\xd3\x03\n\x16GetChatCompletionChunk\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x38\n\x07outputs\x18\x02 \x03(\x0b\x32\x1e.xai_api.CompletionOutputChunkR\x07outputs\x12\x34\n\x07\x63reated\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x07\x63reated\x12\x14\n\x05model\x18\x04 \x01(\tR\x05model\x12-\n\x12system_fingerprint\x18\x05 \x01(\tR\x11systemFingerprint\x12,\n\x05usage\x18\x06 \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage\x12\x1c\n\tcitations\x18\x07 \x03(\tR\tcitations\x12\x37\n\x0c\x64\x65\x62ug_output\x18\n \x01(\x0b\x32\x14.xai_api.DebugOutputR\x0b\x64\x65\x62ugOutput\x12\x36\n\x0coutput_files\x18\x0b \x03(\x0b\x32\x13.xai_api.OutputFileR\x0boutputFiles\x12\x37\n\x0cservice_tier\x18\x0c \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTier\"9\n\nOutputFile\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\"\xa2\x01\n\x1dGetDeferredCompletionResponse\x12/\n\x06status\x18\x02 \x01(\x0e\x32\x17.xai_api.DeferredStatusR\x06status\x12\x43\n\x08response\x18\x01 \x01(\x0b\x32\".xai_api.GetChatCompletionResponseH\x00R\x08response\x88\x01\x01\x42\x0b\n\t_response\"\xc9\x01\n\x10\x43ompletionOutput\x12:\n\rfinish_reason\x18\x01 \x01(\x0e\x32\x15.xai_api.FinishReasonR\x0c\x66inishReason\x12\x14\n\x05index\x18\x02 \x01(\x05R\x05index\x12\x34\n\x07message\x18\x03 \x01(\x0b\x32\x1a.xai_api.CompletionMessageR\x07message\x12-\n\x08logprobs\x18\x04 \x01(\x0b\x32\x11.xai_api.LogProbsR\x08logprobs\"\x9a\x02\n\x11\x43ompletionMessage\x12\x18\n\x07\x63ontent\x18\x01 \x01(\tR\x07\x63ontent\x12+\n\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x30\n\ntool_calls\x18\x03 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x05 \x01(\tR\x10\x65ncryptedContent\x12\x35\n\tcitations\x18\x06 \x03(\x0b\x32\x17.xai_api.InlineCitationR\tcitations\"\xbe\x01\n\x15\x43ompletionOutputChunk\x12$\n\x05\x64\x65lta\x18\x01 \x01(\x0b\x32\x0e.xai_api.DeltaR\x05\x64\x65lta\x12-\n\x08logprobs\x18\x02 \x01(\x0b\x32\x11.xai_api.LogProbsR\x08logprobs\x12:\n\rfinish_reason\x18\x03 \x01(\x0e\x32\x15.xai_api.FinishReasonR\x0c\x66inishReason\x12\x14\n\x05index\x18\x04 \x01(\x05R\x05index\"\x8e\x02\n\x05\x44\x65lta\x12\x18\n\x07\x63ontent\x18\x01 \x01(\tR\x07\x63ontent\x12+\n\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x30\n\ntool_calls\x18\x03 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x05 \x01(\tR\x10\x65ncryptedContent\x12\x35\n\tcitations\x18\x06 \x03(\x0b\x32\x17.xai_api.InlineCitationR\tcitations\"\xad\x02\n\x0eInlineCitation\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1f\n\x0bstart_index\x18\x02 \x01(\x05R\nstartIndex\x12\x1b\n\tend_index\x18\x06 \x01(\x05R\x08\x65ndIndex\x12\x39\n\x0cweb_citation\x18\x03 \x01(\x0b\x32\x14.xai_api.WebCitationH\x00R\x0bwebCitation\x12\x33\n\nx_citation\x18\x04 \x01(\x0b\x32\x12.xai_api.XCitationH\x00R\txCitation\x12Q\n\x14\x63ollections_citation\x18\x05 \x01(\x0b\x32\x1c.xai_api.CollectionsCitationH\x00R\x13\x63ollectionsCitationB\n\n\x08\x63itation\"\x1f\n\x0bWebCitation\x12\x10\n\x03url\x18\x01 \x01(\tR\x03url\"\x1d\n\tXCitation\x12\x10\n\x03url\x18\x01 \x01(\tR\x03url\"\xab\x01\n\x13\x43ollectionsCitation\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x19\n\x08\x63hunk_id\x18\x02 \x01(\tR\x07\x63hunkId\x12#\n\rchunk_content\x18\x03 \x01(\tR\x0c\x63hunkContent\x12\x14\n\x05score\x18\x04 \x01(\x02R\x05score\x12%\n\x0e\x63ollection_ids\x18\x05 \x03(\tR\rcollectionIds\"6\n\x08LogProbs\x12*\n\x07\x63ontent\x18\x01 \x03(\x0b\x32\x10.xai_api.LogProbR\x07\x63ontent\"\x87\x01\n\x07LogProb\x12\x14\n\x05token\x18\x01 \x01(\tR\x05token\x12\x18\n\x07logprob\x18\x02 \x01(\x02R\x07logprob\x12\x14\n\x05\x62ytes\x18\x03 \x01(\x0cR\x05\x62ytes\x12\x36\n\x0ctop_logprobs\x18\x04 \x03(\x0b\x32\x13.xai_api.TopLogProbR\x0btopLogprobs\"R\n\nTopLogProb\x12\x14\n\x05token\x18\x01 \x01(\tR\x05token\x12\x18\n\x07logprob\x18\x02 \x01(\x02R\x07logprob\x12\x14\n\x05\x62ytes\x18\x03 \x01(\x0cR\x05\x62ytes\"\x8f\x01\n\x07\x43ontent\x12\x14\n\x04text\x18\x01 \x01(\tH\x00R\x04text\x12\x37\n\timage_url\x18\x02 \x01(\x0b\x32\x18.xai_api.ImageUrlContentH\x00R\x08imageUrl\x12*\n\x04\x66ile\x18\x03 \x01(\x0b\x32\x14.xai_api.FileContentH\x00R\x04\x66ileB\t\n\x07\x63ontent\"\x85\x01\n\x0b\x46ileContent\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x12\n\x04\x64\x61ta\x18\x02 \x01(\x0cR\x04\x64\x61ta\x12\x1a\n\x08\x66ilename\x18\x03 \x01(\tR\x08\x66ilename\x12\x1b\n\tmime_type\x18\x04 \x01(\tR\x08mimeType\x12\x10\n\x03url\x18\x05 \x01(\tR\x03url\"\xd2\x02\n\x07Message\x12*\n\x07\x63ontent\x18\x01 \x03(\x0b\x32\x10.xai_api.ContentR\x07\x63ontent\x12\x30\n\x11reasoning_content\x18\x05 \x01(\tH\x00R\x10reasoningContent\x88\x01\x01\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x30\n\ntool_calls\x18\x04 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x06 \x01(\tR\x10\x65ncryptedContent\x12%\n\x0ctool_call_id\x18\x07 \x01(\tH\x01R\ntoolCallId\x88\x01\x01\x42\x14\n\x12_reasoning_contentB\x0f\n\r_tool_call_id\"k\n\nToolChoice\x12\'\n\x04mode\x18\x01 \x01(\x0e\x32\x11.xai_api.ToolModeH\x00R\x04mode\x12%\n\rfunction_name\x18\x02 \x01(\tH\x00R\x0c\x66unctionNameB\r\n\x0btool_choice\"\x9d\x03\n\x04Tool\x12/\n\x08\x66unction\x18\x01 \x01(\x0b\x32\x11.xai_api.FunctionH\x00R\x08\x66unction\x12\x33\n\nweb_search\x18\x03 \x01(\x0b\x32\x12.xai_api.WebSearchH\x00R\twebSearch\x12-\n\x08x_search\x18\x04 \x01(\x0b\x32\x10.xai_api.XSearchH\x00R\x07xSearch\x12?\n\x0e\x63ode_execution\x18\x05 \x01(\x0b\x32\x16.xai_api.CodeExecutionH\x00R\rcodeExecution\x12K\n\x12\x63ollections_search\x18\x06 \x01(\x0b\x32\x1a.xai_api.CollectionsSearchH\x00R\x11\x63ollectionsSearch\x12 \n\x03mcp\x18\x07 \x01(\x0b\x32\x0c.xai_api.MCPH\x00R\x03mcp\x12H\n\x11\x61ttachment_search\x18\x08 \x01(\x0b\x32\x19.xai_api.AttachmentSearchH\x00R\x10\x61ttachmentSearchB\x06\n\x04tool\"\xe7\x02\n\x03MCP\x12!\n\x0cserver_label\x18\x01 \x01(\tR\x0bserverLabel\x12-\n\x12server_description\x18\x02 \x01(\tR\x11serverDescription\x12\x1d\n\nserver_url\x18\x03 \x01(\tR\tserverUrl\x12,\n\x12\x61llowed_tool_names\x18\x04 \x03(\tR\x10\x61llowedToolNames\x12)\n\rauthorization\x18\x05 \x01(\tH\x00R\rauthorization\x88\x01\x01\x12\x43\n\rextra_headers\x18\x06 \x03(\x0b\x32\x1e.xai_api.MCP.ExtraHeadersEntryR\x0c\x65xtraHeaders\x1a?\n\x11\x45xtraHeadersEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x10\n\x0e_authorization\"\xea\x02\n\tWebSearch\x12)\n\x10\x65xcluded_domains\x18\x01 \x03(\tR\x0f\x65xcludedDomains\x12\'\n\x0f\x61llowed_domains\x18\x02 \x03(\tR\x0e\x61llowedDomains\x12\x41\n\x1a\x65nable_image_understanding\x18\x03 \x01(\x08H\x00R\x18\x65nableImageUnderstanding\x88\x01\x01\x12H\n\ruser_location\x18\x04 \x01(\x0b\x32\x1e.xai_api.WebSearchUserLocationH\x01R\x0cuserLocation\x88\x01\x01\x12\x33\n\x13\x65nable_image_search\x18\x05 \x01(\x08H\x02R\x11\x65nableImageSearch\x88\x01\x01\x42\x1d\n\x1b_enable_image_understandingB\x10\n\x0e_user_locationB\x16\n\x14_enable_image_search\"\xba\x01\n\x15WebSearchUserLocation\x12\x1d\n\x07\x63ountry\x18\x01 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x17\n\x04\x63ity\x18\x02 \x01(\tH\x01R\x04\x63ity\x88\x01\x01\x12\x1b\n\x06region\x18\x03 \x01(\tH\x02R\x06region\x88\x01\x01\x12\x1f\n\x08timezone\x18\x04 \x01(\tH\x03R\x08timezone\x88\x01\x01\x42\n\n\x08_countryB\x07\n\x05_cityB\t\n\x07_regionB\x0b\n\t_timezone\"\xb9\x03\n\x07XSearch\x12<\n\tfrom_date\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00R\x08\x66romDate\x88\x01\x01\x12\x38\n\x07to_date\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x01R\x06toDate\x88\x01\x01\x12*\n\x11\x61llowed_x_handles\x18\x03 \x03(\tR\x0f\x61llowedXHandles\x12,\n\x12\x65xcluded_x_handles\x18\x04 \x03(\tR\x10\x65xcludedXHandles\x12\x41\n\x1a\x65nable_image_understanding\x18\x05 \x01(\x08H\x02R\x18\x65nableImageUnderstanding\x88\x01\x01\x12\x41\n\x1a\x65nable_video_understanding\x18\x06 \x01(\x08H\x03R\x18\x65nableVideoUnderstanding\x88\x01\x01\x42\x0c\n\n_from_dateB\n\n\x08_to_dateB\x1d\n\x1b_enable_image_understandingB\x1d\n\x1b_enable_video_understanding\"\x0f\n\rCodeExecution\"\x89\x03\n\x11\x43ollectionsSearch\x12%\n\x0e\x63ollection_ids\x18\x01 \x03(\tR\rcollectionIds\x12\x19\n\x05limit\x18\x02 \x01(\x05H\x01R\x05limit\x88\x01\x01\x12\'\n\x0cinstructions\x18\x03 \x01(\tH\x02R\x0cinstructions\x88\x01\x01\x12\x45\n\x10hybrid_retrieval\x18\x04 \x01(\x0b\x32\x18.xai_api.HybridRetrievalH\x00R\x0fhybridRetrieval\x12K\n\x12semantic_retrieval\x18\x05 \x01(\x0b\x32\x1a.xai_api.SemanticRetrievalH\x00R\x11semanticRetrieval\x12H\n\x11keyword_retrieval\x18\x06 \x01(\x0b\x32\x19.xai_api.KeywordRetrievalH\x00R\x10keywordRetrievalB\x10\n\x0eretrieval_modeB\x08\n\x06_limitB\x0f\n\r_instructions\"7\n\x10\x41ttachmentSearch\x12\x19\n\x05limit\x18\x02 \x01(\x05H\x00R\x05limit\x88\x01\x01\x42\x08\n\x06_limit\"x\n\x08\x46unction\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12 \n\x0b\x64\x65scription\x18\x02 \x01(\tR\x0b\x64\x65scription\x12\x16\n\x06strict\x18\x03 \x01(\x08R\x06strict\x12\x1e\n\nparameters\x18\x04 \x01(\tR\nparameters\"\xef\x01\n\x08ToolCall\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.xai_api.ToolCallTypeR\x04type\x12/\n\x06status\x18\x03 \x01(\x0e\x32\x17.xai_api.ToolCallStatusR\x06status\x12(\n\rerror_message\x18\x04 \x01(\tH\x01R\x0c\x65rrorMessage\x88\x01\x01\x12\x33\n\x08\x66unction\x18\n \x01(\x0b\x32\x15.xai_api.FunctionCallH\x00R\x08\x66unctionB\x06\n\x04toolB\x10\n\x0e_error_message\"@\n\x0c\x46unctionCall\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1c\n\targuments\x18\x02 \x01(\tR\targuments\"n\n\x0eResponseFormat\x12\x34\n\x0b\x66ormat_type\x18\x01 \x01(\x0e\x32\x13.xai_api.FormatTypeR\nformatType\x12\x1b\n\x06schema\x18\x02 \x01(\tH\x00R\x06schema\x88\x01\x01\x42\t\n\x07_schema\"\xc9\x02\n\x10SearchParameters\x12\'\n\x04mode\x18\x01 \x01(\x0e\x32\x13.xai_api.SearchModeR\x04mode\x12)\n\x07sources\x18\t \x03(\x0b\x32\x0f.xai_api.SourceR\x07sources\x12\x37\n\tfrom_date\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x08\x66romDate\x12\x33\n\x07to_date\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x06toDate\x12)\n\x10return_citations\x18\x07 \x01(\x08R\x0freturnCitations\x12\x31\n\x12max_search_results\x18\x08 \x01(\x05H\x00R\x10maxSearchResults\x88\x01\x01\x42\x15\n\x13_max_search_results\"\xaf\x01\n\x06Source\x12&\n\x03web\x18\x01 \x01(\x0b\x32\x12.xai_api.WebSourceH\x00R\x03web\x12)\n\x04news\x18\x02 \x01(\x0b\x32\x13.xai_api.NewsSourceH\x00R\x04news\x12 \n\x01x\x18\x03 \x01(\x0b\x32\x10.xai_api.XSourceH\x00R\x01x\x12&\n\x03rss\x18\x04 \x01(\x0b\x32\x12.xai_api.RssSourceH\x00R\x03rssB\x08\n\x06source\"\xaf\x01\n\tWebSource\x12+\n\x11\x65xcluded_websites\x18\x02 \x03(\tR\x10\x65xcludedWebsites\x12)\n\x10\x61llowed_websites\x18\x05 \x03(\tR\x0f\x61llowedWebsites\x12\x1d\n\x07\x63ountry\x18\x03 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x1f\n\x0bsafe_search\x18\x04 \x01(\x08R\nsafeSearchB\n\n\x08_country\"\x85\x01\n\nNewsSource\x12+\n\x11\x65xcluded_websites\x18\x02 \x03(\tR\x10\x65xcludedWebsites\x12\x1d\n\x07\x63ountry\x18\x03 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x1f\n\x0bsafe_search\x18\x04 \x01(\x08R\nsafeSearchB\n\n\x08_country\"\xf9\x01\n\x07XSource\x12,\n\x12included_x_handles\x18\x07 \x03(\tR\x10includedXHandles\x12,\n\x12\x65xcluded_x_handles\x18\x08 \x03(\tR\x10\x65xcludedXHandles\x12\x33\n\x13post_favorite_count\x18\t \x01(\x05H\x00R\x11postFavoriteCount\x88\x01\x01\x12+\n\x0fpost_view_count\x18\n \x01(\x05H\x01R\rpostViewCount\x88\x01\x01\x42\x16\n\x14_post_favorite_countB\x12\n\x10_post_view_countJ\x04\x08\x06\x10\x07\"!\n\tRssSource\x12\x14\n\x05links\x18\x01 \x03(\tR\x05links\"\x9f\x06\n\x0fRequestSettings\x12\"\n\nmax_tokens\x18\x01 \x01(\x05H\x00R\tmaxTokens\x88\x01\x01\x12.\n\x13parallel_tool_calls\x18\x02 \x01(\x08R\x11parallelToolCalls\x12\x35\n\x14previous_response_id\x18\x03 \x01(\tH\x01R\x12previousResponseId\x88\x01\x01\x12H\n\x10reasoning_effort\x18\x04 \x01(\x0e\x32\x18.xai_api.ReasoningEffortH\x02R\x0freasoningEffort\x88\x01\x01\x12%\n\x0btemperature\x18\x05 \x01(\x02H\x03R\x0btemperature\x88\x01\x01\x12@\n\x0fresponse_format\x18\x06 \x01(\x0b\x32\x17.xai_api.ResponseFormatR\x0eresponseFormat\x12\x34\n\x0btool_choice\x18\x07 \x01(\x0b\x32\x13.xai_api.ToolChoiceR\ntoolChoice\x12#\n\x05tools\x18\x08 \x03(\x0b\x32\r.xai_api.ToolR\x05tools\x12\x18\n\x05top_p\x18\t \x01(\x02H\x04R\x04topP\x88\x01\x01\x12\x12\n\x04user\x18\n \x01(\tR\x04user\x12K\n\x11search_parameters\x18\x0b \x01(\x0b\x32\x19.xai_api.SearchParametersH\x05R\x10searchParameters\x88\x01\x01\x12%\n\x0estore_messages\x18\x0c \x01(\x08R\rstoreMessages\x12\x32\n\x15use_encrypted_content\x18\r \x01(\x08R\x13useEncryptedContent\x12\x30\n\x07include\x18\x0e \x03(\x0e\x32\x16.xai_api.IncludeOptionR\x07includeB\r\n\x0b_max_tokensB\x17\n\x15_previous_response_idB\x13\n\x11_reasoning_effortB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x14\n\x12_search_parameters\"=\n\x1aGetStoredCompletionRequest\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"@\n\x1d\x44\x65leteStoredCompletionRequest\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"A\n\x1e\x44\x65leteStoredCompletionResponse\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"\xba\x03\n\x0b\x44\x65\x62ugOutput\x12\x1a\n\x08\x61ttempts\x18\x01 \x01(\x05R\x08\x61ttempts\x12\x18\n\x07request\x18\x02 \x01(\tR\x07request\x12\x16\n\x06prompt\x18\x03 \x01(\tR\x06prompt\x12%\n\x0e\x65ngine_request\x18\t \x01(\tR\rengineRequest\x12\x1c\n\tresponses\x18\x04 \x03(\tR\tresponses\x12\x16\n\x06\x63hunks\x18\x0c \x03(\tR\x06\x63hunks\x12(\n\x10\x63\x61\x63he_read_count\x18\x05 \x01(\rR\x0e\x63\x61\x63heReadCount\x12\x33\n\x16\x63\x61\x63he_read_input_bytes\x18\x06 \x01(\x04R\x13\x63\x61\x63heReadInputBytes\x12*\n\x11\x63\x61\x63he_write_count\x18\x07 \x01(\rR\x0f\x63\x61\x63heWriteCount\x12\x35\n\x17\x63\x61\x63he_write_input_bytes\x18\x08 \x01(\x04R\x14\x63\x61\x63heWriteInputBytes\x12\x1d\n\nlb_address\x18\n \x01(\tR\tlbAddress\x12\x1f\n\x0bsampler_tag\x18\x0b \x01(\tR\nsamplerTag\"U\n\x15\x43ompactContextRequest\x12\x14\n\x05model\x18\x01 \x01(\tR\x05model\x12&\n\x05input\x18\x02 \x03(\x0b\x32\x10.xai_api.MessageR\x05input\"\xb7\x01\n\x16\x43ompactContextResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12+\n\x11\x65ncrypted_content\x18\x02 \x01(\tR\x10\x65ncryptedContent\x12\x32\n\x15\x64ropped_message_count\x18\x03 \x01(\rR\x13\x64roppedMessageCount\x12,\n\x05usage\x18\x04 \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage*\xb2\x03\n\rIncludeOption\x12\x1a\n\x16INCLUDE_OPTION_INVALID\x10\x00\x12)\n%INCLUDE_OPTION_WEB_SEARCH_CALL_OUTPUT\x10\x01\x12\'\n#INCLUDE_OPTION_X_SEARCH_CALL_OUTPUT\x10\x02\x12-\n)INCLUDE_OPTION_CODE_EXECUTION_CALL_OUTPUT\x10\x03\x12\x31\n-INCLUDE_OPTION_COLLECTIONS_SEARCH_CALL_OUTPUT\x10\x04\x12\x30\n,INCLUDE_OPTION_ATTACHMENT_SEARCH_CALL_OUTPUT\x10\x05\x12\"\n\x1eINCLUDE_OPTION_MCP_CALL_OUTPUT\x10\x06\x12#\n\x1fINCLUDE_OPTION_INLINE_CITATIONS\x10\x07\x12$\n INCLUDE_OPTION_VERBOSE_STREAMING\x10\x08\x12.\n*INCLUDE_OPTION_CODE_EXECUTION_FILES_OUTPUT\x10\t*\x8d\x01\n\x0bMessageRole\x12\x10\n\x0cINVALID_ROLE\x10\x00\x12\r\n\tROLE_USER\x10\x01\x12\x12\n\x0eROLE_ASSISTANT\x10\x02\x12\x0f\n\x0bROLE_SYSTEM\x10\x03\x12\x15\n\rROLE_FUNCTION\x10\x04\x1a\x02\x08\x01\x12\r\n\tROLE_TOOL\x10\x05\x12\x12\n\x0eROLE_DEVELOPER\x10\x06*j\n\x0fReasoningEffort\x12\x12\n\x0eINVALID_EFFORT\x10\x00\x12\x0e\n\nEFFORT_LOW\x10\x01\x12\x11\n\rEFFORT_MEDIUM\x10\x02\x12\x0f\n\x0b\x45\x46\x46ORT_HIGH\x10\x03\x12\x0f\n\x0b\x45\x46\x46ORT_NONE\x10\x04*P\n\nAgentCount\x12\x1b\n\x17\x41GENT_COUNT_UNSPECIFIED\x10\x00\x12\x11\n\rAGENT_COUNT_4\x10\x01\x12\x12\n\x0e\x41GENT_COUNT_16\x10\x02*a\n\x08ToolMode\x12\x15\n\x11TOOL_MODE_INVALID\x10\x00\x12\x12\n\x0eTOOL_MODE_AUTO\x10\x01\x12\x12\n\x0eTOOL_MODE_NONE\x10\x02\x12\x16\n\x12TOOL_MODE_REQUIRED\x10\x03*u\n\nFormatType\x12\x17\n\x13\x46ORMAT_TYPE_INVALID\x10\x00\x12\x14\n\x10\x46ORMAT_TYPE_TEXT\x10\x01\x12\x1b\n\x17\x46ORMAT_TYPE_JSON_OBJECT\x10\x02\x12\x1b\n\x17\x46ORMAT_TYPE_JSON_SCHEMA\x10\x03*\xb1\x02\n\x0cToolCallType\x12\x1a\n\x16TOOL_CALL_TYPE_INVALID\x10\x00\x12#\n\x1fTOOL_CALL_TYPE_CLIENT_SIDE_TOOL\x10\x01\x12\"\n\x1eTOOL_CALL_TYPE_WEB_SEARCH_TOOL\x10\x02\x12 \n\x1cTOOL_CALL_TYPE_X_SEARCH_TOOL\x10\x03\x12&\n\"TOOL_CALL_TYPE_CODE_EXECUTION_TOOL\x10\x04\x12*\n&TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL\x10\x05\x12\x1b\n\x17TOOL_CALL_TYPE_MCP_TOOL\x10\x06\x12)\n%TOOL_CALL_TYPE_ATTACHMENT_SEARCH_TOOL\x10\x07*\x90\x01\n\x0eToolCallStatus\x12 \n\x1cTOOL_CALL_STATUS_IN_PROGRESS\x10\x00\x12\x1e\n\x1aTOOL_CALL_STATUS_COMPLETED\x10\x01\x12\x1f\n\x1bTOOL_CALL_STATUS_INCOMPLETE\x10\x02\x12\x1b\n\x17TOOL_CALL_STATUS_FAILED\x10\x03*d\n\nSearchMode\x12\x17\n\x13INVALID_SEARCH_MODE\x10\x00\x12\x13\n\x0fOFF_SEARCH_MODE\x10\x01\x12\x12\n\x0eON_SEARCH_MODE\x10\x02\x12\x14\n\x10\x41UTO_SEARCH_MODE\x10\x03\x32\x99\x05\n\x04\x43hat\x12U\n\rGetCompletion\x12\x1e.xai_api.GetCompletionsRequest\x1a\".xai_api.GetChatCompletionResponse\"\x00\x12Y\n\x12GetCompletionChunk\x12\x1e.xai_api.GetCompletionsRequest\x1a\x1f.xai_api.GetChatCompletionChunk\"\x00\x30\x01\x12[\n\x17StartDeferredCompletion\x12\x1e.xai_api.GetCompletionsRequest\x1a\x1e.xai_api.StartDeferredResponse\"\x00\x12^\n\x15GetDeferredCompletion\x12\x1b.xai_api.GetDeferredRequest\x1a&.xai_api.GetDeferredCompletionResponse\"\x00\x12`\n\x13GetStoredCompletion\x12#.xai_api.GetStoredCompletionRequest\x1a\".xai_api.GetChatCompletionResponse\"\x00\x12k\n\x16\x44\x65leteStoredCompletion\x12&.xai_api.DeleteStoredCompletionRequest\x1a\'.xai_api.DeleteStoredCompletionResponse\"\x00\x12S\n\x0e\x43ompactContext\x12\x1e.xai_api.CompactContextRequest\x1a\x1f.xai_api.CompactContextResponse\"\x00\x42P\n\x0b\x63om.xai_apiB\tChatProtoP\x01\xa2\x02\x03XXX\xaa\x02\x06XaiApi\xca\x02\x06XaiApi\xe2\x02\x12XaiApi\\GPBMetadata\xea\x02\x06XaiApib\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15xai/api/v1/chat.proto\x12\x07xai_api\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19xai/api/v1/deferred.proto\x1a\x1axai/api/v1/documents.proto\x1a\x16xai/api/v1/image.proto\x1a\x17xai/api/v1/sample.proto\x1a\x16xai/api/v1/usage.proto\"\xf1\n\n\x15GetCompletionsRequest\x12,\n\x08messages\x18\x01 \x03(\x0b\x32\x10.xai_api.MessageR\x08messages\x12\x14\n\x05model\x18\x02 \x01(\tR\x05model\x12\x12\n\x04user\x18\x10 \x01(\tR\x04user\x12\x11\n\x01n\x18\x08 \x01(\x05H\x00R\x01n\x88\x01\x01\x12\"\n\nmax_tokens\x18\x07 \x01(\x05H\x01R\tmaxTokens\x88\x01\x01\x12\x17\n\x04seed\x18\x0b \x01(\x05H\x02R\x04seed\x88\x01\x01\x12\x12\n\x04stop\x18\x0c \x03(\tR\x04stop\x12%\n\x0btemperature\x18\x0e \x01(\x02H\x03R\x0btemperature\x88\x01\x01\x12\x18\n\x05top_p\x18\x0f \x01(\x02H\x04R\x04topP\x88\x01\x01\x12\x1a\n\x08logprobs\x18\x05 \x01(\x08R\x08logprobs\x12&\n\x0ctop_logprobs\x18\x06 \x01(\x05H\x05R\x0btopLogprobs\x88\x01\x01\x12#\n\x05tools\x18\x11 \x03(\x0b\x32\r.xai_api.ToolR\x05tools\x12\x34\n\x0btool_choice\x18\x12 \x01(\x0b\x32\x13.xai_api.ToolChoiceR\ntoolChoice\x12@\n\x0fresponse_format\x18\n \x01(\x0b\x32\x17.xai_api.ResponseFormatR\x0eresponseFormat\x12\x30\n\x11\x66requency_penalty\x18\x03 \x01(\x02H\x06R\x10\x66requencyPenalty\x88\x01\x01\x12.\n\x10presence_penalty\x18\t \x01(\x02H\x07R\x0fpresencePenalty\x88\x01\x01\x12H\n\x10reasoning_effort\x18\x13 \x01(\x0e\x32\x18.xai_api.ReasoningEffortH\x08R\x0freasoningEffort\x88\x01\x01\x12K\n\x11search_parameters\x18\x14 \x01(\x0b\x32\x19.xai_api.SearchParametersH\tR\x10searchParameters\x88\x01\x01\x12\x33\n\x13parallel_tool_calls\x18\x15 \x01(\x08H\nR\x11parallelToolCalls\x88\x01\x01\x12\x35\n\x14previous_response_id\x18\x16 \x01(\tH\x0bR\x12previousResponseId\x88\x01\x01\x12%\n\x0estore_messages\x18\x17 \x01(\x08R\rstoreMessages\x12\x32\n\x15use_encrypted_content\x18\x18 \x01(\x08R\x13useEncryptedContent\x12 \n\tmax_turns\x18\x19 \x01(\x05H\x0cR\x08maxTurns\x88\x01\x01\x12\x30\n\x07include\x18\x1a \x03(\x0e\x32\x16.xai_api.IncludeOptionR\x07include\x12\x39\n\x0b\x61gent_count\x18\x1d \x01(\x0e\x32\x13.xai_api.AgentCountH\rR\nagentCount\x88\x01\x01\x12\x37\n\x0cservice_tier\x18\x1f \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTierB\x04\n\x02_nB\r\n\x0b_max_tokensB\x07\n\x05_seedB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x0f\n\r_top_logprobsB\x14\n\x12_frequency_penaltyB\x13\n\x11_presence_penaltyB\x13\n\x11_reasoning_effortB\x14\n\x12_search_parametersB\x16\n\x14_parallel_tool_callsB\x17\n\x15_previous_response_idB\x0c\n\n_max_turnsB\x0e\n\x0c_agent_countJ\x04\x08\x04\x10\x05\"\x87\x04\n\x19GetChatCompletionResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x33\n\x07outputs\x18\x02 \x03(\x0b\x32\x19.xai_api.CompletionOutputR\x07outputs\x12\x34\n\x07\x63reated\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x07\x63reated\x12\x14\n\x05model\x18\x06 \x01(\tR\x05model\x12-\n\x12system_fingerprint\x18\x07 \x01(\tR\x11systemFingerprint\x12,\n\x05usage\x18\t \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage\x12\x1c\n\tcitations\x18\n \x03(\tR\tcitations\x12\x34\n\x08settings\x18\x0b \x01(\x0b\x32\x18.xai_api.RequestSettingsR\x08settings\x12\x37\n\x0c\x64\x65\x62ug_output\x18\x0c \x01(\x0b\x32\x14.xai_api.DebugOutputR\x0b\x64\x65\x62ugOutput\x12\x36\n\x0coutput_files\x18\r \x03(\x0b\x32\x13.xai_api.OutputFileR\x0boutputFiles\x12\x37\n\x0cservice_tier\x18\x0f \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTier\"\xd3\x03\n\x16GetChatCompletionChunk\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x38\n\x07outputs\x18\x02 \x03(\x0b\x32\x1e.xai_api.CompletionOutputChunkR\x07outputs\x12\x34\n\x07\x63reated\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x07\x63reated\x12\x14\n\x05model\x18\x04 \x01(\tR\x05model\x12-\n\x12system_fingerprint\x18\x05 \x01(\tR\x11systemFingerprint\x12,\n\x05usage\x18\x06 \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage\x12\x1c\n\tcitations\x18\x07 \x03(\tR\tcitations\x12\x37\n\x0c\x64\x65\x62ug_output\x18\n \x01(\x0b\x32\x14.xai_api.DebugOutputR\x0b\x64\x65\x62ugOutput\x12\x36\n\x0coutput_files\x18\x0b \x03(\x0b\x32\x13.xai_api.OutputFileR\x0boutputFiles\x12\x37\n\x0cservice_tier\x18\x0c \x01(\x0e\x32\x14.xai_api.ServiceTierR\x0bserviceTier\"9\n\nOutputFile\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\"\xa2\x01\n\x1dGetDeferredCompletionResponse\x12/\n\x06status\x18\x02 \x01(\x0e\x32\x17.xai_api.DeferredStatusR\x06status\x12\x43\n\x08response\x18\x01 \x01(\x0b\x32\".xai_api.GetChatCompletionResponseH\x00R\x08response\x88\x01\x01\x42\x0b\n\t_response\"\xc9\x01\n\x10\x43ompletionOutput\x12:\n\rfinish_reason\x18\x01 \x01(\x0e\x32\x15.xai_api.FinishReasonR\x0c\x66inishReason\x12\x14\n\x05index\x18\x02 \x01(\x05R\x05index\x12\x34\n\x07message\x18\x03 \x01(\x0b\x32\x1a.xai_api.CompletionMessageR\x07message\x12-\n\x08logprobs\x18\x04 \x01(\x0b\x32\x11.xai_api.LogProbsR\x08logprobs\"\x9a\x02\n\x11\x43ompletionMessage\x12\x18\n\x07\x63ontent\x18\x01 \x01(\tR\x07\x63ontent\x12+\n\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x30\n\ntool_calls\x18\x03 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x05 \x01(\tR\x10\x65ncryptedContent\x12\x35\n\tcitations\x18\x06 \x03(\x0b\x32\x17.xai_api.InlineCitationR\tcitations\"\xbe\x01\n\x15\x43ompletionOutputChunk\x12$\n\x05\x64\x65lta\x18\x01 \x01(\x0b\x32\x0e.xai_api.DeltaR\x05\x64\x65lta\x12-\n\x08logprobs\x18\x02 \x01(\x0b\x32\x11.xai_api.LogProbsR\x08logprobs\x12:\n\rfinish_reason\x18\x03 \x01(\x0e\x32\x15.xai_api.FinishReasonR\x0c\x66inishReason\x12\x14\n\x05index\x18\x04 \x01(\x05R\x05index\"\x8e\x02\n\x05\x44\x65lta\x12\x18\n\x07\x63ontent\x18\x01 \x01(\tR\x07\x63ontent\x12+\n\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x30\n\ntool_calls\x18\x03 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x05 \x01(\tR\x10\x65ncryptedContent\x12\x35\n\tcitations\x18\x06 \x03(\x0b\x32\x17.xai_api.InlineCitationR\tcitations\"\xad\x02\n\x0eInlineCitation\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x1f\n\x0bstart_index\x18\x02 \x01(\x05R\nstartIndex\x12\x1b\n\tend_index\x18\x06 \x01(\x05R\x08\x65ndIndex\x12\x39\n\x0cweb_citation\x18\x03 \x01(\x0b\x32\x14.xai_api.WebCitationH\x00R\x0bwebCitation\x12\x33\n\nx_citation\x18\x04 \x01(\x0b\x32\x12.xai_api.XCitationH\x00R\txCitation\x12Q\n\x14\x63ollections_citation\x18\x05 \x01(\x0b\x32\x1c.xai_api.CollectionsCitationH\x00R\x13\x63ollectionsCitationB\n\n\x08\x63itation\"\x1f\n\x0bWebCitation\x12\x10\n\x03url\x18\x01 \x01(\tR\x03url\"\x1d\n\tXCitation\x12\x10\n\x03url\x18\x01 \x01(\tR\x03url\"\xab\x01\n\x13\x43ollectionsCitation\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x19\n\x08\x63hunk_id\x18\x02 \x01(\tR\x07\x63hunkId\x12#\n\rchunk_content\x18\x03 \x01(\tR\x0c\x63hunkContent\x12\x14\n\x05score\x18\x04 \x01(\x02R\x05score\x12%\n\x0e\x63ollection_ids\x18\x05 \x03(\tR\rcollectionIds\"6\n\x08LogProbs\x12*\n\x07\x63ontent\x18\x01 \x03(\x0b\x32\x10.xai_api.LogProbR\x07\x63ontent\"\x87\x01\n\x07LogProb\x12\x14\n\x05token\x18\x01 \x01(\tR\x05token\x12\x18\n\x07logprob\x18\x02 \x01(\x02R\x07logprob\x12\x14\n\x05\x62ytes\x18\x03 \x01(\x0cR\x05\x62ytes\x12\x36\n\x0ctop_logprobs\x18\x04 \x03(\x0b\x32\x13.xai_api.TopLogProbR\x0btopLogprobs\"R\n\nTopLogProb\x12\x14\n\x05token\x18\x01 \x01(\tR\x05token\x12\x18\n\x07logprob\x18\x02 \x01(\x02R\x07logprob\x12\x14\n\x05\x62ytes\x18\x03 \x01(\x0cR\x05\x62ytes\"\x8f\x01\n\x07\x43ontent\x12\x14\n\x04text\x18\x01 \x01(\tH\x00R\x04text\x12\x37\n\timage_url\x18\x02 \x01(\x0b\x32\x18.xai_api.ImageUrlContentH\x00R\x08imageUrl\x12*\n\x04\x66ile\x18\x03 \x01(\x0b\x32\x14.xai_api.FileContentH\x00R\x04\x66ileB\t\n\x07\x63ontent\"\x85\x01\n\x0b\x46ileContent\x12\x17\n\x07\x66ile_id\x18\x01 \x01(\tR\x06\x66ileId\x12\x12\n\x04\x64\x61ta\x18\x02 \x01(\x0cR\x04\x64\x61ta\x12\x1a\n\x08\x66ilename\x18\x03 \x01(\tR\x08\x66ilename\x12\x1b\n\tmime_type\x18\x04 \x01(\tR\x08mimeType\x12\x10\n\x03url\x18\x05 \x01(\tR\x03url\"\xd2\x02\n\x07Message\x12*\n\x07\x63ontent\x18\x01 \x03(\x0b\x32\x10.xai_api.ContentR\x07\x63ontent\x12\x30\n\x11reasoning_content\x18\x05 \x01(\tH\x00R\x10reasoningContent\x88\x01\x01\x12(\n\x04role\x18\x02 \x01(\x0e\x32\x14.xai_api.MessageRoleR\x04role\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x30\n\ntool_calls\x18\x04 \x03(\x0b\x32\x11.xai_api.ToolCallR\ttoolCalls\x12+\n\x11\x65ncrypted_content\x18\x06 \x01(\tR\x10\x65ncryptedContent\x12%\n\x0ctool_call_id\x18\x07 \x01(\tH\x01R\ntoolCallId\x88\x01\x01\x42\x14\n\x12_reasoning_contentB\x0f\n\r_tool_call_id\"k\n\nToolChoice\x12\'\n\x04mode\x18\x01 \x01(\x0e\x32\x11.xai_api.ToolModeH\x00R\x04mode\x12%\n\rfunction_name\x18\x02 \x01(\tH\x00R\x0c\x66unctionNameB\r\n\x0btool_choice\"\xe4\x03\n\x04Tool\x12/\n\x08\x66unction\x18\x01 \x01(\x0b\x32\x11.xai_api.FunctionH\x00R\x08\x66unction\x12\x33\n\nweb_search\x18\x03 \x01(\x0b\x32\x12.xai_api.WebSearchH\x00R\twebSearch\x12-\n\x08x_search\x18\x04 \x01(\x0b\x32\x10.xai_api.XSearchH\x00R\x07xSearch\x12?\n\x0e\x63ode_execution\x18\x05 \x01(\x0b\x32\x16.xai_api.CodeExecutionH\x00R\rcodeExecution\x12K\n\x12\x63ollections_search\x18\x06 \x01(\x0b\x32\x1a.xai_api.CollectionsSearchH\x00R\x11\x63ollectionsSearch\x12 \n\x03mcp\x18\x07 \x01(\x0b\x32\x0c.xai_api.MCPH\x00R\x03mcp\x12H\n\x11\x61ttachment_search\x18\x08 \x01(\x0b\x32\x19.xai_api.AttachmentSearchH\x00R\x10\x61ttachmentSearch\x12\x45\n\x10image_generation\x18\n \x01(\x0b\x32\x18.xai_api.ImageGenerationH\x00R\x0fimageGenerationB\x06\n\x04tool\"\xe7\x02\n\x03MCP\x12!\n\x0cserver_label\x18\x01 \x01(\tR\x0bserverLabel\x12-\n\x12server_description\x18\x02 \x01(\tR\x11serverDescription\x12\x1d\n\nserver_url\x18\x03 \x01(\tR\tserverUrl\x12,\n\x12\x61llowed_tool_names\x18\x04 \x03(\tR\x10\x61llowedToolNames\x12)\n\rauthorization\x18\x05 \x01(\tH\x00R\rauthorization\x88\x01\x01\x12\x43\n\rextra_headers\x18\x06 \x03(\x0b\x32\x1e.xai_api.MCP.ExtraHeadersEntryR\x0c\x65xtraHeaders\x1a?\n\x11\x45xtraHeadersEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x10\n\x0e_authorization\"\xea\x02\n\tWebSearch\x12)\n\x10\x65xcluded_domains\x18\x01 \x03(\tR\x0f\x65xcludedDomains\x12\'\n\x0f\x61llowed_domains\x18\x02 \x03(\tR\x0e\x61llowedDomains\x12\x41\n\x1a\x65nable_image_understanding\x18\x03 \x01(\x08H\x00R\x18\x65nableImageUnderstanding\x88\x01\x01\x12H\n\ruser_location\x18\x04 \x01(\x0b\x32\x1e.xai_api.WebSearchUserLocationH\x01R\x0cuserLocation\x88\x01\x01\x12\x33\n\x13\x65nable_image_search\x18\x05 \x01(\x08H\x02R\x11\x65nableImageSearch\x88\x01\x01\x42\x1d\n\x1b_enable_image_understandingB\x10\n\x0e_user_locationB\x16\n\x14_enable_image_search\"\xba\x01\n\x15WebSearchUserLocation\x12\x1d\n\x07\x63ountry\x18\x01 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x17\n\x04\x63ity\x18\x02 \x01(\tH\x01R\x04\x63ity\x88\x01\x01\x12\x1b\n\x06region\x18\x03 \x01(\tH\x02R\x06region\x88\x01\x01\x12\x1f\n\x08timezone\x18\x04 \x01(\tH\x03R\x08timezone\x88\x01\x01\x42\n\n\x08_countryB\x07\n\x05_cityB\t\n\x07_regionB\x0b\n\t_timezone\"\xb9\x03\n\x07XSearch\x12<\n\tfrom_date\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00R\x08\x66romDate\x88\x01\x01\x12\x38\n\x07to_date\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x01R\x06toDate\x88\x01\x01\x12*\n\x11\x61llowed_x_handles\x18\x03 \x03(\tR\x0f\x61llowedXHandles\x12,\n\x12\x65xcluded_x_handles\x18\x04 \x03(\tR\x10\x65xcludedXHandles\x12\x41\n\x1a\x65nable_image_understanding\x18\x05 \x01(\x08H\x02R\x18\x65nableImageUnderstanding\x88\x01\x01\x12\x41\n\x1a\x65nable_video_understanding\x18\x06 \x01(\x08H\x03R\x18\x65nableVideoUnderstanding\x88\x01\x01\x42\x0c\n\n_from_dateB\n\n\x08_to_dateB\x1d\n\x1b_enable_image_understandingB\x1d\n\x1b_enable_video_understanding\"\x0f\n\rCodeExecution\"9\n\x0fImageGeneration\x12\x1b\n\x06\x61\x63tion\x18\x01 \x01(\tH\x00R\x06\x61\x63tion\x88\x01\x01\x42\t\n\x07_action\"\x89\x03\n\x11\x43ollectionsSearch\x12%\n\x0e\x63ollection_ids\x18\x01 \x03(\tR\rcollectionIds\x12\x19\n\x05limit\x18\x02 \x01(\x05H\x01R\x05limit\x88\x01\x01\x12\'\n\x0cinstructions\x18\x03 \x01(\tH\x02R\x0cinstructions\x88\x01\x01\x12\x45\n\x10hybrid_retrieval\x18\x04 \x01(\x0b\x32\x18.xai_api.HybridRetrievalH\x00R\x0fhybridRetrieval\x12K\n\x12semantic_retrieval\x18\x05 \x01(\x0b\x32\x1a.xai_api.SemanticRetrievalH\x00R\x11semanticRetrieval\x12H\n\x11keyword_retrieval\x18\x06 \x01(\x0b\x32\x19.xai_api.KeywordRetrievalH\x00R\x10keywordRetrievalB\x10\n\x0eretrieval_modeB\x08\n\x06_limitB\x0f\n\r_instructions\"7\n\x10\x41ttachmentSearch\x12\x19\n\x05limit\x18\x02 \x01(\x05H\x00R\x05limit\x88\x01\x01\x42\x08\n\x06_limit\"x\n\x08\x46unction\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12 \n\x0b\x64\x65scription\x18\x02 \x01(\tR\x0b\x64\x65scription\x12\x16\n\x06strict\x18\x03 \x01(\x08R\x06strict\x12\x1e\n\nparameters\x18\x04 \x01(\tR\nparameters\"\xef\x01\n\x08ToolCall\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.xai_api.ToolCallTypeR\x04type\x12/\n\x06status\x18\x03 \x01(\x0e\x32\x17.xai_api.ToolCallStatusR\x06status\x12(\n\rerror_message\x18\x04 \x01(\tH\x01R\x0c\x65rrorMessage\x88\x01\x01\x12\x33\n\x08\x66unction\x18\n \x01(\x0b\x32\x15.xai_api.FunctionCallH\x00R\x08\x66unctionB\x06\n\x04toolB\x10\n\x0e_error_message\"@\n\x0c\x46unctionCall\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x1c\n\targuments\x18\x02 \x01(\tR\targuments\"n\n\x0eResponseFormat\x12\x34\n\x0b\x66ormat_type\x18\x01 \x01(\x0e\x32\x13.xai_api.FormatTypeR\nformatType\x12\x1b\n\x06schema\x18\x02 \x01(\tH\x00R\x06schema\x88\x01\x01\x42\t\n\x07_schema\"\xc9\x02\n\x10SearchParameters\x12\'\n\x04mode\x18\x01 \x01(\x0e\x32\x13.xai_api.SearchModeR\x04mode\x12)\n\x07sources\x18\t \x03(\x0b\x32\x0f.xai_api.SourceR\x07sources\x12\x37\n\tfrom_date\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x08\x66romDate\x12\x33\n\x07to_date\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x06toDate\x12)\n\x10return_citations\x18\x07 \x01(\x08R\x0freturnCitations\x12\x31\n\x12max_search_results\x18\x08 \x01(\x05H\x00R\x10maxSearchResults\x88\x01\x01\x42\x15\n\x13_max_search_results\"\xaf\x01\n\x06Source\x12&\n\x03web\x18\x01 \x01(\x0b\x32\x12.xai_api.WebSourceH\x00R\x03web\x12)\n\x04news\x18\x02 \x01(\x0b\x32\x13.xai_api.NewsSourceH\x00R\x04news\x12 \n\x01x\x18\x03 \x01(\x0b\x32\x10.xai_api.XSourceH\x00R\x01x\x12&\n\x03rss\x18\x04 \x01(\x0b\x32\x12.xai_api.RssSourceH\x00R\x03rssB\x08\n\x06source\"\xaf\x01\n\tWebSource\x12+\n\x11\x65xcluded_websites\x18\x02 \x03(\tR\x10\x65xcludedWebsites\x12)\n\x10\x61llowed_websites\x18\x05 \x03(\tR\x0f\x61llowedWebsites\x12\x1d\n\x07\x63ountry\x18\x03 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x1f\n\x0bsafe_search\x18\x04 \x01(\x08R\nsafeSearchB\n\n\x08_country\"\x85\x01\n\nNewsSource\x12+\n\x11\x65xcluded_websites\x18\x02 \x03(\tR\x10\x65xcludedWebsites\x12\x1d\n\x07\x63ountry\x18\x03 \x01(\tH\x00R\x07\x63ountry\x88\x01\x01\x12\x1f\n\x0bsafe_search\x18\x04 \x01(\x08R\nsafeSearchB\n\n\x08_country\"\xf9\x01\n\x07XSource\x12,\n\x12included_x_handles\x18\x07 \x03(\tR\x10includedXHandles\x12,\n\x12\x65xcluded_x_handles\x18\x08 \x03(\tR\x10\x65xcludedXHandles\x12\x33\n\x13post_favorite_count\x18\t \x01(\x05H\x00R\x11postFavoriteCount\x88\x01\x01\x12+\n\x0fpost_view_count\x18\n \x01(\x05H\x01R\rpostViewCount\x88\x01\x01\x42\x16\n\x14_post_favorite_countB\x12\n\x10_post_view_countJ\x04\x08\x06\x10\x07\"!\n\tRssSource\x12\x14\n\x05links\x18\x01 \x03(\tR\x05links\"\x9f\x06\n\x0fRequestSettings\x12\"\n\nmax_tokens\x18\x01 \x01(\x05H\x00R\tmaxTokens\x88\x01\x01\x12.\n\x13parallel_tool_calls\x18\x02 \x01(\x08R\x11parallelToolCalls\x12\x35\n\x14previous_response_id\x18\x03 \x01(\tH\x01R\x12previousResponseId\x88\x01\x01\x12H\n\x10reasoning_effort\x18\x04 \x01(\x0e\x32\x18.xai_api.ReasoningEffortH\x02R\x0freasoningEffort\x88\x01\x01\x12%\n\x0btemperature\x18\x05 \x01(\x02H\x03R\x0btemperature\x88\x01\x01\x12@\n\x0fresponse_format\x18\x06 \x01(\x0b\x32\x17.xai_api.ResponseFormatR\x0eresponseFormat\x12\x34\n\x0btool_choice\x18\x07 \x01(\x0b\x32\x13.xai_api.ToolChoiceR\ntoolChoice\x12#\n\x05tools\x18\x08 \x03(\x0b\x32\r.xai_api.ToolR\x05tools\x12\x18\n\x05top_p\x18\t \x01(\x02H\x04R\x04topP\x88\x01\x01\x12\x12\n\x04user\x18\n \x01(\tR\x04user\x12K\n\x11search_parameters\x18\x0b \x01(\x0b\x32\x19.xai_api.SearchParametersH\x05R\x10searchParameters\x88\x01\x01\x12%\n\x0estore_messages\x18\x0c \x01(\x08R\rstoreMessages\x12\x32\n\x15use_encrypted_content\x18\r \x01(\x08R\x13useEncryptedContent\x12\x30\n\x07include\x18\x0e \x03(\x0e\x32\x16.xai_api.IncludeOptionR\x07includeB\r\n\x0b_max_tokensB\x17\n\x15_previous_response_idB\x13\n\x11_reasoning_effortB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x14\n\x12_search_parameters\"=\n\x1aGetStoredCompletionRequest\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"@\n\x1d\x44\x65leteStoredCompletionRequest\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"A\n\x1e\x44\x65leteStoredCompletionResponse\x12\x1f\n\x0bresponse_id\x18\x01 \x01(\tR\nresponseId\"\xba\x03\n\x0b\x44\x65\x62ugOutput\x12\x1a\n\x08\x61ttempts\x18\x01 \x01(\x05R\x08\x61ttempts\x12\x18\n\x07request\x18\x02 \x01(\tR\x07request\x12\x16\n\x06prompt\x18\x03 \x01(\tR\x06prompt\x12%\n\x0e\x65ngine_request\x18\t \x01(\tR\rengineRequest\x12\x1c\n\tresponses\x18\x04 \x03(\tR\tresponses\x12\x16\n\x06\x63hunks\x18\x0c \x03(\tR\x06\x63hunks\x12(\n\x10\x63\x61\x63he_read_count\x18\x05 \x01(\rR\x0e\x63\x61\x63heReadCount\x12\x33\n\x16\x63\x61\x63he_read_input_bytes\x18\x06 \x01(\x04R\x13\x63\x61\x63heReadInputBytes\x12*\n\x11\x63\x61\x63he_write_count\x18\x07 \x01(\rR\x0f\x63\x61\x63heWriteCount\x12\x35\n\x17\x63\x61\x63he_write_input_bytes\x18\x08 \x01(\x04R\x14\x63\x61\x63heWriteInputBytes\x12\x1d\n\nlb_address\x18\n \x01(\tR\tlbAddress\x12\x1f\n\x0bsampler_tag\x18\x0b \x01(\tR\nsamplerTag\"U\n\x15\x43ompactContextRequest\x12\x14\n\x05model\x18\x01 \x01(\tR\x05model\x12&\n\x05input\x18\x02 \x03(\x0b\x32\x10.xai_api.MessageR\x05input\"\xb7\x01\n\x16\x43ompactContextResponse\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12+\n\x11\x65ncrypted_content\x18\x02 \x01(\tR\x10\x65ncryptedContent\x12\x32\n\x15\x64ropped_message_count\x18\x03 \x01(\rR\x13\x64roppedMessageCount\x12,\n\x05usage\x18\x04 \x01(\x0b\x32\x16.xai_api.SamplingUsageR\x05usage*\xb2\x03\n\rIncludeOption\x12\x1a\n\x16INCLUDE_OPTION_INVALID\x10\x00\x12)\n%INCLUDE_OPTION_WEB_SEARCH_CALL_OUTPUT\x10\x01\x12\'\n#INCLUDE_OPTION_X_SEARCH_CALL_OUTPUT\x10\x02\x12-\n)INCLUDE_OPTION_CODE_EXECUTION_CALL_OUTPUT\x10\x03\x12\x31\n-INCLUDE_OPTION_COLLECTIONS_SEARCH_CALL_OUTPUT\x10\x04\x12\x30\n,INCLUDE_OPTION_ATTACHMENT_SEARCH_CALL_OUTPUT\x10\x05\x12\"\n\x1eINCLUDE_OPTION_MCP_CALL_OUTPUT\x10\x06\x12#\n\x1fINCLUDE_OPTION_INLINE_CITATIONS\x10\x07\x12$\n INCLUDE_OPTION_VERBOSE_STREAMING\x10\x08\x12.\n*INCLUDE_OPTION_CODE_EXECUTION_FILES_OUTPUT\x10\t*\x8d\x01\n\x0bMessageRole\x12\x10\n\x0cINVALID_ROLE\x10\x00\x12\r\n\tROLE_USER\x10\x01\x12\x12\n\x0eROLE_ASSISTANT\x10\x02\x12\x0f\n\x0bROLE_SYSTEM\x10\x03\x12\x15\n\rROLE_FUNCTION\x10\x04\x1a\x02\x08\x01\x12\r\n\tROLE_TOOL\x10\x05\x12\x12\n\x0eROLE_DEVELOPER\x10\x06*j\n\x0fReasoningEffort\x12\x12\n\x0eINVALID_EFFORT\x10\x00\x12\x0e\n\nEFFORT_LOW\x10\x01\x12\x11\n\rEFFORT_MEDIUM\x10\x02\x12\x0f\n\x0b\x45\x46\x46ORT_HIGH\x10\x03\x12\x0f\n\x0b\x45\x46\x46ORT_NONE\x10\x04*P\n\nAgentCount\x12\x1b\n\x17\x41GENT_COUNT_UNSPECIFIED\x10\x00\x12\x11\n\rAGENT_COUNT_4\x10\x01\x12\x12\n\x0e\x41GENT_COUNT_16\x10\x02*a\n\x08ToolMode\x12\x15\n\x11TOOL_MODE_INVALID\x10\x00\x12\x12\n\x0eTOOL_MODE_AUTO\x10\x01\x12\x12\n\x0eTOOL_MODE_NONE\x10\x02\x12\x16\n\x12TOOL_MODE_REQUIRED\x10\x03*u\n\nFormatType\x12\x17\n\x13\x46ORMAT_TYPE_INVALID\x10\x00\x12\x14\n\x10\x46ORMAT_TYPE_TEXT\x10\x01\x12\x1b\n\x17\x46ORMAT_TYPE_JSON_OBJECT\x10\x02\x12\x1b\n\x17\x46ORMAT_TYPE_JSON_SCHEMA\x10\x03*\xdb\x02\n\x0cToolCallType\x12\x1a\n\x16TOOL_CALL_TYPE_INVALID\x10\x00\x12#\n\x1fTOOL_CALL_TYPE_CLIENT_SIDE_TOOL\x10\x01\x12\"\n\x1eTOOL_CALL_TYPE_WEB_SEARCH_TOOL\x10\x02\x12 \n\x1cTOOL_CALL_TYPE_X_SEARCH_TOOL\x10\x03\x12&\n\"TOOL_CALL_TYPE_CODE_EXECUTION_TOOL\x10\x04\x12*\n&TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL\x10\x05\x12\x1b\n\x17TOOL_CALL_TYPE_MCP_TOOL\x10\x06\x12)\n%TOOL_CALL_TYPE_ATTACHMENT_SEARCH_TOOL\x10\x07\x12(\n$TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL\x10\n*\x90\x01\n\x0eToolCallStatus\x12 \n\x1cTOOL_CALL_STATUS_IN_PROGRESS\x10\x00\x12\x1e\n\x1aTOOL_CALL_STATUS_COMPLETED\x10\x01\x12\x1f\n\x1bTOOL_CALL_STATUS_INCOMPLETE\x10\x02\x12\x1b\n\x17TOOL_CALL_STATUS_FAILED\x10\x03*d\n\nSearchMode\x12\x17\n\x13INVALID_SEARCH_MODE\x10\x00\x12\x13\n\x0fOFF_SEARCH_MODE\x10\x01\x12\x12\n\x0eON_SEARCH_MODE\x10\x02\x12\x14\n\x10\x41UTO_SEARCH_MODE\x10\x03\x32\x99\x05\n\x04\x43hat\x12U\n\rGetCompletion\x12\x1e.xai_api.GetCompletionsRequest\x1a\".xai_api.GetChatCompletionResponse\"\x00\x12Y\n\x12GetCompletionChunk\x12\x1e.xai_api.GetCompletionsRequest\x1a\x1f.xai_api.GetChatCompletionChunk\"\x00\x30\x01\x12[\n\x17StartDeferredCompletion\x12\x1e.xai_api.GetCompletionsRequest\x1a\x1e.xai_api.StartDeferredResponse\"\x00\x12^\n\x15GetDeferredCompletion\x12\x1b.xai_api.GetDeferredRequest\x1a&.xai_api.GetDeferredCompletionResponse\"\x00\x12`\n\x13GetStoredCompletion\x12#.xai_api.GetStoredCompletionRequest\x1a\".xai_api.GetChatCompletionResponse\"\x00\x12k\n\x16\x44\x65leteStoredCompletion\x12&.xai_api.DeleteStoredCompletionRequest\x1a\'.xai_api.DeleteStoredCompletionResponse\"\x00\x12S\n\x0e\x43ompactContext\x12\x1e.xai_api.CompactContextRequest\x1a\x1f.xai_api.CompactContextResponse\"\x00\x42P\n\x0b\x63om.xai_apiB\tChatProtoP\x01\xa2\x02\x03XXX\xaa\x02\x06XaiApi\xca\x02\x06XaiApi\xe2\x02\x12XaiApi\\GPBMetadata\xea\x02\x06XaiApib\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -42,24 +42,24 @@ _globals['_MESSAGEROLE'].values_by_name["ROLE_FUNCTION"]._serialized_options = b'\010\001' _globals['_MCP_EXTRAHEADERSENTRY']._loaded_options = None _globals['_MCP_EXTRAHEADERSENTRY']._serialized_options = b'8\001' - _globals['_INCLUDEOPTION']._serialized_start=10930 - _globals['_INCLUDEOPTION']._serialized_end=11364 - _globals['_MESSAGEROLE']._serialized_start=11367 - _globals['_MESSAGEROLE']._serialized_end=11508 - _globals['_REASONINGEFFORT']._serialized_start=11510 - _globals['_REASONINGEFFORT']._serialized_end=11616 - _globals['_AGENTCOUNT']._serialized_start=11618 - _globals['_AGENTCOUNT']._serialized_end=11698 - _globals['_TOOLMODE']._serialized_start=11700 - _globals['_TOOLMODE']._serialized_end=11797 - _globals['_FORMATTYPE']._serialized_start=11799 - _globals['_FORMATTYPE']._serialized_end=11916 - _globals['_TOOLCALLTYPE']._serialized_start=11919 - _globals['_TOOLCALLTYPE']._serialized_end=12224 - _globals['_TOOLCALLSTATUS']._serialized_start=12227 - _globals['_TOOLCALLSTATUS']._serialized_end=12371 - _globals['_SEARCHMODE']._serialized_start=12373 - _globals['_SEARCHMODE']._serialized_end=12473 + _globals['_INCLUDEOPTION']._serialized_start=11060 + _globals['_INCLUDEOPTION']._serialized_end=11494 + _globals['_MESSAGEROLE']._serialized_start=11497 + _globals['_MESSAGEROLE']._serialized_end=11638 + _globals['_REASONINGEFFORT']._serialized_start=11640 + _globals['_REASONINGEFFORT']._serialized_end=11746 + _globals['_AGENTCOUNT']._serialized_start=11748 + _globals['_AGENTCOUNT']._serialized_end=11828 + _globals['_TOOLMODE']._serialized_start=11830 + _globals['_TOOLMODE']._serialized_end=11927 + _globals['_FORMATTYPE']._serialized_start=11929 + _globals['_FORMATTYPE']._serialized_end=12046 + _globals['_TOOLCALLTYPE']._serialized_start=12049 + _globals['_TOOLCALLTYPE']._serialized_end=12396 + _globals['_TOOLCALLSTATUS']._serialized_start=12399 + _globals['_TOOLCALLSTATUS']._serialized_end=12543 + _globals['_SEARCHMODE']._serialized_start=12545 + _globals['_SEARCHMODE']._serialized_end=12645 _globals['_GETCOMPLETIONSREQUEST']._serialized_start=196 _globals['_GETCOMPLETIONSREQUEST']._serialized_end=1589 _globals['_GETCHATCOMPLETIONRESPONSE']._serialized_start=1592 @@ -101,57 +101,59 @@ _globals['_TOOLCHOICE']._serialized_start=5205 _globals['_TOOLCHOICE']._serialized_end=5312 _globals['_TOOL']._serialized_start=5315 - _globals['_TOOL']._serialized_end=5728 - _globals['_MCP']._serialized_start=5731 - _globals['_MCP']._serialized_end=6090 - _globals['_MCP_EXTRAHEADERSENTRY']._serialized_start=6009 - _globals['_MCP_EXTRAHEADERSENTRY']._serialized_end=6072 - _globals['_WEBSEARCH']._serialized_start=6093 - _globals['_WEBSEARCH']._serialized_end=6455 - _globals['_WEBSEARCHUSERLOCATION']._serialized_start=6458 - _globals['_WEBSEARCHUSERLOCATION']._serialized_end=6644 - _globals['_XSEARCH']._serialized_start=6647 - _globals['_XSEARCH']._serialized_end=7088 - _globals['_CODEEXECUTION']._serialized_start=7090 - _globals['_CODEEXECUTION']._serialized_end=7105 - _globals['_COLLECTIONSSEARCH']._serialized_start=7108 - _globals['_COLLECTIONSSEARCH']._serialized_end=7501 - _globals['_ATTACHMENTSEARCH']._serialized_start=7503 - _globals['_ATTACHMENTSEARCH']._serialized_end=7558 - _globals['_FUNCTION']._serialized_start=7560 - _globals['_FUNCTION']._serialized_end=7680 - _globals['_TOOLCALL']._serialized_start=7683 - _globals['_TOOLCALL']._serialized_end=7922 - _globals['_FUNCTIONCALL']._serialized_start=7924 - _globals['_FUNCTIONCALL']._serialized_end=7988 - _globals['_RESPONSEFORMAT']._serialized_start=7990 - _globals['_RESPONSEFORMAT']._serialized_end=8100 - _globals['_SEARCHPARAMETERS']._serialized_start=8103 - _globals['_SEARCHPARAMETERS']._serialized_end=8432 - _globals['_SOURCE']._serialized_start=8435 - _globals['_SOURCE']._serialized_end=8610 - _globals['_WEBSOURCE']._serialized_start=8613 - _globals['_WEBSOURCE']._serialized_end=8788 - _globals['_NEWSSOURCE']._serialized_start=8791 - _globals['_NEWSSOURCE']._serialized_end=8924 - _globals['_XSOURCE']._serialized_start=8927 - _globals['_XSOURCE']._serialized_end=9176 - _globals['_RSSSOURCE']._serialized_start=9178 - _globals['_RSSSOURCE']._serialized_end=9211 - _globals['_REQUESTSETTINGS']._serialized_start=9214 - _globals['_REQUESTSETTINGS']._serialized_end=10013 - _globals['_GETSTOREDCOMPLETIONREQUEST']._serialized_start=10015 - _globals['_GETSTOREDCOMPLETIONREQUEST']._serialized_end=10076 - _globals['_DELETESTOREDCOMPLETIONREQUEST']._serialized_start=10078 - _globals['_DELETESTOREDCOMPLETIONREQUEST']._serialized_end=10142 - _globals['_DELETESTOREDCOMPLETIONRESPONSE']._serialized_start=10144 - _globals['_DELETESTOREDCOMPLETIONRESPONSE']._serialized_end=10209 - _globals['_DEBUGOUTPUT']._serialized_start=10212 - _globals['_DEBUGOUTPUT']._serialized_end=10654 - _globals['_COMPACTCONTEXTREQUEST']._serialized_start=10656 - _globals['_COMPACTCONTEXTREQUEST']._serialized_end=10741 - _globals['_COMPACTCONTEXTRESPONSE']._serialized_start=10744 - _globals['_COMPACTCONTEXTRESPONSE']._serialized_end=10927 - _globals['_CHAT']._serialized_start=12476 - _globals['_CHAT']._serialized_end=13141 + _globals['_TOOL']._serialized_end=5799 + _globals['_MCP']._serialized_start=5802 + _globals['_MCP']._serialized_end=6161 + _globals['_MCP_EXTRAHEADERSENTRY']._serialized_start=6080 + _globals['_MCP_EXTRAHEADERSENTRY']._serialized_end=6143 + _globals['_WEBSEARCH']._serialized_start=6164 + _globals['_WEBSEARCH']._serialized_end=6526 + _globals['_WEBSEARCHUSERLOCATION']._serialized_start=6529 + _globals['_WEBSEARCHUSERLOCATION']._serialized_end=6715 + _globals['_XSEARCH']._serialized_start=6718 + _globals['_XSEARCH']._serialized_end=7159 + _globals['_CODEEXECUTION']._serialized_start=7161 + _globals['_CODEEXECUTION']._serialized_end=7176 + _globals['_IMAGEGENERATION']._serialized_start=7178 + _globals['_IMAGEGENERATION']._serialized_end=7235 + _globals['_COLLECTIONSSEARCH']._serialized_start=7238 + _globals['_COLLECTIONSSEARCH']._serialized_end=7631 + _globals['_ATTACHMENTSEARCH']._serialized_start=7633 + _globals['_ATTACHMENTSEARCH']._serialized_end=7688 + _globals['_FUNCTION']._serialized_start=7690 + _globals['_FUNCTION']._serialized_end=7810 + _globals['_TOOLCALL']._serialized_start=7813 + _globals['_TOOLCALL']._serialized_end=8052 + _globals['_FUNCTIONCALL']._serialized_start=8054 + _globals['_FUNCTIONCALL']._serialized_end=8118 + _globals['_RESPONSEFORMAT']._serialized_start=8120 + _globals['_RESPONSEFORMAT']._serialized_end=8230 + _globals['_SEARCHPARAMETERS']._serialized_start=8233 + _globals['_SEARCHPARAMETERS']._serialized_end=8562 + _globals['_SOURCE']._serialized_start=8565 + _globals['_SOURCE']._serialized_end=8740 + _globals['_WEBSOURCE']._serialized_start=8743 + _globals['_WEBSOURCE']._serialized_end=8918 + _globals['_NEWSSOURCE']._serialized_start=8921 + _globals['_NEWSSOURCE']._serialized_end=9054 + _globals['_XSOURCE']._serialized_start=9057 + _globals['_XSOURCE']._serialized_end=9306 + _globals['_RSSSOURCE']._serialized_start=9308 + _globals['_RSSSOURCE']._serialized_end=9341 + _globals['_REQUESTSETTINGS']._serialized_start=9344 + _globals['_REQUESTSETTINGS']._serialized_end=10143 + _globals['_GETSTOREDCOMPLETIONREQUEST']._serialized_start=10145 + _globals['_GETSTOREDCOMPLETIONREQUEST']._serialized_end=10206 + _globals['_DELETESTOREDCOMPLETIONREQUEST']._serialized_start=10208 + _globals['_DELETESTOREDCOMPLETIONREQUEST']._serialized_end=10272 + _globals['_DELETESTOREDCOMPLETIONRESPONSE']._serialized_start=10274 + _globals['_DELETESTOREDCOMPLETIONRESPONSE']._serialized_end=10339 + _globals['_DEBUGOUTPUT']._serialized_start=10342 + _globals['_DEBUGOUTPUT']._serialized_end=10784 + _globals['_COMPACTCONTEXTREQUEST']._serialized_start=10786 + _globals['_COMPACTCONTEXTREQUEST']._serialized_end=10871 + _globals['_COMPACTCONTEXTRESPONSE']._serialized_start=10874 + _globals['_COMPACTCONTEXTRESPONSE']._serialized_end=11057 + _globals['_CHAT']._serialized_start=12648 + _globals['_CHAT']._serialized_end=13313 # @@protoc_insertion_point(module_scope) diff --git a/src/xai_sdk/proto/v6/chat_pb2.pyi b/src/xai_sdk/proto/v6/chat_pb2.pyi index ac0460e..28cf865 100644 --- a/src/xai_sdk/proto/v6/chat_pb2.pyi +++ b/src/xai_sdk/proto/v6/chat_pb2.pyi @@ -74,6 +74,7 @@ class ToolCallType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL: _ClassVar[ToolCallType] TOOL_CALL_TYPE_MCP_TOOL: _ClassVar[ToolCallType] TOOL_CALL_TYPE_ATTACHMENT_SEARCH_TOOL: _ClassVar[ToolCallType] + TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL: _ClassVar[ToolCallType] class ToolCallStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = () @@ -129,6 +130,7 @@ TOOL_CALL_TYPE_CODE_EXECUTION_TOOL: ToolCallType TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL: ToolCallType TOOL_CALL_TYPE_MCP_TOOL: ToolCallType TOOL_CALL_TYPE_ATTACHMENT_SEARCH_TOOL: ToolCallType +TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL: ToolCallType TOOL_CALL_STATUS_IN_PROGRESS: ToolCallStatus TOOL_CALL_STATUS_COMPLETED: ToolCallStatus TOOL_CALL_STATUS_INCOMPLETE: ToolCallStatus @@ -437,7 +439,7 @@ class ToolChoice(_message.Message): def __init__(self, mode: _Optional[_Union[ToolMode, str]] = ..., function_name: _Optional[str] = ...) -> None: ... class Tool(_message.Message): - __slots__ = ("function", "web_search", "x_search", "code_execution", "collections_search", "mcp", "attachment_search") + __slots__ = ("function", "web_search", "x_search", "code_execution", "collections_search", "mcp", "attachment_search", "image_generation") FUNCTION_FIELD_NUMBER: _ClassVar[int] WEB_SEARCH_FIELD_NUMBER: _ClassVar[int] X_SEARCH_FIELD_NUMBER: _ClassVar[int] @@ -445,6 +447,7 @@ class Tool(_message.Message): COLLECTIONS_SEARCH_FIELD_NUMBER: _ClassVar[int] MCP_FIELD_NUMBER: _ClassVar[int] ATTACHMENT_SEARCH_FIELD_NUMBER: _ClassVar[int] + IMAGE_GENERATION_FIELD_NUMBER: _ClassVar[int] function: Function web_search: WebSearch x_search: XSearch @@ -452,7 +455,8 @@ class Tool(_message.Message): collections_search: CollectionsSearch mcp: MCP attachment_search: AttachmentSearch - def __init__(self, function: _Optional[_Union[Function, _Mapping]] = ..., web_search: _Optional[_Union[WebSearch, _Mapping]] = ..., x_search: _Optional[_Union[XSearch, _Mapping]] = ..., code_execution: _Optional[_Union[CodeExecution, _Mapping]] = ..., collections_search: _Optional[_Union[CollectionsSearch, _Mapping]] = ..., mcp: _Optional[_Union[MCP, _Mapping]] = ..., attachment_search: _Optional[_Union[AttachmentSearch, _Mapping]] = ...) -> None: ... + image_generation: ImageGeneration + def __init__(self, function: _Optional[_Union[Function, _Mapping]] = ..., web_search: _Optional[_Union[WebSearch, _Mapping]] = ..., x_search: _Optional[_Union[XSearch, _Mapping]] = ..., code_execution: _Optional[_Union[CodeExecution, _Mapping]] = ..., collections_search: _Optional[_Union[CollectionsSearch, _Mapping]] = ..., mcp: _Optional[_Union[MCP, _Mapping]] = ..., attachment_search: _Optional[_Union[AttachmentSearch, _Mapping]] = ..., image_generation: _Optional[_Union[ImageGeneration, _Mapping]] = ...) -> None: ... class MCP(_message.Message): __slots__ = ("server_label", "server_description", "server_url", "allowed_tool_names", "authorization", "extra_headers") @@ -523,6 +527,12 @@ class CodeExecution(_message.Message): __slots__ = () def __init__(self) -> None: ... +class ImageGeneration(_message.Message): + __slots__ = ("action",) + ACTION_FIELD_NUMBER: _ClassVar[int] + action: str + def __init__(self, action: _Optional[str] = ...) -> None: ... + class CollectionsSearch(_message.Message): __slots__ = ("collection_ids", "limit", "instructions", "hybrid_retrieval", "semantic_retrieval", "keyword_retrieval") COLLECTION_IDS_FIELD_NUMBER: _ClassVar[int] diff --git a/src/xai_sdk/proto/v6/usage_pb2.py b/src/xai_sdk/proto/v6/usage_pb2.py index 353289b..2732ac4 100644 --- a/src/xai_sdk/proto/v6/usage_pb2.py +++ b/src/xai_sdk/proto/v6/usage_pb2.py @@ -24,7 +24,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16xai/api/v1/usage.proto\x12\x07xai_api\"\x86\x04\n\rSamplingUsage\x12+\n\x11\x63ompletion_tokens\x18\x01 \x01(\x05R\x10\x63ompletionTokens\x12)\n\x10reasoning_tokens\x18\x06 \x01(\x05R\x0freasoningTokens\x12#\n\rprompt_tokens\x18\x02 \x01(\x05R\x0cpromptTokens\x12!\n\x0ctotal_tokens\x18\x03 \x01(\x05R\x0btotalTokens\x12,\n\x12prompt_text_tokens\x18\x04 \x01(\x05R\x10promptTextTokens\x12\x39\n\x19\x63\x61\x63hed_prompt_text_tokens\x18\x07 \x01(\x05R\x16\x63\x61\x63hedPromptTextTokens\x12.\n\x13prompt_image_tokens\x18\x05 \x01(\x05R\x11promptImageTokens\x12(\n\x10num_sources_used\x18\x08 \x01(\x05R\x0enumSourcesUsed\x12L\n\x16server_side_tools_used\x18\t \x03(\x0e\x32\x17.xai_api.ServerSideToolR\x13serverSideToolsUsed\x12.\n\x11\x63ost_in_usd_ticks\x18\x0b \x01(\x03H\x00R\x0e\x63ostInUsdTicks\x88\x01\x01\x42\x14\n\x12_cost_in_usd_ticks\"r\n\x0e\x45mbeddingUsage\x12.\n\x13num_text_embeddings\x18\x01 \x01(\x05R\x11numTextEmbeddings\x12\x30\n\x14num_image_embeddings\x18\x02 \x01(\x05R\x12numImageEmbeddings*`\n\x0bServiceTier\x12\x1c\n\x18SERVICE_TIER_UNSPECIFIED\x10\x00\x12\x18\n\x14SERVICE_TIER_DEFAULT\x10\x01\x12\x19\n\x15SERVICE_TIER_PRIORITY\x10\x02*\xe5\x02\n\x0eServerSideTool\x12\x1c\n\x18SERVER_SIDE_TOOL_INVALID\x10\x00\x12\x1f\n\x1bSERVER_SIDE_TOOL_WEB_SEARCH\x10\x01\x12\x1d\n\x19SERVER_SIDE_TOOL_X_SEARCH\x10\x02\x12#\n\x1fSERVER_SIDE_TOOL_CODE_EXECUTION\x10\x03\x12\x1f\n\x1bSERVER_SIDE_TOOL_VIEW_IMAGE\x10\x04\x12!\n\x1dSERVER_SIDE_TOOL_VIEW_X_VIDEO\x10\x05\x12\'\n#SERVER_SIDE_TOOL_COLLECTIONS_SEARCH\x10\x06\x12\x18\n\x14SERVER_SIDE_TOOL_MCP\x10\x07\x12&\n\"SERVER_SIDE_TOOL_ATTACHMENT_SEARCH\x10\x08\x12!\n\x1dSERVER_SIDE_TOOL_IMAGE_SEARCH\x10\nBQ\n\x0b\x63om.xai_apiB\nUsageProtoP\x01\xa2\x02\x03XXX\xaa\x02\x06XaiApi\xca\x02\x06XaiApi\xe2\x02\x12XaiApi\\GPBMetadata\xea\x02\x06XaiApib\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16xai/api/v1/usage.proto\x12\x07xai_api\"\x86\x04\n\rSamplingUsage\x12+\n\x11\x63ompletion_tokens\x18\x01 \x01(\x05R\x10\x63ompletionTokens\x12)\n\x10reasoning_tokens\x18\x06 \x01(\x05R\x0freasoningTokens\x12#\n\rprompt_tokens\x18\x02 \x01(\x05R\x0cpromptTokens\x12!\n\x0ctotal_tokens\x18\x03 \x01(\x05R\x0btotalTokens\x12,\n\x12prompt_text_tokens\x18\x04 \x01(\x05R\x10promptTextTokens\x12\x39\n\x19\x63\x61\x63hed_prompt_text_tokens\x18\x07 \x01(\x05R\x16\x63\x61\x63hedPromptTextTokens\x12.\n\x13prompt_image_tokens\x18\x05 \x01(\x05R\x11promptImageTokens\x12(\n\x10num_sources_used\x18\x08 \x01(\x05R\x0enumSourcesUsed\x12L\n\x16server_side_tools_used\x18\t \x03(\x0e\x32\x17.xai_api.ServerSideToolR\x13serverSideToolsUsed\x12.\n\x11\x63ost_in_usd_ticks\x18\x0b \x01(\x03H\x00R\x0e\x63ostInUsdTicks\x88\x01\x01\x42\x14\n\x12_cost_in_usd_ticks\"r\n\x0e\x45mbeddingUsage\x12.\n\x13num_text_embeddings\x18\x01 \x01(\x05R\x11numTextEmbeddings\x12\x30\n\x14num_image_embeddings\x18\x02 \x01(\x05R\x12numImageEmbeddings*`\n\x0bServiceTier\x12\x1c\n\x18SERVICE_TIER_UNSPECIFIED\x10\x00\x12\x18\n\x14SERVICE_TIER_DEFAULT\x10\x01\x12\x19\n\x15SERVICE_TIER_PRIORITY\x10\x02*\x8c\x03\n\x0eServerSideTool\x12\x1c\n\x18SERVER_SIDE_TOOL_INVALID\x10\x00\x12\x1f\n\x1bSERVER_SIDE_TOOL_WEB_SEARCH\x10\x01\x12\x1d\n\x19SERVER_SIDE_TOOL_X_SEARCH\x10\x02\x12#\n\x1fSERVER_SIDE_TOOL_CODE_EXECUTION\x10\x03\x12\x1f\n\x1bSERVER_SIDE_TOOL_VIEW_IMAGE\x10\x04\x12!\n\x1dSERVER_SIDE_TOOL_VIEW_X_VIDEO\x10\x05\x12\'\n#SERVER_SIDE_TOOL_COLLECTIONS_SEARCH\x10\x06\x12\x18\n\x14SERVER_SIDE_TOOL_MCP\x10\x07\x12&\n\"SERVER_SIDE_TOOL_ATTACHMENT_SEARCH\x10\x08\x12!\n\x1dSERVER_SIDE_TOOL_IMAGE_SEARCH\x10\n\x12%\n!SERVER_SIDE_TOOL_IMAGE_GENERATION\x10\x0b\x42Q\n\x0b\x63om.xai_apiB\nUsageProtoP\x01\xa2\x02\x03XXX\xaa\x02\x06XaiApi\xca\x02\x06XaiApi\xe2\x02\x12XaiApi\\GPBMetadata\xea\x02\x06XaiApib\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -35,7 +35,7 @@ _globals['_SERVICETIER']._serialized_start=672 _globals['_SERVICETIER']._serialized_end=768 _globals['_SERVERSIDETOOL']._serialized_start=771 - _globals['_SERVERSIDETOOL']._serialized_end=1128 + _globals['_SERVERSIDETOOL']._serialized_end=1167 _globals['_SAMPLINGUSAGE']._serialized_start=36 _globals['_SAMPLINGUSAGE']._serialized_end=554 _globals['_EMBEDDINGUSAGE']._serialized_start=556 diff --git a/src/xai_sdk/proto/v6/usage_pb2.pyi b/src/xai_sdk/proto/v6/usage_pb2.pyi index 418ff90..97e794b 100644 --- a/src/xai_sdk/proto/v6/usage_pb2.pyi +++ b/src/xai_sdk/proto/v6/usage_pb2.pyi @@ -25,6 +25,7 @@ class ServerSideTool(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): SERVER_SIDE_TOOL_MCP: _ClassVar[ServerSideTool] SERVER_SIDE_TOOL_ATTACHMENT_SEARCH: _ClassVar[ServerSideTool] SERVER_SIDE_TOOL_IMAGE_SEARCH: _ClassVar[ServerSideTool] + SERVER_SIDE_TOOL_IMAGE_GENERATION: _ClassVar[ServerSideTool] SERVICE_TIER_UNSPECIFIED: ServiceTier SERVICE_TIER_DEFAULT: ServiceTier SERVICE_TIER_PRIORITY: ServiceTier @@ -38,6 +39,7 @@ SERVER_SIDE_TOOL_COLLECTIONS_SEARCH: ServerSideTool SERVER_SIDE_TOOL_MCP: ServerSideTool SERVER_SIDE_TOOL_ATTACHMENT_SEARCH: ServerSideTool SERVER_SIDE_TOOL_IMAGE_SEARCH: ServerSideTool +SERVER_SIDE_TOOL_IMAGE_GENERATION: ServerSideTool class SamplingUsage(_message.Message): __slots__ = ("completion_tokens", "reasoning_tokens", "prompt_tokens", "total_tokens", "prompt_text_tokens", "cached_prompt_text_tokens", "prompt_image_tokens", "num_sources_used", "server_side_tools_used", "cost_in_usd_ticks") diff --git a/src/xai_sdk/tools.py b/src/xai_sdk/tools.py index a5c8701..363f9df 100644 --- a/src/xai_sdk/tools.py +++ b/src/xai_sdk/tools.py @@ -1,5 +1,5 @@ import datetime -from typing import Optional, Union +from typing import Literal, Optional, Union from google.protobuf.timestamp_pb2 import Timestamp @@ -170,6 +170,38 @@ def code_execution() -> chat_pb2.Tool: return chat_pb2.Tool(code_execution=chat_pb2.CodeExecution()) +def image_generation(action: Optional[Literal["auto", "generate", "edit"]] = None) -> chat_pb2.Tool: + """Creates a server-side tool for image generation, typically used in agentic requests. + + This tool enables the model to generate images from text prompts and to edit images + (both previously generated ones and images provided in the conversation) as part of + generating responses. + + Args: + action: Which image capabilities to expose to the model. One of "auto" (the + default; both generation and editing), "generate" (text-to-image only), or + "edit" (image editing only). Defaults to None, which the server treats + as "auto". + + Returns: + A `chat_pb2.Tool` object configured for image generation. + + Example: + ``` + from xai_sdk.tools import image_generation + + # Create an image generation tool with both generation and editing enabled + tool = image_generation() + + # Restrict the tool to text-to-image generation only + tool = image_generation(action="generate") + ``` + """ + if action is None: + return chat_pb2.Tool(image_generation=chat_pb2.ImageGeneration()) + return chat_pb2.Tool(image_generation=chat_pb2.ImageGeneration(action=action)) + + def collections_search( collection_ids: list[str], limit: Optional[int] = None, @@ -298,6 +330,7 @@ def get_tool_call_type(tool_call: chat_pb2.ToolCall) -> str: Returns: The type of the tool call as a string, valid values are: "client_side_tool", "web_search_tool", - "x_search_tool", "code_execution_tool", "collections_search_tool", "mcp_tool", "attachment_search_tool". + "x_search_tool", "code_execution_tool", "collections_search_tool", "mcp_tool", "attachment_search_tool", + "image_generation_tool". """ return chat_pb2.ToolCallType.Name(tool_call.type).removeprefix("TOOL_CALL_TYPE_").lower() diff --git a/tests/aio/chat_test.py b/tests/aio/chat_test.py index dbc48d6..5ceee9e 100644 --- a/tests/aio/chat_test.py +++ b/tests/aio/chat_test.py @@ -29,7 +29,7 @@ from xai_sdk.cost import USD_PER_TICK from xai_sdk.proto import chat_pb2, image_pb2, sample_pb2, usage_pb2 from xai_sdk.search import SearchParameters, news_source, rss_source, web_source, x_source -from xai_sdk.tools import code_execution, web_search, x_search +from xai_sdk.tools import code_execution, image_generation, web_search, x_search from .. import server @@ -1458,11 +1458,12 @@ def test_chat_create_with_server_side_tools(client: AsyncClient): enable_video_understanding=True, ), code_execution(), + image_generation(), ], ) chat_completion_request = chat.proto - assert len(chat_completion_request.tools) == 3 + assert len(chat_completion_request.tools) == 4 expected_from_date_pb = timestamp_pb2.Timestamp() expected_from_date_pb.FromDatetime(from_date) @@ -1490,9 +1491,12 @@ def test_chat_create_with_server_side_tools(client: AsyncClient): expected_code_execution_tool = chat_pb2.Tool(code_execution=chat_pb2.CodeExecution()) + expected_image_generation_tool = chat_pb2.Tool(image_generation=chat_pb2.ImageGeneration()) + assert chat_completion_request.tools[0] == expected_web_search_tool assert chat_completion_request.tools[1] == expected_x_search_tool assert chat_completion_request.tools[2] == expected_code_execution_tool + assert chat_completion_request.tools[3] == expected_image_generation_tool @pytest.mark.parametrize( diff --git a/tests/chat_test.py b/tests/chat_test.py index d5c0cb1..1320e8d 100644 --- a/tests/chat_test.py +++ b/tests/chat_test.py @@ -661,6 +661,35 @@ def test_server_side_tool_image_search_enum(): assert usage_pb2.ServerSideTool.Name(usage_pb2.SERVER_SIDE_TOOL_IMAGE_SEARCH) == "SERVER_SIDE_TOOL_IMAGE_SEARCH" +def test_image_generation_tool(): + """Test that image_generation util function correctly creates an image generation tool.""" + from xai_sdk.tools import image_generation + + tool = image_generation() + assert isinstance(tool, chat_pb2.Tool) + assert tool.HasField("image_generation") + assert not tool.image_generation.HasField("action") + + for action in ("auto", "generate", "edit"): + tool = image_generation(action=action) + assert tool.HasField("image_generation") + assert tool.image_generation.action == action + + +def test_image_generation_tool_call_type(): + """Test that image generation tool calls map to the expected type string.""" + tool_call = chat_pb2.ToolCall(type=chat_pb2.ToolCallType.TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL) + assert get_tool_call_type(tool_call) == "image_generation_tool" + + +def test_server_side_tool_image_generation_enum(): + assert usage_pb2.SERVER_SIDE_TOOL_IMAGE_GENERATION == 11 + assert ( + usage_pb2.ServerSideTool.Name(usage_pb2.SERVER_SIDE_TOOL_IMAGE_GENERATION) + == "SERVER_SIDE_TOOL_IMAGE_GENERATION" + ) + + def test_developer_message(): """Test that developer() creates a message with ROLE_DEVELOPER role.""" # Simple string content diff --git a/tests/sync/chat_test.py b/tests/sync/chat_test.py index 65338f5..37c5e3f 100644 --- a/tests/sync/chat_test.py +++ b/tests/sync/chat_test.py @@ -30,7 +30,7 @@ from xai_sdk.proto import chat_pb2, image_pb2, sample_pb2, usage_pb2 from xai_sdk.proto import documents_pb2 as _documents_pb2 from xai_sdk.search import SearchParameters, news_source, rss_source, web_source, x_source -from xai_sdk.tools import code_execution, collections_search, mcp, web_search, x_search +from xai_sdk.tools import code_execution, collections_search, image_generation, mcp, web_search, x_search from .. import server @@ -1430,11 +1430,12 @@ def test_chat_create_with_server_side_tools(client: Client): allowed_tool_names=["chat", "completions"], authorization="lin-1234567890", ), + image_generation(action="generate"), ], ) chat_completion_request = chat.proto - assert len(chat_completion_request.tools) == 5 + assert len(chat_completion_request.tools) == 6 expected_from_date_pb = timestamp_pb2.Timestamp() expected_from_date_pb.FromDatetime(from_date) @@ -1481,11 +1482,14 @@ def test_chat_create_with_server_side_tools(client: Client): ) ) + expected_image_generation_tool = chat_pb2.Tool(image_generation=chat_pb2.ImageGeneration(action="generate")) + assert chat_completion_request.tools[0] == expected_web_search_tool assert chat_completion_request.tools[1] == expected_x_search_tool assert chat_completion_request.tools[2] == expected_code_execution_tool assert chat_completion_request.tools[3] == expected_collections_search_tool assert chat_completion_request.tools[4] == expected_mcp_tool + assert chat_completion_request.tools[5] == expected_image_generation_tool @pytest.mark.parametrize( From d8b59f994286188df620b275cd20895b05b82502 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Tue, 28 Jul 2026 16:51:55 -0700 Subject: [PATCH 2/5] Add image_generation tool example Co-authored-by: Cursor --- examples/sync/image_generation_tool.py | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 examples/sync/image_generation_tool.py diff --git a/examples/sync/image_generation_tool.py b/examples/sync/image_generation_tool.py new file mode 100644 index 0000000..0ebb619 --- /dev/null +++ b/examples/sync/image_generation_tool.py @@ -0,0 +1,49 @@ +import base64 +import json +import os + +from xai_sdk import Client +from xai_sdk.chat import user +from xai_sdk.proto import chat_pb2 +from xai_sdk.tools import image_generation + + +def main() -> None: + client = Client(api_key=os.getenv("XAI_API_KEY")) + + chat = client.chat.create( + model="grok-4.5", + # Optionally restrict the tool with image_generation(action="generate") + # (text-to-image only) or image_generation(action="edit") (editing only). + tools=[image_generation()], + ) + + chat.append(user("Generate an image of a corgi surfing a big wave, in the style of a Japanese woodblock print")) + response = chat.sample() + + print(response.content) + + # Image generation calls produce ROLE_TOOL outputs. Select them by the + # tool-call type enum, then read the data URL out of the result envelope. + image_outputs = [ + output + for output in response.tool_outputs + if any( + tool_call.type == chat_pb2.TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL for tool_call in output.message.tool_calls + ) + ] + for i, output in enumerate(image_outputs): + envelope = json.loads(output.message.content) + data_url = envelope["result"] # data:image/jpeg;base64,... + mime_type, payload = data_url.removeprefix("data:").split(";base64,", 1) + image_bytes = base64.b64decode(payload) + filename = f"corgi_surfing_{i}.{mime_type.removeprefix('image/')}" + with open(filename, "wb") as f: + f.write(image_bytes) + print(f"Saved {filename} ({len(image_bytes)} bytes)") + + print(response.server_side_tool_usage) + + +if __name__ == "__main__": + main() From f7bafb295571cf1b1ba1205738448c23d715880f Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Tue, 28 Jul 2026 17:04:34 -0700 Subject: [PATCH 3/5] Add multi-turn generate-then-edit flow to image_generation tool example Co-authored-by: Cursor --- examples/sync/image_generation_tool.py | 79 ++++++++++++++++++++------ 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/examples/sync/image_generation_tool.py b/examples/sync/image_generation_tool.py index 0ebb619..6e9929a 100644 --- a/examples/sync/image_generation_tool.py +++ b/examples/sync/image_generation_tool.py @@ -8,23 +8,12 @@ from xai_sdk.tools import image_generation -def main() -> None: - client = Client(api_key=os.getenv("XAI_API_KEY")) - - chat = client.chat.create( - model="grok-4.5", - # Optionally restrict the tool with image_generation(action="generate") - # (text-to-image only) or image_generation(action="edit") (editing only). - tools=[image_generation()], - ) - - chat.append(user("Generate an image of a corgi surfing a big wave, in the style of a Japanese woodblock print")) - response = chat.sample() +def save_images(response, prefix: str) -> None: + """Saves every image produced by image_generation tool calls in a response. - print(response.content) - - # Image generation calls produce ROLE_TOOL outputs. Select them by the - # tool-call type enum, then read the data URL out of the result envelope. + Image generation calls produce ROLE_TOOL outputs. Select them by the + tool-call type enum, then read the data URL out of the result envelope. + """ image_outputs = [ output for output in response.tool_outputs @@ -37,13 +26,69 @@ def main() -> None: data_url = envelope["result"] # data:image/jpeg;base64,... mime_type, payload = data_url.removeprefix("data:").split(";base64,", 1) image_bytes = base64.b64decode(payload) - filename = f"corgi_surfing_{i}.{mime_type.removeprefix('image/')}" + filename = f"{prefix}_{i}.{mime_type.removeprefix('image/')}" with open(filename, "wb") as f: f.write(image_bytes) print(f"Saved {filename} ({len(image_bytes)} bytes)") + +def generate_image(client: Client) -> None: + """Generates an image in a single turn.""" + chat = client.chat.create( + model="grok-4.5", + # Optionally restrict the tool with image_generation(action="generate") + # (text-to-image only) or image_generation(action="edit") (editing only). + tools=[image_generation()], + ) + + chat.append(user("Generate an image of a corgi surfing a big wave, in the style of a Japanese woodblock print")) + response = chat.sample() + + print(response.content) + save_images(response, "corgi_surfing") print(response.server_side_tool_usage) +def generate_then_edit_image(client: Client) -> None: + """Generates an image, then edits it in a follow-up turn. + + Storing the first turn (`store_messages=True`) and chaining the second one + via `previous_response_id` replays the full agentic state on the server, + so the model can edit the image it generated on the previous turn. + """ + chat = client.chat.create( + model="grok-4.5", + tools=[image_generation(action="generate")], + store_messages=True, + ) + chat.append(user("Generate an image of a corgi surfing a big wave, in the style of a Japanese woodblock print")) + response = chat.sample() + + print(response.content) + save_images(response, "corgi_surfing") + + follow_up_chat = client.chat.create( + model="grok-4.5", + tools=[image_generation()], + store_messages=True, + previous_response_id=response.id, + ) + follow_up_chat.append(user("Edit the image you just generated: make it night time, lit by a full moon")) + follow_up_response = follow_up_chat.sample() + + print(follow_up_response.content) + save_images(follow_up_response, "corgi_surfing_night") + print(follow_up_response.server_side_tool_usage) + + +def main() -> None: + client = Client(api_key=os.getenv("XAI_API_KEY")) + + generate_image(client) + + # Multi-turn: generate an image, then edit it in a follow-up turn. + generate_then_edit_image(client) + + if __name__ == "__main__": main() From b88f7d4bbf80be10cc48c0cb09ff2311707a3834 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Tue, 28 Jul 2026 17:06:15 -0700 Subject: [PATCH 4/5] Only save images from completed image_generation tool calls in example Co-authored-by: Cursor --- examples/sync/image_generation_tool.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/sync/image_generation_tool.py b/examples/sync/image_generation_tool.py index 6e9929a..46074ed 100644 --- a/examples/sync/image_generation_tool.py +++ b/examples/sync/image_generation_tool.py @@ -11,14 +11,18 @@ def save_images(response, prefix: str) -> None: """Saves every image produced by image_generation tool calls in a response. - Image generation calls produce ROLE_TOOL outputs. Select them by the - tool-call type enum, then read the data URL out of the result envelope. + Image generation calls produce ROLE_TOOL outputs. Select the completed ones + by the tool-call type and status enums, then read the data URL out of the + result envelope. Failed calls carry an error payload instead of an image + envelope, so they are skipped. """ image_outputs = [ output for output in response.tool_outputs if any( - tool_call.type == chat_pb2.TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL for tool_call in output.message.tool_calls + tool_call.type == chat_pb2.TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL + and tool_call.status == chat_pb2.TOOL_CALL_STATUS_COMPLETED + for tool_call in output.message.tool_calls ) ] for i, output in enumerate(image_outputs): From e64fe7423b6cfeddcde2aaa8c21ac1352d85a4d5 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Wed, 29 Jul 2026 11:08:58 -0700 Subject: [PATCH 5/5] Add web_search + image_generation combined example Co-authored-by: Cursor --- examples/sync/image_generation_tool.py | 30 +++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/examples/sync/image_generation_tool.py b/examples/sync/image_generation_tool.py index 46074ed..ecd2225 100644 --- a/examples/sync/image_generation_tool.py +++ b/examples/sync/image_generation_tool.py @@ -5,7 +5,7 @@ from xai_sdk import Client from xai_sdk.chat import user from xai_sdk.proto import chat_pb2 -from xai_sdk.tools import image_generation +from xai_sdk.tools import get_tool_call_type, image_generation, web_search def save_images(response, prefix: str) -> None: @@ -85,6 +85,31 @@ def generate_then_edit_image(client: Client) -> None: print(follow_up_response.server_side_tool_usage) +def search_and_generate_image(client: Client) -> None: + """Combines web search with image generation in a single agentic request. + + The model first looks up live data with the web_search tool, then renders + what it found into a generated image. + """ + chat = client.chat.create( + model="grok-4.5", + tools=[web_search(), image_generation()], + ) + chat.append( + user( + "Generate an infographic image based on next week's temperature forecast in the UK, " + "with key city icons along with their forecast in the image" + ) + ) + response = chat.sample() + + print(response.content) + for tool_call in response.tool_calls: + print(f"Tool call: {get_tool_call_type(tool_call)} ({tool_call.function.name})") + save_images(response, "uk_forecast_infographic") + print(response.server_side_tool_usage) + + def main() -> None: client = Client(api_key=os.getenv("XAI_API_KEY")) @@ -93,6 +118,9 @@ def main() -> None: # Multi-turn: generate an image, then edit it in a follow-up turn. generate_then_edit_image(client) + # Combine web search with image generation. + search_and_generate_image(client) + if __name__ == "__main__": main()