1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct StartDeferredResponse {
5 #[prost(string, tag = "1")]
8 pub request_id: ::prost::alloc::string::String,
9}
10#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
13pub struct GetDeferredRequest {
14 #[prost(string, tag = "1")]
16 pub request_id: ::prost::alloc::string::String,
17}
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
20#[repr(i32)]
21pub enum DeferredStatus {
22 InvalidDeferredStatus = 0,
24 Done = 1,
26 Expired = 2,
29 Pending = 3,
31}
32impl DeferredStatus {
33 pub fn as_str_name(&self) -> &'static str {
38 match self {
39 Self::InvalidDeferredStatus => "INVALID_DEFERRED_STATUS",
40 Self::Done => "DONE",
41 Self::Expired => "EXPIRED",
42 Self::Pending => "PENDING",
43 }
44 }
45 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
47 match value {
48 "INVALID_DEFERRED_STATUS" => Some(Self::InvalidDeferredStatus),
49 "DONE" => Some(Self::Done),
50 "EXPIRED" => Some(Self::Expired),
51 "PENDING" => Some(Self::Pending),
52 _ => None,
53 }
54 }
55}
56#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
58pub struct GenerateImageRequest {
59 #[prost(string, tag = "1")]
61 pub prompt: ::prost::alloc::string::String,
62 #[prost(message, optional, tag = "5")]
64 pub image: ::core::option::Option<ImageUrlContent>,
65 #[prost(string, tag = "2")]
67 pub model: ::prost::alloc::string::String,
68 #[prost(int32, optional, tag = "3")]
70 pub n: ::core::option::Option<i32>,
71 #[prost(string, tag = "4")]
75 pub user: ::prost::alloc::string::String,
76 #[prost(enumeration = "ImageFormat", tag = "11")]
79 pub format: i32,
80}
81#[derive(Clone, PartialEq, ::prost::Message)]
83pub struct ImageResponse {
84 #[prost(message, repeated, tag = "1")]
86 pub images: ::prost::alloc::vec::Vec<GeneratedImage>,
87 #[prost(string, tag = "2")]
89 pub model: ::prost::alloc::string::String,
90}
91#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
93pub struct GeneratedImage {
94 #[prost(string, tag = "2")]
96 pub up_sampled_prompt: ::prost::alloc::string::String,
97 #[prost(bool, tag = "4")]
101 pub respect_moderation: bool,
102 #[prost(oneof = "generated_image::Image", tags = "1, 3")]
104 pub image: ::core::option::Option<generated_image::Image>,
105}
106pub mod generated_image {
108 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
110 pub enum Image {
111 #[prost(string, tag = "1")]
113 Base64(::prost::alloc::string::String),
114 #[prost(string, tag = "3")]
116 Url(::prost::alloc::string::String),
117 }
118}
119#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
121pub struct ImageUrlContent {
122 #[prost(string, tag = "1")]
130 pub image_url: ::prost::alloc::string::String,
131 #[prost(enumeration = "ImageDetail", tag = "2")]
133 pub detail: i32,
134}
135#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
138#[repr(i32)]
139pub enum ImageDetail {
140 DetailInvalid = 0,
142 DetailAuto = 1,
144 DetailLow = 2,
147 DetailHigh = 3,
151}
152impl ImageDetail {
153 pub fn as_str_name(&self) -> &'static str {
158 match self {
159 Self::DetailInvalid => "DETAIL_INVALID",
160 Self::DetailAuto => "DETAIL_AUTO",
161 Self::DetailLow => "DETAIL_LOW",
162 Self::DetailHigh => "DETAIL_HIGH",
163 }
164 }
165 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
167 match value {
168 "DETAIL_INVALID" => Some(Self::DetailInvalid),
169 "DETAIL_AUTO" => Some(Self::DetailAuto),
170 "DETAIL_LOW" => Some(Self::DetailLow),
171 "DETAIL_HIGH" => Some(Self::DetailHigh),
172 _ => None,
173 }
174 }
175}
176#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
179#[repr(i32)]
180pub enum ImageFormat {
181 ImgFormatInvalid = 0,
183 ImgFormatBase64 = 1,
185 ImgFormatUrl = 2,
187}
188impl ImageFormat {
189 pub fn as_str_name(&self) -> &'static str {
194 match self {
195 Self::ImgFormatInvalid => "IMG_FORMAT_INVALID",
196 Self::ImgFormatBase64 => "IMG_FORMAT_BASE64",
197 Self::ImgFormatUrl => "IMG_FORMAT_URL",
198 }
199 }
200 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
202 match value {
203 "IMG_FORMAT_INVALID" => Some(Self::ImgFormatInvalid),
204 "IMG_FORMAT_BASE64" => Some(Self::ImgFormatBase64),
205 "IMG_FORMAT_URL" => Some(Self::ImgFormatUrl),
206 _ => None,
207 }
208 }
209}
210pub mod image_client {
212 #![allow(
213 unused_variables,
214 dead_code,
215 missing_docs,
216 clippy::wildcard_imports,
217 clippy::let_unit_value,
218 )]
219 use tonic::codegen::*;
220 use tonic::codegen::http::Uri;
221 #[derive(Debug, Clone)]
223 pub struct ImageClient<T> {
224 inner: tonic::client::Grpc<T>,
225 }
226 impl ImageClient<tonic::transport::Channel> {
227 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
229 where
230 D: TryInto<tonic::transport::Endpoint>,
231 D::Error: Into<StdError>,
232 {
233 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
234 Ok(Self::new(conn))
235 }
236 }
237 impl<T> ImageClient<T>
238 where
239 T: tonic::client::GrpcService<tonic::body::Body>,
240 T::Error: Into<StdError>,
241 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
242 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
243 {
244 pub fn new(inner: T) -> Self {
245 let inner = tonic::client::Grpc::new(inner);
246 Self { inner }
247 }
248 pub fn with_origin(inner: T, origin: Uri) -> Self {
249 let inner = tonic::client::Grpc::with_origin(inner, origin);
250 Self { inner }
251 }
252 pub fn with_interceptor<F>(
253 inner: T,
254 interceptor: F,
255 ) -> ImageClient<InterceptedService<T, F>>
256 where
257 F: tonic::service::Interceptor,
258 T::ResponseBody: Default,
259 T: tonic::codegen::Service<
260 http::Request<tonic::body::Body>,
261 Response = http::Response<
262 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
263 >,
264 >,
265 <T as tonic::codegen::Service<
266 http::Request<tonic::body::Body>,
267 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
268 {
269 ImageClient::new(InterceptedService::new(inner, interceptor))
270 }
271 #[must_use]
276 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
277 self.inner = self.inner.send_compressed(encoding);
278 self
279 }
280 #[must_use]
282 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
283 self.inner = self.inner.accept_compressed(encoding);
284 self
285 }
286 #[must_use]
290 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
291 self.inner = self.inner.max_decoding_message_size(limit);
292 self
293 }
294 #[must_use]
298 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
299 self.inner = self.inner.max_encoding_message_size(limit);
300 self
301 }
302 pub async fn generate_image(
304 &mut self,
305 request: impl tonic::IntoRequest<super::GenerateImageRequest>,
306 ) -> std::result::Result<tonic::Response<super::ImageResponse>, tonic::Status> {
307 self.inner
308 .ready()
309 .await
310 .map_err(|e| {
311 tonic::Status::unknown(
312 format!("Service was not ready: {}", e.into()),
313 )
314 })?;
315 let codec = tonic_prost::ProstCodec::default();
316 let path = http::uri::PathAndQuery::from_static(
317 "/xai_api.Image/GenerateImage",
318 );
319 let mut req = request.into_request();
320 req.extensions_mut()
321 .insert(GrpcMethod::new("xai_api.Image", "GenerateImage"));
322 self.inner.unary(req, path, codec).await
323 }
324 }
325}
326#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
329pub struct SamplingUsage {
330 #[prost(int32, tag = "1")]
333 pub completion_tokens: i32,
334 #[prost(int32, tag = "6")]
336 pub reasoning_tokens: i32,
337 #[prost(int32, tag = "2")]
339 pub prompt_tokens: i32,
340 #[prost(int32, tag = "3")]
342 pub total_tokens: i32,
343 #[prost(int32, tag = "4")]
345 pub prompt_text_tokens: i32,
346 #[prost(int32, tag = "7")]
348 pub cached_prompt_text_tokens: i32,
349 #[prost(int32, tag = "5")]
351 pub prompt_image_tokens: i32,
352 #[prost(int32, tag = "8")]
357 pub num_sources_used: i32,
358 #[prost(enumeration = "ServerSideTool", repeated, tag = "9")]
360 pub server_side_tools_used: ::prost::alloc::vec::Vec<i32>,
361}
362#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
364pub struct EmbeddingUsage {
365 #[prost(int32, tag = "1")]
367 pub num_text_embeddings: i32,
368 #[prost(int32, tag = "2")]
370 pub num_image_embeddings: i32,
371}
372#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
373#[repr(i32)]
374pub enum ServerSideTool {
375 Invalid = 0,
376 WebSearch = 1,
377 XSearch = 2,
378 CodeExecution = 3,
379 ViewImage = 4,
380 ViewXVideo = 5,
381 CollectionsSearch = 6,
382 Mcp = 7,
383 DocumentSearch = 8,
384}
385impl ServerSideTool {
386 pub fn as_str_name(&self) -> &'static str {
391 match self {
392 Self::Invalid => "SERVER_SIDE_TOOL_INVALID",
393 Self::WebSearch => "SERVER_SIDE_TOOL_WEB_SEARCH",
394 Self::XSearch => "SERVER_SIDE_TOOL_X_SEARCH",
395 Self::CodeExecution => "SERVER_SIDE_TOOL_CODE_EXECUTION",
396 Self::ViewImage => "SERVER_SIDE_TOOL_VIEW_IMAGE",
397 Self::ViewXVideo => "SERVER_SIDE_TOOL_VIEW_X_VIDEO",
398 Self::CollectionsSearch => "SERVER_SIDE_TOOL_COLLECTIONS_SEARCH",
399 Self::Mcp => "SERVER_SIDE_TOOL_MCP",
400 Self::DocumentSearch => "SERVER_SIDE_TOOL_DOCUMENT_SEARCH",
401 }
402 }
403 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
405 match value {
406 "SERVER_SIDE_TOOL_INVALID" => Some(Self::Invalid),
407 "SERVER_SIDE_TOOL_WEB_SEARCH" => Some(Self::WebSearch),
408 "SERVER_SIDE_TOOL_X_SEARCH" => Some(Self::XSearch),
409 "SERVER_SIDE_TOOL_CODE_EXECUTION" => Some(Self::CodeExecution),
410 "SERVER_SIDE_TOOL_VIEW_IMAGE" => Some(Self::ViewImage),
411 "SERVER_SIDE_TOOL_VIEW_X_VIDEO" => Some(Self::ViewXVideo),
412 "SERVER_SIDE_TOOL_COLLECTIONS_SEARCH" => Some(Self::CollectionsSearch),
413 "SERVER_SIDE_TOOL_MCP" => Some(Self::Mcp),
414 "SERVER_SIDE_TOOL_DOCUMENT_SEARCH" => Some(Self::DocumentSearch),
415 _ => None,
416 }
417 }
418}
419#[derive(Clone, PartialEq, ::prost::Message)]
421pub struct SampleTextRequest {
422 #[prost(string, repeated, tag = "1")]
424 pub prompt: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
425 #[prost(string, tag = "3")]
427 pub model: ::prost::alloc::string::String,
428 #[prost(int32, optional, tag = "8")]
432 pub n: ::core::option::Option<i32>,
433 #[prost(int32, optional, tag = "7")]
442 pub max_tokens: ::core::option::Option<i32>,
443 #[prost(int32, optional, tag = "11")]
449 pub seed: ::core::option::Option<i32>,
450 #[prost(string, repeated, tag = "12")]
462 pub stop: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
463 #[prost(float, optional, tag = "14")]
471 pub temperature: ::core::option::Option<f32>,
472 #[prost(float, optional, tag = "15")]
482 pub top_p: ::core::option::Option<f32>,
483 #[prost(float, optional, tag = "13")]
487 pub frequency_penalty: ::core::option::Option<f32>,
488 #[prost(bool, tag = "5")]
491 pub logprobs: bool,
492 #[prost(float, optional, tag = "9")]
495 pub presence_penalty: ::core::option::Option<f32>,
496 #[prost(int32, optional, tag = "6")]
500 pub top_logprobs: ::core::option::Option<i32>,
501 #[prost(string, tag = "17")]
505 pub user: ::prost::alloc::string::String,
506}
507#[derive(Clone, PartialEq, ::prost::Message)]
509pub struct SampleTextResponse {
510 #[prost(string, tag = "1")]
513 pub id: ::prost::alloc::string::String,
514 #[prost(message, repeated, tag = "2")]
517 pub choices: ::prost::alloc::vec::Vec<SampleChoice>,
518 #[prost(message, optional, tag = "5")]
521 pub created: ::core::option::Option<::prost_types::Timestamp>,
522 #[prost(string, tag = "6")]
527 pub model: ::prost::alloc::string::String,
528 #[prost(string, tag = "7")]
530 pub system_fingerprint: ::prost::alloc::string::String,
531 #[prost(message, optional, tag = "9")]
533 pub usage: ::core::option::Option<SamplingUsage>,
534}
535#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
537pub struct SampleChoice {
538 #[prost(enumeration = "FinishReason", tag = "1")]
540 pub finish_reason: i32,
541 #[prost(int32, tag = "2")]
544 pub index: i32,
545 #[prost(string, tag = "3")]
547 pub text: ::prost::alloc::string::String,
548}
549#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
551#[repr(i32)]
552pub enum FinishReason {
553 ReasonInvalid = 0,
555 ReasonMaxLen = 1,
557 ReasonMaxContext = 2,
559 ReasonStop = 3,
561 ReasonToolCalls = 4,
563 ReasonTimeLimit = 5,
565}
566impl FinishReason {
567 pub fn as_str_name(&self) -> &'static str {
572 match self {
573 Self::ReasonInvalid => "REASON_INVALID",
574 Self::ReasonMaxLen => "REASON_MAX_LEN",
575 Self::ReasonMaxContext => "REASON_MAX_CONTEXT",
576 Self::ReasonStop => "REASON_STOP",
577 Self::ReasonToolCalls => "REASON_TOOL_CALLS",
578 Self::ReasonTimeLimit => "REASON_TIME_LIMIT",
579 }
580 }
581 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
583 match value {
584 "REASON_INVALID" => Some(Self::ReasonInvalid),
585 "REASON_MAX_LEN" => Some(Self::ReasonMaxLen),
586 "REASON_MAX_CONTEXT" => Some(Self::ReasonMaxContext),
587 "REASON_STOP" => Some(Self::ReasonStop),
588 "REASON_TOOL_CALLS" => Some(Self::ReasonToolCalls),
589 "REASON_TIME_LIMIT" => Some(Self::ReasonTimeLimit),
590 _ => None,
591 }
592 }
593}
594pub mod sample_client {
596 #![allow(
597 unused_variables,
598 dead_code,
599 missing_docs,
600 clippy::wildcard_imports,
601 clippy::let_unit_value,
602 )]
603 use tonic::codegen::*;
604 use tonic::codegen::http::Uri;
605 #[derive(Debug, Clone)]
607 pub struct SampleClient<T> {
608 inner: tonic::client::Grpc<T>,
609 }
610 impl SampleClient<tonic::transport::Channel> {
611 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
613 where
614 D: TryInto<tonic::transport::Endpoint>,
615 D::Error: Into<StdError>,
616 {
617 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
618 Ok(Self::new(conn))
619 }
620 }
621 impl<T> SampleClient<T>
622 where
623 T: tonic::client::GrpcService<tonic::body::Body>,
624 T::Error: Into<StdError>,
625 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
626 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
627 {
628 pub fn new(inner: T) -> Self {
629 let inner = tonic::client::Grpc::new(inner);
630 Self { inner }
631 }
632 pub fn with_origin(inner: T, origin: Uri) -> Self {
633 let inner = tonic::client::Grpc::with_origin(inner, origin);
634 Self { inner }
635 }
636 pub fn with_interceptor<F>(
637 inner: T,
638 interceptor: F,
639 ) -> SampleClient<InterceptedService<T, F>>
640 where
641 F: tonic::service::Interceptor,
642 T::ResponseBody: Default,
643 T: tonic::codegen::Service<
644 http::Request<tonic::body::Body>,
645 Response = http::Response<
646 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
647 >,
648 >,
649 <T as tonic::codegen::Service<
650 http::Request<tonic::body::Body>,
651 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
652 {
653 SampleClient::new(InterceptedService::new(inner, interceptor))
654 }
655 #[must_use]
660 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
661 self.inner = self.inner.send_compressed(encoding);
662 self
663 }
664 #[must_use]
666 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
667 self.inner = self.inner.accept_compressed(encoding);
668 self
669 }
670 #[must_use]
674 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
675 self.inner = self.inner.max_decoding_message_size(limit);
676 self
677 }
678 #[must_use]
682 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
683 self.inner = self.inner.max_encoding_message_size(limit);
684 self
685 }
686 pub async fn sample_text(
688 &mut self,
689 request: impl tonic::IntoRequest<super::SampleTextRequest>,
690 ) -> std::result::Result<
691 tonic::Response<super::SampleTextResponse>,
692 tonic::Status,
693 > {
694 self.inner
695 .ready()
696 .await
697 .map_err(|e| {
698 tonic::Status::unknown(
699 format!("Service was not ready: {}", e.into()),
700 )
701 })?;
702 let codec = tonic_prost::ProstCodec::default();
703 let path = http::uri::PathAndQuery::from_static(
704 "/xai_api.Sample/SampleText",
705 );
706 let mut req = request.into_request();
707 req.extensions_mut().insert(GrpcMethod::new("xai_api.Sample", "SampleText"));
708 self.inner.unary(req, path, codec).await
709 }
710 pub async fn sample_text_streaming(
712 &mut self,
713 request: impl tonic::IntoRequest<super::SampleTextRequest>,
714 ) -> std::result::Result<
715 tonic::Response<tonic::codec::Streaming<super::SampleTextResponse>>,
716 tonic::Status,
717 > {
718 self.inner
719 .ready()
720 .await
721 .map_err(|e| {
722 tonic::Status::unknown(
723 format!("Service was not ready: {}", e.into()),
724 )
725 })?;
726 let codec = tonic_prost::ProstCodec::default();
727 let path = http::uri::PathAndQuery::from_static(
728 "/xai_api.Sample/SampleTextStreaming",
729 );
730 let mut req = request.into_request();
731 req.extensions_mut()
732 .insert(GrpcMethod::new("xai_api.Sample", "SampleTextStreaming"));
733 self.inner.server_streaming(req, path, codec).await
734 }
735 }
736}
737#[derive(Clone, PartialEq, ::prost::Message)]
738pub struct GetCompletionsRequest {
739 #[prost(message, repeated, tag = "1")]
742 pub messages: ::prost::alloc::vec::Vec<Message>,
743 #[prost(string, tag = "2")]
746 pub model: ::prost::alloc::string::String,
747 #[prost(string, tag = "16")]
751 pub user: ::prost::alloc::string::String,
752 #[prost(int32, optional, tag = "8")]
757 pub n: ::core::option::Option<i32>,
758 #[prost(int32, optional, tag = "7")]
772 pub max_tokens: ::core::option::Option<i32>,
773 #[prost(int32, optional, tag = "11")]
779 pub seed: ::core::option::Option<i32>,
780 #[prost(string, repeated, tag = "12")]
792 pub stop: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
793 #[prost(float, optional, tag = "14")]
801 pub temperature: ::core::option::Option<f32>,
802 #[prost(float, optional, tag = "15")]
812 pub top_p: ::core::option::Option<f32>,
813 #[prost(bool, tag = "5")]
815 pub logprobs: bool,
816 #[prost(int32, optional, tag = "6")]
818 pub top_logprobs: ::core::option::Option<i32>,
819 #[prost(message, repeated, tag = "17")]
823 pub tools: ::prost::alloc::vec::Vec<Tool>,
824 #[prost(message, optional, tag = "18")]
826 pub tool_choice: ::core::option::Option<ToolChoice>,
827 #[prost(message, optional, tag = "10")]
829 pub response_format: ::core::option::Option<ResponseFormat>,
830 #[prost(float, optional, tag = "3")]
834 pub frequency_penalty: ::core::option::Option<f32>,
835 #[prost(float, optional, tag = "9")]
839 pub presence_penalty: ::core::option::Option<f32>,
840 #[prost(enumeration = "ReasoningEffort", optional, tag = "19")]
842 pub reasoning_effort: ::core::option::Option<i32>,
843 #[prost(message, optional, tag = "20")]
845 pub search_parameters: ::core::option::Option<SearchParameters>,
846 #[prost(bool, optional, tag = "21")]
848 pub parallel_tool_calls: ::core::option::Option<bool>,
849 #[prost(string, optional, tag = "22")]
851 pub previous_response_id: ::core::option::Option<::prost::alloc::string::String>,
852 #[prost(bool, tag = "23")]
854 pub store_messages: bool,
855 #[prost(bool, tag = "24")]
857 pub use_encrypted_content: bool,
858 #[prost(int32, optional, tag = "25")]
865 pub max_turns: ::core::option::Option<i32>,
866 #[prost(enumeration = "IncludeOption", repeated, tag = "26")]
868 pub include: ::prost::alloc::vec::Vec<i32>,
869}
870#[derive(Clone, PartialEq, ::prost::Message)]
871pub struct GetChatCompletionResponse {
872 #[prost(string, tag = "1")]
875 pub id: ::prost::alloc::string::String,
876 #[prost(message, repeated, tag = "2")]
880 pub outputs: ::prost::alloc::vec::Vec<CompletionOutput>,
881 #[prost(message, optional, tag = "5")]
884 pub created: ::core::option::Option<::prost_types::Timestamp>,
885 #[prost(string, tag = "6")]
890 pub model: ::prost::alloc::string::String,
891 #[prost(string, tag = "7")]
894 pub system_fingerprint: ::prost::alloc::string::String,
895 #[prost(message, optional, tag = "9")]
897 pub usage: ::core::option::Option<SamplingUsage>,
898 #[prost(string, repeated, tag = "10")]
901 pub citations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
902 #[prost(message, optional, tag = "11")]
904 pub settings: ::core::option::Option<RequestSettings>,
905 #[prost(message, optional, tag = "12")]
907 pub debug_output: ::core::option::Option<DebugOutput>,
908}
909#[derive(Clone, PartialEq, ::prost::Message)]
910pub struct GetChatCompletionChunk {
911 #[prost(string, tag = "1")]
914 pub id: ::prost::alloc::string::String,
915 #[prost(message, repeated, tag = "2")]
918 pub outputs: ::prost::alloc::vec::Vec<CompletionOutputChunk>,
919 #[prost(message, optional, tag = "3")]
922 pub created: ::core::option::Option<::prost_types::Timestamp>,
923 #[prost(string, tag = "4")]
928 pub model: ::prost::alloc::string::String,
929 #[prost(string, tag = "5")]
932 pub system_fingerprint: ::prost::alloc::string::String,
933 #[prost(message, optional, tag = "6")]
937 pub usage: ::core::option::Option<SamplingUsage>,
938 #[prost(string, repeated, tag = "7")]
941 pub citations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
942 #[prost(message, optional, tag = "10")]
944 pub debug_output: ::core::option::Option<DebugOutput>,
945}
946#[derive(Clone, PartialEq, ::prost::Message)]
949pub struct GetDeferredCompletionResponse {
950 #[prost(enumeration = "DeferredStatus", tag = "2")]
952 pub status: i32,
953 #[prost(message, optional, tag = "1")]
955 pub response: ::core::option::Option<GetChatCompletionResponse>,
956}
957#[derive(Clone, PartialEq, ::prost::Message)]
959pub struct CompletionOutput {
960 #[prost(enumeration = "FinishReason", tag = "1")]
962 pub finish_reason: i32,
963 #[prost(int32, tag = "2")]
966 pub index: i32,
967 #[prost(message, optional, tag = "3")]
969 pub message: ::core::option::Option<CompletionMessage>,
970 #[prost(message, optional, tag = "4")]
972 pub logprobs: ::core::option::Option<LogProbs>,
973}
974#[derive(Clone, PartialEq, ::prost::Message)]
976pub struct CompletionMessage {
977 #[prost(string, tag = "1")]
979 pub content: ::prost::alloc::string::String,
980 #[prost(string, tag = "4")]
982 pub reasoning_content: ::prost::alloc::string::String,
983 #[prost(enumeration = "MessageRole", tag = "2")]
985 pub role: i32,
986 #[prost(message, repeated, tag = "3")]
988 pub tool_calls: ::prost::alloc::vec::Vec<ToolCall>,
989 #[prost(string, tag = "5")]
991 pub encrypted_content: ::prost::alloc::string::String,
992 #[prost(message, repeated, tag = "6")]
994 pub citations: ::prost::alloc::vec::Vec<InlineCitation>,
995}
996#[derive(Clone, PartialEq, ::prost::Message)]
999pub struct CompletionOutputChunk {
1000 #[prost(message, optional, tag = "1")]
1002 pub delta: ::core::option::Option<Delta>,
1003 #[prost(message, optional, tag = "2")]
1005 pub logprobs: ::core::option::Option<LogProbs>,
1006 #[prost(enumeration = "FinishReason", tag = "3")]
1008 pub finish_reason: i32,
1009 #[prost(int32, tag = "4")]
1011 pub index: i32,
1012}
1013#[derive(Clone, PartialEq, ::prost::Message)]
1015pub struct Delta {
1016 #[prost(string, tag = "1")]
1018 pub content: ::prost::alloc::string::String,
1019 #[prost(string, tag = "4")]
1021 pub reasoning_content: ::prost::alloc::string::String,
1022 #[prost(enumeration = "MessageRole", tag = "2")]
1025 pub role: i32,
1026 #[prost(message, repeated, tag = "3")]
1028 pub tool_calls: ::prost::alloc::vec::Vec<ToolCall>,
1029 #[prost(string, tag = "5")]
1031 pub encrypted_content: ::prost::alloc::string::String,
1032 #[prost(message, repeated, tag = "6")]
1034 pub citations: ::prost::alloc::vec::Vec<InlineCitation>,
1035}
1036#[derive(Clone, PartialEq, ::prost::Message)]
1037pub struct InlineCitation {
1038 #[prost(string, tag = "1")]
1040 pub id: ::prost::alloc::string::String,
1041 #[prost(int32, tag = "2")]
1043 pub start_index: i32,
1044 #[prost(oneof = "inline_citation::Citation", tags = "3, 4, 5")]
1046 pub citation: ::core::option::Option<inline_citation::Citation>,
1047}
1048pub mod inline_citation {
1050 #[derive(Clone, PartialEq, ::prost::Oneof)]
1052 pub enum Citation {
1053 #[prost(message, tag = "3")]
1055 WebCitation(super::WebCitation),
1056 #[prost(message, tag = "4")]
1058 XCitation(super::XCitation),
1059 #[prost(message, tag = "5")]
1061 CollectionsCitation(super::CollectionsCitation),
1062 }
1063}
1064#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1065pub struct WebCitation {
1066 #[prost(string, tag = "1")]
1068 pub url: ::prost::alloc::string::String,
1069}
1070#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1071pub struct XCitation {
1072 #[prost(string, tag = "1")]
1075 pub url: ::prost::alloc::string::String,
1076}
1077#[derive(Clone, PartialEq, ::prost::Message)]
1078pub struct CollectionsCitation {
1079 #[prost(string, tag = "1")]
1081 pub file_id: ::prost::alloc::string::String,
1082 #[prost(string, tag = "2")]
1084 pub chunk_id: ::prost::alloc::string::String,
1085 #[prost(string, tag = "3")]
1087 pub chunk_content: ::prost::alloc::string::String,
1088 #[prost(float, tag = "4")]
1090 pub score: f32,
1091 #[prost(string, repeated, tag = "5")]
1093 pub collection_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1094}
1095#[derive(Clone, PartialEq, ::prost::Message)]
1097pub struct LogProbs {
1098 #[prost(message, repeated, tag = "1")]
1101 pub content: ::prost::alloc::vec::Vec<LogProb>,
1102}
1103#[derive(Clone, PartialEq, ::prost::Message)]
1106pub struct LogProb {
1107 #[prost(string, tag = "1")]
1109 pub token: ::prost::alloc::string::String,
1110 #[prost(float, tag = "2")]
1113 pub logprob: f32,
1114 #[prost(bytes = "vec", tag = "3")]
1117 pub bytes: ::prost::alloc::vec::Vec<u8>,
1118 #[prost(message, repeated, tag = "4")]
1121 pub top_logprobs: ::prost::alloc::vec::Vec<TopLogProb>,
1122}
1123#[derive(Clone, PartialEq, ::prost::Message)]
1126pub struct TopLogProb {
1127 #[prost(string, tag = "1")]
1129 pub token: ::prost::alloc::string::String,
1130 #[prost(float, tag = "2")]
1132 pub logprob: f32,
1133 #[prost(bytes = "vec", tag = "3")]
1135 pub bytes: ::prost::alloc::vec::Vec<u8>,
1136}
1137#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1139pub struct Content {
1140 #[prost(oneof = "content::Content", tags = "1, 2, 3")]
1141 pub content: ::core::option::Option<content::Content>,
1142}
1143pub mod content {
1145 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
1146 pub enum Content {
1147 #[prost(string, tag = "1")]
1149 Text(::prost::alloc::string::String),
1150 #[prost(message, tag = "2")]
1152 ImageUrl(super::ImageUrlContent),
1153 #[prost(message, tag = "3")]
1155 File(super::FileContent),
1156 }
1157}
1158#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1160pub struct FileContent {
1161 #[prost(string, tag = "1")]
1164 pub file_id: ::prost::alloc::string::String,
1165}
1166#[derive(Clone, PartialEq, ::prost::Message)]
1171pub struct Message {
1172 #[prost(message, repeated, tag = "1")]
1176 pub content: ::prost::alloc::vec::Vec<Content>,
1177 #[prost(string, optional, tag = "5")]
1179 pub reasoning_content: ::core::option::Option<::prost::alloc::string::String>,
1180 #[prost(enumeration = "MessageRole", tag = "2")]
1183 pub role: i32,
1184 #[prost(string, tag = "3")]
1187 pub name: ::prost::alloc::string::String,
1188 #[prost(message, repeated, tag = "4")]
1190 pub tool_calls: ::prost::alloc::vec::Vec<ToolCall>,
1191 #[prost(string, tag = "6")]
1193 pub encrypted_content: ::prost::alloc::string::String,
1194}
1195#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1196pub struct ToolChoice {
1197 #[prost(oneof = "tool_choice::ToolChoice", tags = "1, 2")]
1198 pub tool_choice: ::core::option::Option<tool_choice::ToolChoice>,
1199}
1200pub mod tool_choice {
1202 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
1203 pub enum ToolChoice {
1204 #[prost(enumeration = "super::ToolMode", tag = "1")]
1206 Mode(i32),
1207 #[prost(string, tag = "2")]
1209 FunctionName(::prost::alloc::string::String),
1210 }
1211}
1212#[derive(Clone, PartialEq, ::prost::Message)]
1213pub struct Tool {
1214 #[prost(oneof = "tool::Tool", tags = "1, 3, 4, 5, 6, 7, 8")]
1215 pub tool: ::core::option::Option<tool::Tool>,
1216}
1217pub mod tool {
1219 #[derive(Clone, PartialEq, ::prost::Oneof)]
1220 pub enum Tool {
1221 #[prost(message, tag = "1")]
1223 Function(super::Function),
1224 #[prost(message, tag = "3")]
1226 WebSearch(super::WebSearch),
1227 #[prost(message, tag = "4")]
1229 XSearch(super::XSearch),
1230 #[prost(message, tag = "5")]
1232 CodeExecution(super::CodeExecution),
1233 #[prost(message, tag = "6")]
1235 CollectionsSearch(super::CollectionsSearch),
1236 #[prost(message, tag = "7")]
1238 Mcp(super::Mcp),
1239 #[prost(message, tag = "8")]
1241 DocumentSearch(super::DocumentSearch),
1242 }
1243}
1244#[derive(Clone, PartialEq, ::prost::Message)]
1245pub struct Mcp {
1246 #[prost(string, tag = "1")]
1248 pub server_label: ::prost::alloc::string::String,
1249 #[prost(string, tag = "2")]
1251 pub server_description: ::prost::alloc::string::String,
1252 #[prost(string, tag = "3")]
1254 pub server_url: ::prost::alloc::string::String,
1255 #[prost(string, repeated, tag = "4")]
1257 pub allowed_tool_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1258 #[prost(string, optional, tag = "5")]
1260 pub authorization: ::core::option::Option<::prost::alloc::string::String>,
1261 #[prost(map = "string, string", tag = "6")]
1263 pub extra_headers: ::std::collections::HashMap<
1264 ::prost::alloc::string::String,
1265 ::prost::alloc::string::String,
1266 >,
1267}
1268#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1269pub struct WebSearch {
1270 #[prost(string, repeated, tag = "1")]
1274 pub excluded_domains: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1275 #[prost(string, repeated, tag = "2")]
1282 pub allowed_domains: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1283 #[prost(bool, optional, tag = "3")]
1286 pub enable_image_understanding: ::core::option::Option<bool>,
1287}
1288#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1289pub struct XSearch {
1290 #[prost(message, optional, tag = "1")]
1294 pub from_date: ::core::option::Option<::prost_types::Timestamp>,
1295 #[prost(message, optional, tag = "2")]
1299 pub to_date: ::core::option::Option<::prost_types::Timestamp>,
1300 #[prost(string, repeated, tag = "3")]
1306 pub allowed_x_handles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1307 #[prost(string, repeated, tag = "4")]
1312 pub excluded_x_handles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1313 #[prost(bool, optional, tag = "5")]
1316 pub enable_image_understanding: ::core::option::Option<bool>,
1317 #[prost(bool, optional, tag = "6")]
1320 pub enable_video_understanding: ::core::option::Option<bool>,
1321}
1322#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1323pub struct CodeExecution {}
1324#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1325pub struct CollectionsSearch {
1326 #[prost(string, repeated, tag = "1")]
1329 pub collection_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1330 #[prost(int32, optional, tag = "2")]
1333 pub limit: ::core::option::Option<i32>,
1334}
1335#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1336pub struct DocumentSearch {
1337 #[prost(int32, optional, tag = "2")]
1339 pub limit: ::core::option::Option<i32>,
1340}
1341#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1342pub struct Function {
1343 #[prost(string, tag = "1")]
1345 pub name: ::prost::alloc::string::String,
1346 #[prost(string, tag = "2")]
1348 pub description: ::prost::alloc::string::String,
1349 #[prost(bool, tag = "3")]
1351 pub strict: bool,
1352 #[prost(string, tag = "4")]
1354 pub parameters: ::prost::alloc::string::String,
1355}
1356#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1358pub struct ToolCall {
1359 #[prost(string, tag = "1")]
1361 pub id: ::prost::alloc::string::String,
1362 #[prost(enumeration = "ToolCallType", tag = "2")]
1365 pub r#type: i32,
1366 #[prost(enumeration = "ToolCallStatus", tag = "3")]
1368 pub status: i32,
1369 #[prost(string, optional, tag = "4")]
1371 pub error_message: ::core::option::Option<::prost::alloc::string::String>,
1372 #[prost(oneof = "tool_call::Tool", tags = "10")]
1374 pub tool: ::core::option::Option<tool_call::Tool>,
1375}
1376pub mod tool_call {
1378 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
1380 pub enum Tool {
1381 #[prost(message, tag = "10")]
1382 Function(super::FunctionCall),
1383 }
1384}
1385#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1387pub struct FunctionCall {
1388 #[prost(string, tag = "1")]
1390 pub name: ::prost::alloc::string::String,
1391 #[prost(string, tag = "2")]
1393 pub arguments: ::prost::alloc::string::String,
1394}
1395#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1397pub struct ResponseFormat {
1398 #[prost(enumeration = "FormatType", tag = "1")]
1400 pub format_type: i32,
1401 #[prost(string, optional, tag = "2")]
1404 pub schema: ::core::option::Option<::prost::alloc::string::String>,
1405}
1406#[derive(Clone, PartialEq, ::prost::Message)]
1413pub struct SearchParameters {
1414 #[prost(enumeration = "SearchMode", tag = "1")]
1420 pub mode: i32,
1421 #[prost(message, repeated, tag = "9")]
1425 pub sources: ::prost::alloc::vec::Vec<Source>,
1426 #[prost(message, optional, tag = "4")]
1430 pub from_date: ::core::option::Option<::prost_types::Timestamp>,
1431 #[prost(message, optional, tag = "5")]
1435 pub to_date: ::core::option::Option<::prost_types::Timestamp>,
1436 #[prost(bool, tag = "7")]
1439 pub return_citations: bool,
1440 #[prost(int32, optional, tag = "8")]
1443 pub max_search_results: ::core::option::Option<i32>,
1444}
1445#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1449pub struct Source {
1450 #[prost(oneof = "source::Source", tags = "1, 2, 3, 4")]
1451 pub source: ::core::option::Option<source::Source>,
1452}
1453pub mod source {
1455 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
1456 pub enum Source {
1457 #[prost(message, tag = "1")]
1460 Web(super::WebSource),
1461 #[prost(message, tag = "2")]
1464 News(super::NewsSource),
1465 #[prost(message, tag = "3")]
1468 X(super::XSource),
1469 #[prost(message, tag = "4")]
1472 Rss(super::RssSource),
1473 }
1474}
1475#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1481pub struct WebSource {
1482 #[prost(string, repeated, tag = "2")]
1486 pub excluded_websites: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1487 #[prost(string, repeated, tag = "5")]
1494 pub allowed_websites: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1495 #[prost(string, optional, tag = "3")]
1499 pub country: ::core::option::Option<::prost::alloc::string::String>,
1500 #[prost(bool, tag = "4")]
1502 pub safe_search: bool,
1503}
1504#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1509pub struct NewsSource {
1510 #[prost(string, repeated, tag = "2")]
1514 pub excluded_websites: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1515 #[prost(string, optional, tag = "3")]
1519 pub country: ::core::option::Option<::prost::alloc::string::String>,
1520 #[prost(bool, tag = "4")]
1522 pub safe_search: bool,
1523}
1524#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1529pub struct XSource {
1530 #[prost(string, repeated, tag = "7")]
1536 pub included_x_handles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1537 #[prost(string, repeated, tag = "8")]
1542 pub excluded_x_handles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1543 #[prost(int32, optional, tag = "9")]
1546 pub post_favorite_count: ::core::option::Option<i32>,
1547 #[prost(int32, optional, tag = "10")]
1550 pub post_view_count: ::core::option::Option<i32>,
1551}
1552#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1557pub struct RssSource {
1558 #[prost(string, repeated, tag = "1")]
1561 pub links: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1562}
1563#[derive(Clone, PartialEq, ::prost::Message)]
1564pub struct RequestSettings {
1565 #[prost(int32, optional, tag = "1")]
1567 pub max_tokens: ::core::option::Option<i32>,
1568 #[prost(bool, tag = "2")]
1570 pub parallel_tool_calls: bool,
1571 #[prost(string, optional, tag = "3")]
1573 pub previous_response_id: ::core::option::Option<::prost::alloc::string::String>,
1574 #[prost(enumeration = "ReasoningEffort", optional, tag = "4")]
1576 pub reasoning_effort: ::core::option::Option<i32>,
1577 #[prost(float, optional, tag = "5")]
1585 pub temperature: ::core::option::Option<f32>,
1586 #[prost(message, optional, tag = "6")]
1588 pub response_format: ::core::option::Option<ResponseFormat>,
1589 #[prost(message, optional, tag = "7")]
1591 pub tool_choice: ::core::option::Option<ToolChoice>,
1592 #[prost(message, repeated, tag = "8")]
1596 pub tools: ::prost::alloc::vec::Vec<Tool>,
1597 #[prost(float, optional, tag = "9")]
1607 pub top_p: ::core::option::Option<f32>,
1608 #[prost(string, tag = "10")]
1612 pub user: ::prost::alloc::string::String,
1613 #[prost(message, optional, tag = "11")]
1615 pub search_parameters: ::core::option::Option<SearchParameters>,
1616 #[prost(bool, tag = "12")]
1618 pub store_messages: bool,
1619 #[prost(bool, tag = "13")]
1621 pub use_encrypted_content: bool,
1622 #[prost(enumeration = "IncludeOption", repeated, tag = "14")]
1624 pub include: ::prost::alloc::vec::Vec<i32>,
1625}
1626#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1628pub struct GetStoredCompletionRequest {
1629 #[prost(string, tag = "1")]
1631 pub response_id: ::prost::alloc::string::String,
1632}
1633#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1635pub struct DeleteStoredCompletionRequest {
1636 #[prost(string, tag = "1")]
1638 pub response_id: ::prost::alloc::string::String,
1639}
1640#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1642pub struct DeleteStoredCompletionResponse {
1643 #[prost(string, tag = "1")]
1645 pub response_id: ::prost::alloc::string::String,
1646}
1647#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1649pub struct DebugOutput {
1650 #[prost(int32, tag = "1")]
1652 pub attempts: i32,
1653 #[prost(string, tag = "2")]
1655 pub request: ::prost::alloc::string::String,
1656 #[prost(string, tag = "3")]
1658 pub prompt: ::prost::alloc::string::String,
1659 #[prost(string, tag = "9")]
1661 pub engine_request: ::prost::alloc::string::String,
1662 #[prost(string, repeated, tag = "4")]
1664 pub responses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1665 #[prost(string, repeated, tag = "12")]
1667 pub chunks: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1668 #[prost(uint32, tag = "5")]
1670 pub cache_read_count: u32,
1671 #[prost(uint64, tag = "6")]
1673 pub cache_read_input_bytes: u64,
1674 #[prost(uint32, tag = "7")]
1676 pub cache_write_count: u32,
1677 #[prost(uint64, tag = "8")]
1679 pub cache_write_input_bytes: u64,
1680 #[prost(string, tag = "10")]
1682 pub lb_address: ::prost::alloc::string::String,
1683 #[prost(string, tag = "11")]
1685 pub sampler_tag: ::prost::alloc::string::String,
1686}
1687#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1688#[repr(i32)]
1689pub enum IncludeOption {
1690 Invalid = 0,
1692 WebSearchCallOutput = 1,
1694 XSearchCallOutput = 2,
1696 CodeExecutionCallOutput = 3,
1698 CollectionsSearchCallOutput = 4,
1700 DocumentSearchCallOutput = 5,
1702 McpCallOutput = 6,
1704 InlineCitations = 7,
1706}
1707impl IncludeOption {
1708 pub fn as_str_name(&self) -> &'static str {
1713 match self {
1714 Self::Invalid => "INCLUDE_OPTION_INVALID",
1715 Self::WebSearchCallOutput => "INCLUDE_OPTION_WEB_SEARCH_CALL_OUTPUT",
1716 Self::XSearchCallOutput => "INCLUDE_OPTION_X_SEARCH_CALL_OUTPUT",
1717 Self::CodeExecutionCallOutput => "INCLUDE_OPTION_CODE_EXECUTION_CALL_OUTPUT",
1718 Self::CollectionsSearchCallOutput => {
1719 "INCLUDE_OPTION_COLLECTIONS_SEARCH_CALL_OUTPUT"
1720 }
1721 Self::DocumentSearchCallOutput => {
1722 "INCLUDE_OPTION_DOCUMENT_SEARCH_CALL_OUTPUT"
1723 }
1724 Self::McpCallOutput => "INCLUDE_OPTION_MCP_CALL_OUTPUT",
1725 Self::InlineCitations => "INCLUDE_OPTION_INLINE_CITATIONS",
1726 }
1727 }
1728 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1730 match value {
1731 "INCLUDE_OPTION_INVALID" => Some(Self::Invalid),
1732 "INCLUDE_OPTION_WEB_SEARCH_CALL_OUTPUT" => Some(Self::WebSearchCallOutput),
1733 "INCLUDE_OPTION_X_SEARCH_CALL_OUTPUT" => Some(Self::XSearchCallOutput),
1734 "INCLUDE_OPTION_CODE_EXECUTION_CALL_OUTPUT" => {
1735 Some(Self::CodeExecutionCallOutput)
1736 }
1737 "INCLUDE_OPTION_COLLECTIONS_SEARCH_CALL_OUTPUT" => {
1738 Some(Self::CollectionsSearchCallOutput)
1739 }
1740 "INCLUDE_OPTION_DOCUMENT_SEARCH_CALL_OUTPUT" => {
1741 Some(Self::DocumentSearchCallOutput)
1742 }
1743 "INCLUDE_OPTION_MCP_CALL_OUTPUT" => Some(Self::McpCallOutput),
1744 "INCLUDE_OPTION_INLINE_CITATIONS" => Some(Self::InlineCitations),
1745 _ => None,
1746 }
1747 }
1748}
1749#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1750#[repr(i32)]
1751pub enum MessageRole {
1752 InvalidRole = 0,
1754 RoleUser = 1,
1756 RoleAssistant = 2,
1758 RoleSystem = 3,
1760 RoleFunction = 4,
1762 RoleTool = 5,
1764}
1765impl MessageRole {
1766 pub fn as_str_name(&self) -> &'static str {
1771 match self {
1772 Self::InvalidRole => "INVALID_ROLE",
1773 Self::RoleUser => "ROLE_USER",
1774 Self::RoleAssistant => "ROLE_ASSISTANT",
1775 Self::RoleSystem => "ROLE_SYSTEM",
1776 Self::RoleFunction => "ROLE_FUNCTION",
1777 Self::RoleTool => "ROLE_TOOL",
1778 }
1779 }
1780 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1782 match value {
1783 "INVALID_ROLE" => Some(Self::InvalidRole),
1784 "ROLE_USER" => Some(Self::RoleUser),
1785 "ROLE_ASSISTANT" => Some(Self::RoleAssistant),
1786 "ROLE_SYSTEM" => Some(Self::RoleSystem),
1787 "ROLE_FUNCTION" => Some(Self::RoleFunction),
1788 "ROLE_TOOL" => Some(Self::RoleTool),
1789 _ => None,
1790 }
1791 }
1792}
1793#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1794#[repr(i32)]
1795pub enum ReasoningEffort {
1796 InvalidEffort = 0,
1797 EffortLow = 1,
1798 EffortMedium = 2,
1799 EffortHigh = 3,
1800}
1801impl ReasoningEffort {
1802 pub fn as_str_name(&self) -> &'static str {
1807 match self {
1808 Self::InvalidEffort => "INVALID_EFFORT",
1809 Self::EffortLow => "EFFORT_LOW",
1810 Self::EffortMedium => "EFFORT_MEDIUM",
1811 Self::EffortHigh => "EFFORT_HIGH",
1812 }
1813 }
1814 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1816 match value {
1817 "INVALID_EFFORT" => Some(Self::InvalidEffort),
1818 "EFFORT_LOW" => Some(Self::EffortLow),
1819 "EFFORT_MEDIUM" => Some(Self::EffortMedium),
1820 "EFFORT_HIGH" => Some(Self::EffortHigh),
1821 _ => None,
1822 }
1823 }
1824}
1825#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1826#[repr(i32)]
1827pub enum ToolMode {
1828 Invalid = 0,
1830 Auto = 1,
1832 None = 2,
1834 Required = 3,
1836}
1837impl ToolMode {
1838 pub fn as_str_name(&self) -> &'static str {
1843 match self {
1844 Self::Invalid => "TOOL_MODE_INVALID",
1845 Self::Auto => "TOOL_MODE_AUTO",
1846 Self::None => "TOOL_MODE_NONE",
1847 Self::Required => "TOOL_MODE_REQUIRED",
1848 }
1849 }
1850 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1852 match value {
1853 "TOOL_MODE_INVALID" => Some(Self::Invalid),
1854 "TOOL_MODE_AUTO" => Some(Self::Auto),
1855 "TOOL_MODE_NONE" => Some(Self::None),
1856 "TOOL_MODE_REQUIRED" => Some(Self::Required),
1857 _ => None,
1858 }
1859 }
1860}
1861#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1862#[repr(i32)]
1863pub enum FormatType {
1864 Invalid = 0,
1866 Text = 1,
1868 JsonObject = 2,
1870 JsonSchema = 3,
1872}
1873impl FormatType {
1874 pub fn as_str_name(&self) -> &'static str {
1879 match self {
1880 Self::Invalid => "FORMAT_TYPE_INVALID",
1881 Self::Text => "FORMAT_TYPE_TEXT",
1882 Self::JsonObject => "FORMAT_TYPE_JSON_OBJECT",
1883 Self::JsonSchema => "FORMAT_TYPE_JSON_SCHEMA",
1884 }
1885 }
1886 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1888 match value {
1889 "FORMAT_TYPE_INVALID" => Some(Self::Invalid),
1890 "FORMAT_TYPE_TEXT" => Some(Self::Text),
1891 "FORMAT_TYPE_JSON_OBJECT" => Some(Self::JsonObject),
1892 "FORMAT_TYPE_JSON_SCHEMA" => Some(Self::JsonSchema),
1893 _ => None,
1894 }
1895 }
1896}
1897#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1898#[repr(i32)]
1899pub enum ToolCallType {
1900 Invalid = 0,
1901 ClientSideTool = 1,
1904 WebSearchTool = 2,
1907 XSearchTool = 3,
1910 CodeExecutionTool = 4,
1913 CollectionsSearchTool = 5,
1916 McpTool = 6,
1919 DocumentSearchTool = 7,
1921}
1922impl ToolCallType {
1923 pub fn as_str_name(&self) -> &'static str {
1928 match self {
1929 Self::Invalid => "TOOL_CALL_TYPE_INVALID",
1930 Self::ClientSideTool => "TOOL_CALL_TYPE_CLIENT_SIDE_TOOL",
1931 Self::WebSearchTool => "TOOL_CALL_TYPE_WEB_SEARCH_TOOL",
1932 Self::XSearchTool => "TOOL_CALL_TYPE_X_SEARCH_TOOL",
1933 Self::CodeExecutionTool => "TOOL_CALL_TYPE_CODE_EXECUTION_TOOL",
1934 Self::CollectionsSearchTool => "TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL",
1935 Self::McpTool => "TOOL_CALL_TYPE_MCP_TOOL",
1936 Self::DocumentSearchTool => "TOOL_CALL_TYPE_DOCUMENT_SEARCH_TOOL",
1937 }
1938 }
1939 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1941 match value {
1942 "TOOL_CALL_TYPE_INVALID" => Some(Self::Invalid),
1943 "TOOL_CALL_TYPE_CLIENT_SIDE_TOOL" => Some(Self::ClientSideTool),
1944 "TOOL_CALL_TYPE_WEB_SEARCH_TOOL" => Some(Self::WebSearchTool),
1945 "TOOL_CALL_TYPE_X_SEARCH_TOOL" => Some(Self::XSearchTool),
1946 "TOOL_CALL_TYPE_CODE_EXECUTION_TOOL" => Some(Self::CodeExecutionTool),
1947 "TOOL_CALL_TYPE_COLLECTIONS_SEARCH_TOOL" => Some(Self::CollectionsSearchTool),
1948 "TOOL_CALL_TYPE_MCP_TOOL" => Some(Self::McpTool),
1949 "TOOL_CALL_TYPE_DOCUMENT_SEARCH_TOOL" => Some(Self::DocumentSearchTool),
1950 _ => None,
1951 }
1952 }
1953}
1954#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1955#[repr(i32)]
1956pub enum ToolCallStatus {
1957 InProgress = 0,
1959 Completed = 1,
1961 Incomplete = 2,
1963 Failed = 3,
1965}
1966impl ToolCallStatus {
1967 pub fn as_str_name(&self) -> &'static str {
1972 match self {
1973 Self::InProgress => "TOOL_CALL_STATUS_IN_PROGRESS",
1974 Self::Completed => "TOOL_CALL_STATUS_COMPLETED",
1975 Self::Incomplete => "TOOL_CALL_STATUS_INCOMPLETE",
1976 Self::Failed => "TOOL_CALL_STATUS_FAILED",
1977 }
1978 }
1979 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1981 match value {
1982 "TOOL_CALL_STATUS_IN_PROGRESS" => Some(Self::InProgress),
1983 "TOOL_CALL_STATUS_COMPLETED" => Some(Self::Completed),
1984 "TOOL_CALL_STATUS_INCOMPLETE" => Some(Self::Incomplete),
1985 "TOOL_CALL_STATUS_FAILED" => Some(Self::Failed),
1986 _ => None,
1987 }
1988 }
1989}
1990#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1992#[repr(i32)]
1993pub enum SearchMode {
1994 InvalidSearchMode = 0,
1995 OffSearchMode = 1,
1996 OnSearchMode = 2,
1997 AutoSearchMode = 3,
1998}
1999impl SearchMode {
2000 pub fn as_str_name(&self) -> &'static str {
2005 match self {
2006 Self::InvalidSearchMode => "INVALID_SEARCH_MODE",
2007 Self::OffSearchMode => "OFF_SEARCH_MODE",
2008 Self::OnSearchMode => "ON_SEARCH_MODE",
2009 Self::AutoSearchMode => "AUTO_SEARCH_MODE",
2010 }
2011 }
2012 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2014 match value {
2015 "INVALID_SEARCH_MODE" => Some(Self::InvalidSearchMode),
2016 "OFF_SEARCH_MODE" => Some(Self::OffSearchMode),
2017 "ON_SEARCH_MODE" => Some(Self::OnSearchMode),
2018 "AUTO_SEARCH_MODE" => Some(Self::AutoSearchMode),
2019 _ => None,
2020 }
2021 }
2022}
2023pub mod chat_client {
2025 #![allow(
2026 unused_variables,
2027 dead_code,
2028 missing_docs,
2029 clippy::wildcard_imports,
2030 clippy::let_unit_value,
2031 )]
2032 use tonic::codegen::*;
2033 use tonic::codegen::http::Uri;
2034 #[derive(Debug, Clone)]
2036 pub struct ChatClient<T> {
2037 inner: tonic::client::Grpc<T>,
2038 }
2039 impl ChatClient<tonic::transport::Channel> {
2040 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2042 where
2043 D: TryInto<tonic::transport::Endpoint>,
2044 D::Error: Into<StdError>,
2045 {
2046 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2047 Ok(Self::new(conn))
2048 }
2049 }
2050 impl<T> ChatClient<T>
2051 where
2052 T: tonic::client::GrpcService<tonic::body::Body>,
2053 T::Error: Into<StdError>,
2054 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2055 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2056 {
2057 pub fn new(inner: T) -> Self {
2058 let inner = tonic::client::Grpc::new(inner);
2059 Self { inner }
2060 }
2061 pub fn with_origin(inner: T, origin: Uri) -> Self {
2062 let inner = tonic::client::Grpc::with_origin(inner, origin);
2063 Self { inner }
2064 }
2065 pub fn with_interceptor<F>(
2066 inner: T,
2067 interceptor: F,
2068 ) -> ChatClient<InterceptedService<T, F>>
2069 where
2070 F: tonic::service::Interceptor,
2071 T::ResponseBody: Default,
2072 T: tonic::codegen::Service<
2073 http::Request<tonic::body::Body>,
2074 Response = http::Response<
2075 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2076 >,
2077 >,
2078 <T as tonic::codegen::Service<
2079 http::Request<tonic::body::Body>,
2080 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2081 {
2082 ChatClient::new(InterceptedService::new(inner, interceptor))
2083 }
2084 #[must_use]
2089 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2090 self.inner = self.inner.send_compressed(encoding);
2091 self
2092 }
2093 #[must_use]
2095 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2096 self.inner = self.inner.accept_compressed(encoding);
2097 self
2098 }
2099 #[must_use]
2103 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2104 self.inner = self.inner.max_decoding_message_size(limit);
2105 self
2106 }
2107 #[must_use]
2111 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2112 self.inner = self.inner.max_encoding_message_size(limit);
2113 self
2114 }
2115 pub async fn get_completion(
2118 &mut self,
2119 request: impl tonic::IntoRequest<super::GetCompletionsRequest>,
2120 ) -> std::result::Result<
2121 tonic::Response<super::GetChatCompletionResponse>,
2122 tonic::Status,
2123 > {
2124 self.inner
2125 .ready()
2126 .await
2127 .map_err(|e| {
2128 tonic::Status::unknown(
2129 format!("Service was not ready: {}", e.into()),
2130 )
2131 })?;
2132 let codec = tonic_prost::ProstCodec::default();
2133 let path = http::uri::PathAndQuery::from_static(
2134 "/xai_api.Chat/GetCompletion",
2135 );
2136 let mut req = request.into_request();
2137 req.extensions_mut()
2138 .insert(GrpcMethod::new("xai_api.Chat", "GetCompletion"));
2139 self.inner.unary(req, path, codec).await
2140 }
2141 pub async fn get_completion_chunk(
2144 &mut self,
2145 request: impl tonic::IntoRequest<super::GetCompletionsRequest>,
2146 ) -> std::result::Result<
2147 tonic::Response<tonic::codec::Streaming<super::GetChatCompletionChunk>>,
2148 tonic::Status,
2149 > {
2150 self.inner
2151 .ready()
2152 .await
2153 .map_err(|e| {
2154 tonic::Status::unknown(
2155 format!("Service was not ready: {}", e.into()),
2156 )
2157 })?;
2158 let codec = tonic_prost::ProstCodec::default();
2159 let path = http::uri::PathAndQuery::from_static(
2160 "/xai_api.Chat/GetCompletionChunk",
2161 );
2162 let mut req = request.into_request();
2163 req.extensions_mut()
2164 .insert(GrpcMethod::new("xai_api.Chat", "GetCompletionChunk"));
2165 self.inner.server_streaming(req, path, codec).await
2166 }
2167 pub async fn start_deferred_completion(
2171 &mut self,
2172 request: impl tonic::IntoRequest<super::GetCompletionsRequest>,
2173 ) -> std::result::Result<
2174 tonic::Response<super::StartDeferredResponse>,
2175 tonic::Status,
2176 > {
2177 self.inner
2178 .ready()
2179 .await
2180 .map_err(|e| {
2181 tonic::Status::unknown(
2182 format!("Service was not ready: {}", e.into()),
2183 )
2184 })?;
2185 let codec = tonic_prost::ProstCodec::default();
2186 let path = http::uri::PathAndQuery::from_static(
2187 "/xai_api.Chat/StartDeferredCompletion",
2188 );
2189 let mut req = request.into_request();
2190 req.extensions_mut()
2191 .insert(GrpcMethod::new("xai_api.Chat", "StartDeferredCompletion"));
2192 self.inner.unary(req, path, codec).await
2193 }
2194 pub async fn get_deferred_completion(
2196 &mut self,
2197 request: impl tonic::IntoRequest<super::GetDeferredRequest>,
2198 ) -> std::result::Result<
2199 tonic::Response<super::GetDeferredCompletionResponse>,
2200 tonic::Status,
2201 > {
2202 self.inner
2203 .ready()
2204 .await
2205 .map_err(|e| {
2206 tonic::Status::unknown(
2207 format!("Service was not ready: {}", e.into()),
2208 )
2209 })?;
2210 let codec = tonic_prost::ProstCodec::default();
2211 let path = http::uri::PathAndQuery::from_static(
2212 "/xai_api.Chat/GetDeferredCompletion",
2213 );
2214 let mut req = request.into_request();
2215 req.extensions_mut()
2216 .insert(GrpcMethod::new("xai_api.Chat", "GetDeferredCompletion"));
2217 self.inner.unary(req, path, codec).await
2218 }
2219 pub async fn get_stored_completion(
2221 &mut self,
2222 request: impl tonic::IntoRequest<super::GetStoredCompletionRequest>,
2223 ) -> std::result::Result<
2224 tonic::Response<super::GetChatCompletionResponse>,
2225 tonic::Status,
2226 > {
2227 self.inner
2228 .ready()
2229 .await
2230 .map_err(|e| {
2231 tonic::Status::unknown(
2232 format!("Service was not ready: {}", e.into()),
2233 )
2234 })?;
2235 let codec = tonic_prost::ProstCodec::default();
2236 let path = http::uri::PathAndQuery::from_static(
2237 "/xai_api.Chat/GetStoredCompletion",
2238 );
2239 let mut req = request.into_request();
2240 req.extensions_mut()
2241 .insert(GrpcMethod::new("xai_api.Chat", "GetStoredCompletion"));
2242 self.inner.unary(req, path, codec).await
2243 }
2244 pub async fn delete_stored_completion(
2246 &mut self,
2247 request: impl tonic::IntoRequest<super::DeleteStoredCompletionRequest>,
2248 ) -> std::result::Result<
2249 tonic::Response<super::DeleteStoredCompletionResponse>,
2250 tonic::Status,
2251 > {
2252 self.inner
2253 .ready()
2254 .await
2255 .map_err(|e| {
2256 tonic::Status::unknown(
2257 format!("Service was not ready: {}", e.into()),
2258 )
2259 })?;
2260 let codec = tonic_prost::ProstCodec::default();
2261 let path = http::uri::PathAndQuery::from_static(
2262 "/xai_api.Chat/DeleteStoredCompletion",
2263 );
2264 let mut req = request.into_request();
2265 req.extensions_mut()
2266 .insert(GrpcMethod::new("xai_api.Chat", "DeleteStoredCompletion"));
2267 self.inner.unary(req, path, codec).await
2268 }
2269 }
2270}
2271#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2273pub struct GetModelRequest {
2274 #[prost(string, tag = "1")]
2276 pub name: ::prost::alloc::string::String,
2277}
2278#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2280pub struct LanguageModel {
2281 #[prost(string, tag = "1")]
2283 pub name: ::prost::alloc::string::String,
2284 #[prost(string, repeated, tag = "11")]
2287 pub aliases: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2288 #[prost(string, tag = "2")]
2291 pub version: ::prost::alloc::string::String,
2292 #[prost(enumeration = "Modality", repeated, tag = "3")]
2294 pub input_modalities: ::prost::alloc::vec::Vec<i32>,
2295 #[prost(enumeration = "Modality", repeated, tag = "4")]
2297 pub output_modalities: ::prost::alloc::vec::Vec<i32>,
2298 #[prost(int64, tag = "5")]
2300 pub prompt_text_token_price: i64,
2301 #[prost(int64, tag = "6")]
2303 pub prompt_image_token_price: i64,
2304 #[prost(int64, tag = "12")]
2306 pub cached_prompt_token_price: i64,
2307 #[prost(int64, tag = "7")]
2309 pub completion_text_token_price: i64,
2310 #[prost(int64, tag = "13")]
2312 pub search_price: i64,
2313 #[prost(message, optional, tag = "8")]
2315 pub created: ::core::option::Option<::prost_types::Timestamp>,
2316 #[prost(int32, tag = "9")]
2319 pub max_prompt_length: i32,
2320 #[prost(string, tag = "10")]
2322 pub system_fingerprint: ::prost::alloc::string::String,
2323}
2324#[derive(Clone, PartialEq, ::prost::Message)]
2326pub struct ListLanguageModelsResponse {
2327 #[prost(message, repeated, tag = "1")]
2329 pub models: ::prost::alloc::vec::Vec<LanguageModel>,
2330}
2331#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2333pub struct EmbeddingModel {
2334 #[prost(string, tag = "1")]
2336 pub name: ::prost::alloc::string::String,
2337 #[prost(string, repeated, tag = "11")]
2340 pub aliases: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2341 #[prost(string, tag = "2")]
2344 pub version: ::prost::alloc::string::String,
2345 #[prost(enumeration = "Modality", repeated, tag = "3")]
2347 pub input_modalities: ::prost::alloc::vec::Vec<i32>,
2348 #[prost(enumeration = "Modality", repeated, tag = "4")]
2350 pub output_modalities: ::prost::alloc::vec::Vec<i32>,
2351 #[prost(int64, tag = "5")]
2353 pub prompt_text_token_price: i64,
2354 #[prost(int64, tag = "6")]
2356 pub prompt_image_token_price: i64,
2357 #[prost(message, optional, tag = "7")]
2359 pub created: ::core::option::Option<::prost_types::Timestamp>,
2360 #[prost(string, tag = "8")]
2362 pub system_fingerprint: ::prost::alloc::string::String,
2363}
2364#[derive(Clone, PartialEq, ::prost::Message)]
2366pub struct ListEmbeddingModelsResponse {
2367 #[prost(message, repeated, tag = "1")]
2369 pub models: ::prost::alloc::vec::Vec<EmbeddingModel>,
2370}
2371#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2373pub struct ImageGenerationModel {
2374 #[prost(string, tag = "1")]
2376 pub name: ::prost::alloc::string::String,
2377 #[prost(string, repeated, tag = "11")]
2380 pub aliases: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
2381 #[prost(string, tag = "2")]
2384 pub version: ::prost::alloc::string::String,
2385 #[prost(enumeration = "Modality", repeated, tag = "3")]
2387 pub input_modalities: ::prost::alloc::vec::Vec<i32>,
2388 #[prost(enumeration = "Modality", repeated, tag = "6")]
2390 pub output_modalities: ::prost::alloc::vec::Vec<i32>,
2391 #[prost(int64, tag = "12")]
2393 pub image_price: i64,
2394 #[prost(message, optional, tag = "8")]
2396 pub created: ::core::option::Option<::prost_types::Timestamp>,
2397 #[prost(int32, tag = "9")]
2400 pub max_prompt_length: i32,
2401 #[prost(string, tag = "10")]
2403 pub system_fingerprint: ::prost::alloc::string::String,
2404}
2405#[derive(Clone, PartialEq, ::prost::Message)]
2408pub struct ListImageGenerationModelsResponse {
2409 #[prost(message, repeated, tag = "1")]
2411 pub models: ::prost::alloc::vec::Vec<ImageGenerationModel>,
2412}
2413#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2415#[repr(i32)]
2416pub enum Modality {
2417 InvalidModality = 0,
2419 Text = 1,
2421 Image = 2,
2423 Embedding = 3,
2425}
2426impl Modality {
2427 pub fn as_str_name(&self) -> &'static str {
2432 match self {
2433 Self::InvalidModality => "INVALID_MODALITY",
2434 Self::Text => "TEXT",
2435 Self::Image => "IMAGE",
2436 Self::Embedding => "EMBEDDING",
2437 }
2438 }
2439 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2441 match value {
2442 "INVALID_MODALITY" => Some(Self::InvalidModality),
2443 "TEXT" => Some(Self::Text),
2444 "IMAGE" => Some(Self::Image),
2445 "EMBEDDING" => Some(Self::Embedding),
2446 _ => None,
2447 }
2448 }
2449}
2450pub mod models_client {
2452 #![allow(
2453 unused_variables,
2454 dead_code,
2455 missing_docs,
2456 clippy::wildcard_imports,
2457 clippy::let_unit_value,
2458 )]
2459 use tonic::codegen::*;
2460 use tonic::codegen::http::Uri;
2461 #[derive(Debug, Clone)]
2464 pub struct ModelsClient<T> {
2465 inner: tonic::client::Grpc<T>,
2466 }
2467 impl ModelsClient<tonic::transport::Channel> {
2468 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2470 where
2471 D: TryInto<tonic::transport::Endpoint>,
2472 D::Error: Into<StdError>,
2473 {
2474 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2475 Ok(Self::new(conn))
2476 }
2477 }
2478 impl<T> ModelsClient<T>
2479 where
2480 T: tonic::client::GrpcService<tonic::body::Body>,
2481 T::Error: Into<StdError>,
2482 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2483 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2484 {
2485 pub fn new(inner: T) -> Self {
2486 let inner = tonic::client::Grpc::new(inner);
2487 Self { inner }
2488 }
2489 pub fn with_origin(inner: T, origin: Uri) -> Self {
2490 let inner = tonic::client::Grpc::with_origin(inner, origin);
2491 Self { inner }
2492 }
2493 pub fn with_interceptor<F>(
2494 inner: T,
2495 interceptor: F,
2496 ) -> ModelsClient<InterceptedService<T, F>>
2497 where
2498 F: tonic::service::Interceptor,
2499 T::ResponseBody: Default,
2500 T: tonic::codegen::Service<
2501 http::Request<tonic::body::Body>,
2502 Response = http::Response<
2503 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2504 >,
2505 >,
2506 <T as tonic::codegen::Service<
2507 http::Request<tonic::body::Body>,
2508 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2509 {
2510 ModelsClient::new(InterceptedService::new(inner, interceptor))
2511 }
2512 #[must_use]
2517 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2518 self.inner = self.inner.send_compressed(encoding);
2519 self
2520 }
2521 #[must_use]
2523 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2524 self.inner = self.inner.accept_compressed(encoding);
2525 self
2526 }
2527 #[must_use]
2531 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2532 self.inner = self.inner.max_decoding_message_size(limit);
2533 self
2534 }
2535 #[must_use]
2539 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2540 self.inner = self.inner.max_encoding_message_size(limit);
2541 self
2542 }
2543 pub async fn list_language_models(
2545 &mut self,
2546 request: impl tonic::IntoRequest<()>,
2547 ) -> std::result::Result<
2548 tonic::Response<super::ListLanguageModelsResponse>,
2549 tonic::Status,
2550 > {
2551 self.inner
2552 .ready()
2553 .await
2554 .map_err(|e| {
2555 tonic::Status::unknown(
2556 format!("Service was not ready: {}", e.into()),
2557 )
2558 })?;
2559 let codec = tonic_prost::ProstCodec::default();
2560 let path = http::uri::PathAndQuery::from_static(
2561 "/xai_api.Models/ListLanguageModels",
2562 );
2563 let mut req = request.into_request();
2564 req.extensions_mut()
2565 .insert(GrpcMethod::new("xai_api.Models", "ListLanguageModels"));
2566 self.inner.unary(req, path, codec).await
2567 }
2568 pub async fn list_embedding_models(
2570 &mut self,
2571 request: impl tonic::IntoRequest<()>,
2572 ) -> std::result::Result<
2573 tonic::Response<super::ListEmbeddingModelsResponse>,
2574 tonic::Status,
2575 > {
2576 self.inner
2577 .ready()
2578 .await
2579 .map_err(|e| {
2580 tonic::Status::unknown(
2581 format!("Service was not ready: {}", e.into()),
2582 )
2583 })?;
2584 let codec = tonic_prost::ProstCodec::default();
2585 let path = http::uri::PathAndQuery::from_static(
2586 "/xai_api.Models/ListEmbeddingModels",
2587 );
2588 let mut req = request.into_request();
2589 req.extensions_mut()
2590 .insert(GrpcMethod::new("xai_api.Models", "ListEmbeddingModels"));
2591 self.inner.unary(req, path, codec).await
2592 }
2593 pub async fn list_image_generation_models(
2595 &mut self,
2596 request: impl tonic::IntoRequest<()>,
2597 ) -> std::result::Result<
2598 tonic::Response<super::ListImageGenerationModelsResponse>,
2599 tonic::Status,
2600 > {
2601 self.inner
2602 .ready()
2603 .await
2604 .map_err(|e| {
2605 tonic::Status::unknown(
2606 format!("Service was not ready: {}", e.into()),
2607 )
2608 })?;
2609 let codec = tonic_prost::ProstCodec::default();
2610 let path = http::uri::PathAndQuery::from_static(
2611 "/xai_api.Models/ListImageGenerationModels",
2612 );
2613 let mut req = request.into_request();
2614 req.extensions_mut()
2615 .insert(GrpcMethod::new("xai_api.Models", "ListImageGenerationModels"));
2616 self.inner.unary(req, path, codec).await
2617 }
2618 pub async fn get_language_model(
2620 &mut self,
2621 request: impl tonic::IntoRequest<super::GetModelRequest>,
2622 ) -> std::result::Result<tonic::Response<super::LanguageModel>, tonic::Status> {
2623 self.inner
2624 .ready()
2625 .await
2626 .map_err(|e| {
2627 tonic::Status::unknown(
2628 format!("Service was not ready: {}", e.into()),
2629 )
2630 })?;
2631 let codec = tonic_prost::ProstCodec::default();
2632 let path = http::uri::PathAndQuery::from_static(
2633 "/xai_api.Models/GetLanguageModel",
2634 );
2635 let mut req = request.into_request();
2636 req.extensions_mut()
2637 .insert(GrpcMethod::new("xai_api.Models", "GetLanguageModel"));
2638 self.inner.unary(req, path, codec).await
2639 }
2640 pub async fn get_embedding_model(
2642 &mut self,
2643 request: impl tonic::IntoRequest<super::GetModelRequest>,
2644 ) -> std::result::Result<tonic::Response<super::EmbeddingModel>, tonic::Status> {
2645 self.inner
2646 .ready()
2647 .await
2648 .map_err(|e| {
2649 tonic::Status::unknown(
2650 format!("Service was not ready: {}", e.into()),
2651 )
2652 })?;
2653 let codec = tonic_prost::ProstCodec::default();
2654 let path = http::uri::PathAndQuery::from_static(
2655 "/xai_api.Models/GetEmbeddingModel",
2656 );
2657 let mut req = request.into_request();
2658 req.extensions_mut()
2659 .insert(GrpcMethod::new("xai_api.Models", "GetEmbeddingModel"));
2660 self.inner.unary(req, path, codec).await
2661 }
2662 pub async fn get_image_generation_model(
2664 &mut self,
2665 request: impl tonic::IntoRequest<super::GetModelRequest>,
2666 ) -> std::result::Result<
2667 tonic::Response<super::ImageGenerationModel>,
2668 tonic::Status,
2669 > {
2670 self.inner
2671 .ready()
2672 .await
2673 .map_err(|e| {
2674 tonic::Status::unknown(
2675 format!("Service was not ready: {}", e.into()),
2676 )
2677 })?;
2678 let codec = tonic_prost::ProstCodec::default();
2679 let path = http::uri::PathAndQuery::from_static(
2680 "/xai_api.Models/GetImageGenerationModel",
2681 );
2682 let mut req = request.into_request();
2683 req.extensions_mut()
2684 .insert(GrpcMethod::new("xai_api.Models", "GetImageGenerationModel"));
2685 self.inner.unary(req, path, codec).await
2686 }
2687 }
2688}
2689#[derive(Clone, PartialEq, ::prost::Message)]
2691pub struct EmbedRequest {
2692 #[prost(message, repeated, tag = "1")]
2696 pub input: ::prost::alloc::vec::Vec<EmbedInput>,
2697 #[prost(string, tag = "2")]
2699 pub model: ::prost::alloc::string::String,
2700 #[prost(enumeration = "EmbedEncodingFormat", tag = "3")]
2702 pub encoding_format: i32,
2703 #[prost(string, tag = "4")]
2707 pub user: ::prost::alloc::string::String,
2708}
2709#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2711pub struct EmbedInput {
2712 #[prost(oneof = "embed_input::Input", tags = "1, 2")]
2713 pub input: ::core::option::Option<embed_input::Input>,
2714}
2715pub mod embed_input {
2717 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
2718 pub enum Input {
2719 #[prost(string, tag = "1")]
2721 String(::prost::alloc::string::String),
2722 #[prost(message, tag = "2")]
2724 ImageUrl(super::ImageUrlContent),
2725 }
2726}
2727#[derive(Clone, PartialEq, ::prost::Message)]
2729pub struct EmbedResponse {
2730 #[prost(string, tag = "1")]
2733 pub id: ::prost::alloc::string::String,
2734 #[prost(message, repeated, tag = "2")]
2736 pub embeddings: ::prost::alloc::vec::Vec<Embedding>,
2737 #[prost(message, optional, tag = "3")]
2739 pub usage: ::core::option::Option<EmbeddingUsage>,
2740 #[prost(string, tag = "4")]
2745 pub model: ::prost::alloc::string::String,
2746 #[prost(string, tag = "5")]
2749 pub system_fingerprint: ::prost::alloc::string::String,
2750}
2751#[derive(Clone, PartialEq, ::prost::Message)]
2753pub struct Embedding {
2754 #[prost(int32, tag = "1")]
2756 pub index: i32,
2757 #[prost(message, repeated, tag = "2")]
2760 pub embeddings: ::prost::alloc::vec::Vec<FeatureVector>,
2761}
2762#[derive(Clone, PartialEq, ::prost::Message)]
2764pub struct FeatureVector {
2765 #[prost(float, repeated, tag = "1")]
2768 pub float_array: ::prost::alloc::vec::Vec<f32>,
2769 #[prost(string, tag = "2")]
2772 pub base64_array: ::prost::alloc::string::String,
2773}
2774#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2775#[repr(i32)]
2776pub enum EmbedEncodingFormat {
2777 FormatInvalid = 0,
2779 FormatFloat = 1,
2781 FormatBase64 = 2,
2783}
2784impl EmbedEncodingFormat {
2785 pub fn as_str_name(&self) -> &'static str {
2790 match self {
2791 Self::FormatInvalid => "FORMAT_INVALID",
2792 Self::FormatFloat => "FORMAT_FLOAT",
2793 Self::FormatBase64 => "FORMAT_BASE64",
2794 }
2795 }
2796 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2798 match value {
2799 "FORMAT_INVALID" => Some(Self::FormatInvalid),
2800 "FORMAT_FLOAT" => Some(Self::FormatFloat),
2801 "FORMAT_BASE64" => Some(Self::FormatBase64),
2802 _ => None,
2803 }
2804 }
2805}
2806pub mod embedder_client {
2808 #![allow(
2809 unused_variables,
2810 dead_code,
2811 missing_docs,
2812 clippy::wildcard_imports,
2813 clippy::let_unit_value,
2814 )]
2815 use tonic::codegen::*;
2816 use tonic::codegen::http::Uri;
2817 #[derive(Debug, Clone)]
2819 pub struct EmbedderClient<T> {
2820 inner: tonic::client::Grpc<T>,
2821 }
2822 impl EmbedderClient<tonic::transport::Channel> {
2823 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2825 where
2826 D: TryInto<tonic::transport::Endpoint>,
2827 D::Error: Into<StdError>,
2828 {
2829 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2830 Ok(Self::new(conn))
2831 }
2832 }
2833 impl<T> EmbedderClient<T>
2834 where
2835 T: tonic::client::GrpcService<tonic::body::Body>,
2836 T::Error: Into<StdError>,
2837 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2838 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2839 {
2840 pub fn new(inner: T) -> Self {
2841 let inner = tonic::client::Grpc::new(inner);
2842 Self { inner }
2843 }
2844 pub fn with_origin(inner: T, origin: Uri) -> Self {
2845 let inner = tonic::client::Grpc::with_origin(inner, origin);
2846 Self { inner }
2847 }
2848 pub fn with_interceptor<F>(
2849 inner: T,
2850 interceptor: F,
2851 ) -> EmbedderClient<InterceptedService<T, F>>
2852 where
2853 F: tonic::service::Interceptor,
2854 T::ResponseBody: Default,
2855 T: tonic::codegen::Service<
2856 http::Request<tonic::body::Body>,
2857 Response = http::Response<
2858 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2859 >,
2860 >,
2861 <T as tonic::codegen::Service<
2862 http::Request<tonic::body::Body>,
2863 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2864 {
2865 EmbedderClient::new(InterceptedService::new(inner, interceptor))
2866 }
2867 #[must_use]
2872 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2873 self.inner = self.inner.send_compressed(encoding);
2874 self
2875 }
2876 #[must_use]
2878 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2879 self.inner = self.inner.accept_compressed(encoding);
2880 self
2881 }
2882 #[must_use]
2886 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2887 self.inner = self.inner.max_decoding_message_size(limit);
2888 self
2889 }
2890 #[must_use]
2894 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2895 self.inner = self.inner.max_encoding_message_size(limit);
2896 self
2897 }
2898 pub async fn embed(
2901 &mut self,
2902 request: impl tonic::IntoRequest<super::EmbedRequest>,
2903 ) -> std::result::Result<tonic::Response<super::EmbedResponse>, tonic::Status> {
2904 self.inner
2905 .ready()
2906 .await
2907 .map_err(|e| {
2908 tonic::Status::unknown(
2909 format!("Service was not ready: {}", e.into()),
2910 )
2911 })?;
2912 let codec = tonic_prost::ProstCodec::default();
2913 let path = http::uri::PathAndQuery::from_static("/xai_api.Embedder/Embed");
2914 let mut req = request.into_request();
2915 req.extensions_mut().insert(GrpcMethod::new("xai_api.Embedder", "Embed"));
2916 self.inner.unary(req, path, codec).await
2917 }
2918 }
2919}
2920#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2922pub struct TokenizeTextRequest {
2923 #[prost(string, tag = "1")]
2925 pub text: ::prost::alloc::string::String,
2926 #[prost(string, tag = "2")]
2928 pub model: ::prost::alloc::string::String,
2929 #[prost(string, tag = "3")]
2933 pub user: ::prost::alloc::string::String,
2934}
2935#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2937pub struct Token {
2938 #[prost(uint32, tag = "1")]
2940 pub token_id: u32,
2941 #[prost(string, tag = "2")]
2943 pub string_token: ::prost::alloc::string::String,
2944 #[prost(bytes = "vec", tag = "4")]
2946 pub token_bytes: ::prost::alloc::vec::Vec<u8>,
2947}
2948#[derive(Clone, PartialEq, ::prost::Message)]
2950pub struct TokenizeTextResponse {
2951 #[prost(message, repeated, tag = "1")]
2953 pub tokens: ::prost::alloc::vec::Vec<Token>,
2954 #[prost(string, tag = "2")]
2959 pub model: ::prost::alloc::string::String,
2960}
2961pub mod tokenize_client {
2963 #![allow(
2964 unused_variables,
2965 dead_code,
2966 missing_docs,
2967 clippy::wildcard_imports,
2968 clippy::let_unit_value,
2969 )]
2970 use tonic::codegen::*;
2971 use tonic::codegen::http::Uri;
2972 #[derive(Debug, Clone)]
2974 pub struct TokenizeClient<T> {
2975 inner: tonic::client::Grpc<T>,
2976 }
2977 impl TokenizeClient<tonic::transport::Channel> {
2978 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2980 where
2981 D: TryInto<tonic::transport::Endpoint>,
2982 D::Error: Into<StdError>,
2983 {
2984 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2985 Ok(Self::new(conn))
2986 }
2987 }
2988 impl<T> TokenizeClient<T>
2989 where
2990 T: tonic::client::GrpcService<tonic::body::Body>,
2991 T::Error: Into<StdError>,
2992 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2993 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2994 {
2995 pub fn new(inner: T) -> Self {
2996 let inner = tonic::client::Grpc::new(inner);
2997 Self { inner }
2998 }
2999 pub fn with_origin(inner: T, origin: Uri) -> Self {
3000 let inner = tonic::client::Grpc::with_origin(inner, origin);
3001 Self { inner }
3002 }
3003 pub fn with_interceptor<F>(
3004 inner: T,
3005 interceptor: F,
3006 ) -> TokenizeClient<InterceptedService<T, F>>
3007 where
3008 F: tonic::service::Interceptor,
3009 T::ResponseBody: Default,
3010 T: tonic::codegen::Service<
3011 http::Request<tonic::body::Body>,
3012 Response = http::Response<
3013 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
3014 >,
3015 >,
3016 <T as tonic::codegen::Service<
3017 http::Request<tonic::body::Body>,
3018 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
3019 {
3020 TokenizeClient::new(InterceptedService::new(inner, interceptor))
3021 }
3022 #[must_use]
3027 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3028 self.inner = self.inner.send_compressed(encoding);
3029 self
3030 }
3031 #[must_use]
3033 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3034 self.inner = self.inner.accept_compressed(encoding);
3035 self
3036 }
3037 #[must_use]
3041 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3042 self.inner = self.inner.max_decoding_message_size(limit);
3043 self
3044 }
3045 #[must_use]
3049 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3050 self.inner = self.inner.max_encoding_message_size(limit);
3051 self
3052 }
3053 pub async fn tokenize_text(
3055 &mut self,
3056 request: impl tonic::IntoRequest<super::TokenizeTextRequest>,
3057 ) -> std::result::Result<
3058 tonic::Response<super::TokenizeTextResponse>,
3059 tonic::Status,
3060 > {
3061 self.inner
3062 .ready()
3063 .await
3064 .map_err(|e| {
3065 tonic::Status::unknown(
3066 format!("Service was not ready: {}", e.into()),
3067 )
3068 })?;
3069 let codec = tonic_prost::ProstCodec::default();
3070 let path = http::uri::PathAndQuery::from_static(
3071 "/xai_api.Tokenize/TokenizeText",
3072 );
3073 let mut req = request.into_request();
3074 req.extensions_mut()
3075 .insert(GrpcMethod::new("xai_api.Tokenize", "TokenizeText"));
3076 self.inner.unary(req, path, codec).await
3077 }
3078 }
3079}
3080#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3082pub struct ApiKey {
3083 #[prost(string, tag = "1")]
3086 pub redacted_api_key: ::prost::alloc::string::String,
3087 #[prost(string, tag = "3")]
3089 pub user_id: ::prost::alloc::string::String,
3090 #[prost(string, tag = "4")]
3092 pub name: ::prost::alloc::string::String,
3093 #[prost(message, optional, tag = "5")]
3095 pub create_time: ::core::option::Option<::prost_types::Timestamp>,
3096 #[prost(message, optional, tag = "9")]
3098 pub modify_time: ::core::option::Option<::prost_types::Timestamp>,
3099 #[prost(string, tag = "11")]
3101 pub modified_by: ::prost::alloc::string::String,
3102 #[prost(string, tag = "6")]
3104 pub team_id: ::prost::alloc::string::String,
3105 #[prost(string, repeated, tag = "7")]
3108 pub acls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
3109 #[prost(string, tag = "8")]
3111 pub api_key_id: ::prost::alloc::string::String,
3112 #[prost(bool, tag = "10")]
3114 pub api_key_blocked: bool,
3115 #[prost(bool, tag = "13")]
3117 pub team_blocked: bool,
3118 #[prost(bool, tag = "12")]
3120 pub disabled: bool,
3121}
3122pub mod auth_client {
3124 #![allow(
3125 unused_variables,
3126 dead_code,
3127 missing_docs,
3128 clippy::wildcard_imports,
3129 clippy::let_unit_value,
3130 )]
3131 use tonic::codegen::*;
3132 use tonic::codegen::http::Uri;
3133 #[derive(Debug, Clone)]
3135 pub struct AuthClient<T> {
3136 inner: tonic::client::Grpc<T>,
3137 }
3138 impl AuthClient<tonic::transport::Channel> {
3139 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
3141 where
3142 D: TryInto<tonic::transport::Endpoint>,
3143 D::Error: Into<StdError>,
3144 {
3145 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
3146 Ok(Self::new(conn))
3147 }
3148 }
3149 impl<T> AuthClient<T>
3150 where
3151 T: tonic::client::GrpcService<tonic::body::Body>,
3152 T::Error: Into<StdError>,
3153 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
3154 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
3155 {
3156 pub fn new(inner: T) -> Self {
3157 let inner = tonic::client::Grpc::new(inner);
3158 Self { inner }
3159 }
3160 pub fn with_origin(inner: T, origin: Uri) -> Self {
3161 let inner = tonic::client::Grpc::with_origin(inner, origin);
3162 Self { inner }
3163 }
3164 pub fn with_interceptor<F>(
3165 inner: T,
3166 interceptor: F,
3167 ) -> AuthClient<InterceptedService<T, F>>
3168 where
3169 F: tonic::service::Interceptor,
3170 T::ResponseBody: Default,
3171 T: tonic::codegen::Service<
3172 http::Request<tonic::body::Body>,
3173 Response = http::Response<
3174 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
3175 >,
3176 >,
3177 <T as tonic::codegen::Service<
3178 http::Request<tonic::body::Body>,
3179 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
3180 {
3181 AuthClient::new(InterceptedService::new(inner, interceptor))
3182 }
3183 #[must_use]
3188 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3189 self.inner = self.inner.send_compressed(encoding);
3190 self
3191 }
3192 #[must_use]
3194 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3195 self.inner = self.inner.accept_compressed(encoding);
3196 self
3197 }
3198 #[must_use]
3202 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3203 self.inner = self.inner.max_decoding_message_size(limit);
3204 self
3205 }
3206 #[must_use]
3210 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3211 self.inner = self.inner.max_encoding_message_size(limit);
3212 self
3213 }
3214 pub async fn get_api_key_info(
3216 &mut self,
3217 request: impl tonic::IntoRequest<()>,
3218 ) -> std::result::Result<tonic::Response<super::ApiKey>, tonic::Status> {
3219 self.inner
3220 .ready()
3221 .await
3222 .map_err(|e| {
3223 tonic::Status::unknown(
3224 format!("Service was not ready: {}", e.into()),
3225 )
3226 })?;
3227 let codec = tonic_prost::ProstCodec::default();
3228 let path = http::uri::PathAndQuery::from_static(
3229 "/xai_api.Auth/get_api_key_info",
3230 );
3231 let mut req = request.into_request();
3232 req.extensions_mut()
3233 .insert(GrpcMethod::new("xai_api.Auth", "get_api_key_info"));
3234 self.inner.unary(req, path, codec).await
3235 }
3236 }
3237}
3238#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3239pub struct SearchRequest {
3240 #[prost(string, tag = "1")]
3243 pub query: ::prost::alloc::string::String,
3244 #[prost(message, optional, tag = "2")]
3246 pub source: ::core::option::Option<DocumentsSource>,
3247 #[prost(int32, optional, tag = "3")]
3251 pub limit: ::core::option::Option<i32>,
3252 #[prost(enumeration = "RankingMetric", optional, tag = "4")]
3254 pub ranking_metric: ::core::option::Option<i32>,
3255 #[prost(string, optional, tag = "5")]
3257 pub instructions: ::core::option::Option<::prost::alloc::string::String>,
3258}
3259#[derive(Clone, PartialEq, ::prost::Message)]
3262pub struct SearchResponse {
3263 #[prost(message, repeated, tag = "1")]
3266 pub matches: ::prost::alloc::vec::Vec<SearchMatch>,
3267}
3268#[derive(Clone, PartialEq, ::prost::Message)]
3272pub struct SearchMatch {
3273 #[prost(string, tag = "1")]
3275 pub file_id: ::prost::alloc::string::String,
3276 #[prost(string, tag = "2")]
3278 pub chunk_id: ::prost::alloc::string::String,
3279 #[prost(string, tag = "3")]
3281 pub chunk_content: ::prost::alloc::string::String,
3282 #[prost(float, tag = "4")]
3286 pub score: f32,
3287 #[prost(string, repeated, tag = "5")]
3289 pub collection_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
3290}
3291#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3297pub struct DocumentsSource {
3298 #[prost(string, repeated, tag = "1")]
3300 pub collection_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
3301}
3302#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
3304#[repr(i32)]
3305pub enum RankingMetric {
3306 Unknown = 0,
3307 L2Distance = 1,
3308 CosineSimilarity = 2,
3309}
3310impl RankingMetric {
3311 pub fn as_str_name(&self) -> &'static str {
3316 match self {
3317 Self::Unknown => "RANKING_METRIC_UNKNOWN",
3318 Self::L2Distance => "RANKING_METRIC_L2_DISTANCE",
3319 Self::CosineSimilarity => "RANKING_METRIC_COSINE_SIMILARITY",
3320 }
3321 }
3322 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3324 match value {
3325 "RANKING_METRIC_UNKNOWN" => Some(Self::Unknown),
3326 "RANKING_METRIC_L2_DISTANCE" => Some(Self::L2Distance),
3327 "RANKING_METRIC_COSINE_SIMILARITY" => Some(Self::CosineSimilarity),
3328 _ => None,
3329 }
3330 }
3331}
3332pub mod documents_client {
3334 #![allow(
3335 unused_variables,
3336 dead_code,
3337 missing_docs,
3338 clippy::wildcard_imports,
3339 clippy::let_unit_value,
3340 )]
3341 use tonic::codegen::*;
3342 use tonic::codegen::http::Uri;
3343 #[derive(Debug, Clone)]
3344 pub struct DocumentsClient<T> {
3345 inner: tonic::client::Grpc<T>,
3346 }
3347 impl DocumentsClient<tonic::transport::Channel> {
3348 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
3350 where
3351 D: TryInto<tonic::transport::Endpoint>,
3352 D::Error: Into<StdError>,
3353 {
3354 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
3355 Ok(Self::new(conn))
3356 }
3357 }
3358 impl<T> DocumentsClient<T>
3359 where
3360 T: tonic::client::GrpcService<tonic::body::Body>,
3361 T::Error: Into<StdError>,
3362 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
3363 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
3364 {
3365 pub fn new(inner: T) -> Self {
3366 let inner = tonic::client::Grpc::new(inner);
3367 Self { inner }
3368 }
3369 pub fn with_origin(inner: T, origin: Uri) -> Self {
3370 let inner = tonic::client::Grpc::with_origin(inner, origin);
3371 Self { inner }
3372 }
3373 pub fn with_interceptor<F>(
3374 inner: T,
3375 interceptor: F,
3376 ) -> DocumentsClient<InterceptedService<T, F>>
3377 where
3378 F: tonic::service::Interceptor,
3379 T::ResponseBody: Default,
3380 T: tonic::codegen::Service<
3381 http::Request<tonic::body::Body>,
3382 Response = http::Response<
3383 <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
3384 >,
3385 >,
3386 <T as tonic::codegen::Service<
3387 http::Request<tonic::body::Body>,
3388 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
3389 {
3390 DocumentsClient::new(InterceptedService::new(inner, interceptor))
3391 }
3392 #[must_use]
3397 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3398 self.inner = self.inner.send_compressed(encoding);
3399 self
3400 }
3401 #[must_use]
3403 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3404 self.inner = self.inner.accept_compressed(encoding);
3405 self
3406 }
3407 #[must_use]
3411 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3412 self.inner = self.inner.max_decoding_message_size(limit);
3413 self
3414 }
3415 #[must_use]
3419 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3420 self.inner = self.inner.max_encoding_message_size(limit);
3421 self
3422 }
3423 pub async fn search(
3424 &mut self,
3425 request: impl tonic::IntoRequest<super::SearchRequest>,
3426 ) -> std::result::Result<tonic::Response<super::SearchResponse>, tonic::Status> {
3427 self.inner
3428 .ready()
3429 .await
3430 .map_err(|e| {
3431 tonic::Status::unknown(
3432 format!("Service was not ready: {}", e.into()),
3433 )
3434 })?;
3435 let codec = tonic_prost::ProstCodec::default();
3436 let path = http::uri::PathAndQuery::from_static("/xai_api.Documents/Search");
3437 let mut req = request.into_request();
3438 req.extensions_mut().insert(GrpcMethod::new("xai_api.Documents", "Search"));
3439 self.inner.unary(req, path, codec).await
3440 }
3441 }
3442}