#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum BatchInferenceTaskStatus {
Unspecified = 0,
Created = 1,
Pending = 2,
InProgress = 3,
Completed = 4,
Failed = 5,
Canceled = 6,
}
impl BatchInferenceTaskStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
BatchInferenceTaskStatus::Unspecified => {
"BATCH_INFERENCE_TASK_STATUS_UNSPECIFIED"
}
BatchInferenceTaskStatus::Created => "CREATED",
BatchInferenceTaskStatus::Pending => "PENDING",
BatchInferenceTaskStatus::InProgress => "IN_PROGRESS",
BatchInferenceTaskStatus::Completed => "COMPLETED",
BatchInferenceTaskStatus::Failed => "FAILED",
BatchInferenceTaskStatus::Canceled => "CANCELED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BATCH_INFERENCE_TASK_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"CREATED" => Some(Self::Created),
"PENDING" => Some(Self::Pending),
"IN_PROGRESS" => Some(Self::InProgress),
"COMPLETED" => Some(Self::Completed),
"FAILED" => Some(Self::Failed),
"CANCELED" => Some(Self::Canceled),
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextEmbeddingRequest {
#[prost(string, tag = "1")]
pub model_uri: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub text: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub dim: ::core::option::Option<i64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextEmbeddingResponse {
#[prost(double, repeated, tag = "1")]
pub embedding: ::prost::alloc::vec::Vec<f64>,
#[prost(int64, tag = "2")]
pub num_tokens: i64,
#[prost(string, tag = "3")]
pub model_version: ::prost::alloc::string::String,
}
pub mod embeddings_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct EmbeddingsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl EmbeddingsServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> EmbeddingsServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> EmbeddingsServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
EmbeddingsServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn text_embedding(
&mut self,
request: impl tonic::IntoRequest<super::TextEmbeddingRequest>,
) -> std::result::Result<
tonic::Response<super::TextEmbeddingResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/yandex.cloud.ai.foundation_models.v1.EmbeddingsService/TextEmbedding",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.ai.foundation_models.v1.EmbeddingsService",
"TextEmbedding",
),
);
self.inner.unary(req, path, codec).await
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompletionOptions {
#[prost(bool, tag = "1")]
pub stream: bool,
#[prost(message, optional, tag = "2")]
pub temperature: ::core::option::Option<f64>,
#[prost(message, optional, tag = "3")]
pub max_tokens: ::core::option::Option<i64>,
#[prost(message, optional, tag = "4")]
pub reasoning_options: ::core::option::Option<ReasoningOptions>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReasoningOptions {
#[prost(enumeration = "reasoning_options::ReasoningMode", tag = "1")]
pub mode: i32,
}
pub mod reasoning_options {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ReasoningMode {
Unspecified = 0,
Disabled = 1,
EnabledHidden = 2,
}
impl ReasoningMode {
pub fn as_str_name(&self) -> &'static str {
match self {
ReasoningMode::Unspecified => "REASONING_MODE_UNSPECIFIED",
ReasoningMode::Disabled => "DISABLED",
ReasoningMode::EnabledHidden => "ENABLED_HIDDEN",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"REASONING_MODE_UNSPECIFIED" => Some(Self::Unspecified),
"DISABLED" => Some(Self::Disabled),
"ENABLED_HIDDEN" => Some(Self::EnabledHidden),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Message {
#[prost(string, tag = "1")]
pub role: ::prost::alloc::string::String,
#[prost(oneof = "message::Content", tags = "2, 3, 4")]
pub content: ::core::option::Option<message::Content>,
}
pub mod message {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Content {
#[prost(string, tag = "2")]
Text(::prost::alloc::string::String),
#[prost(message, tag = "3")]
ToolCallList(super::ToolCallList),
#[prost(message, tag = "4")]
ToolResultList(super::ToolResultList),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ContentUsage {
#[prost(int64, tag = "1")]
pub input_text_tokens: i64,
#[prost(int64, tag = "2")]
pub completion_tokens: i64,
#[prost(int64, tag = "3")]
pub total_tokens: i64,
#[prost(message, optional, tag = "4")]
pub completion_tokens_details: ::core::option::Option<
content_usage::CompletionTokensDetails,
>,
}
pub mod content_usage {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompletionTokensDetails {
#[prost(int64, tag = "1")]
pub reasoning_tokens: i64,
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Alternative {
#[prost(message, optional, tag = "1")]
pub message: ::core::option::Option<Message>,
#[prost(enumeration = "alternative::AlternativeStatus", tag = "2")]
pub status: i32,
}
pub mod alternative {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum AlternativeStatus {
Unspecified = 0,
Partial = 1,
TruncatedFinal = 2,
Final = 3,
ContentFilter = 4,
ToolCalls = 5,
}
impl AlternativeStatus {
pub fn as_str_name(&self) -> &'static str {
match self {
AlternativeStatus::Unspecified => "ALTERNATIVE_STATUS_UNSPECIFIED",
AlternativeStatus::Partial => "ALTERNATIVE_STATUS_PARTIAL",
AlternativeStatus::TruncatedFinal => "ALTERNATIVE_STATUS_TRUNCATED_FINAL",
AlternativeStatus::Final => "ALTERNATIVE_STATUS_FINAL",
AlternativeStatus::ContentFilter => "ALTERNATIVE_STATUS_CONTENT_FILTER",
AlternativeStatus::ToolCalls => "ALTERNATIVE_STATUS_TOOL_CALLS",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ALTERNATIVE_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
"ALTERNATIVE_STATUS_PARTIAL" => Some(Self::Partial),
"ALTERNATIVE_STATUS_TRUNCATED_FINAL" => Some(Self::TruncatedFinal),
"ALTERNATIVE_STATUS_FINAL" => Some(Self::Final),
"ALTERNATIVE_STATUS_CONTENT_FILTER" => Some(Self::ContentFilter),
"ALTERNATIVE_STATUS_TOOL_CALLS" => Some(Self::ToolCalls),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Token {
#[prost(int64, tag = "1")]
pub id: i64,
#[prost(string, tag = "2")]
pub text: ::prost::alloc::string::String,
#[prost(bool, tag = "3")]
pub special: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Tool {
#[prost(oneof = "tool::ToolType", tags = "1")]
pub tool_type: ::core::option::Option<tool::ToolType>,
}
pub mod tool {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ToolType {
#[prost(message, tag = "1")]
Function(super::FunctionTool),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FunctionTool {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub parameters: ::core::option::Option<::prost_types::Struct>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolCall {
#[prost(oneof = "tool_call::ToolCallType", tags = "1")]
pub tool_call_type: ::core::option::Option<tool_call::ToolCallType>,
}
pub mod tool_call {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ToolCallType {
#[prost(message, tag = "1")]
FunctionCall(super::FunctionCall),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FunctionCall {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub arguments: ::core::option::Option<::prost_types::Struct>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolCallList {
#[prost(message, repeated, tag = "1")]
pub tool_calls: ::prost::alloc::vec::Vec<ToolCall>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolResult {
#[prost(oneof = "tool_result::ToolResultType", tags = "1")]
pub tool_result_type: ::core::option::Option<tool_result::ToolResultType>,
}
pub mod tool_result {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ToolResultType {
#[prost(message, tag = "1")]
FunctionResult(super::FunctionResult),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FunctionResult {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(oneof = "function_result::ContentType", tags = "2")]
pub content_type: ::core::option::Option<function_result::ContentType>,
}
pub mod function_result {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ContentType {
#[prost(string, tag = "2")]
Content(::prost::alloc::string::String),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ToolResultList {
#[prost(message, repeated, tag = "1")]
pub tool_results: ::prost::alloc::vec::Vec<ToolResult>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct JsonSchema {
#[prost(message, optional, tag = "1")]
pub schema: ::core::option::Option<::prost_types::Struct>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompletionRequest {
#[prost(string, tag = "1")]
pub model_uri: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub completion_options: ::core::option::Option<CompletionOptions>,
#[prost(message, repeated, tag = "3")]
pub messages: ::prost::alloc::vec::Vec<Message>,
#[prost(message, repeated, tag = "4")]
pub tools: ::prost::alloc::vec::Vec<Tool>,
#[prost(oneof = "completion_request::ResponseFormat", tags = "5, 6")]
pub response_format: ::core::option::Option<completion_request::ResponseFormat>,
}
pub mod completion_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ResponseFormat {
#[prost(bool, tag = "5")]
JsonObject(bool),
#[prost(message, tag = "6")]
JsonSchema(super::JsonSchema),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompletionResponse {
#[prost(message, repeated, tag = "1")]
pub alternatives: ::prost::alloc::vec::Vec<Alternative>,
#[prost(message, optional, tag = "2")]
pub usage: ::core::option::Option<ContentUsage>,
#[prost(string, tag = "3")]
pub model_version: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCompletionRequest {
#[prost(string, tag = "1")]
pub model_uri: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub completion_options: ::core::option::Option<CompletionOptions>,
#[prost(oneof = "batch_completion_request::RequestFormat", tags = "3")]
pub request_format: ::core::option::Option<batch_completion_request::RequestFormat>,
}
pub mod batch_completion_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum RequestFormat {
#[prost(string, tag = "3")]
SourceDatasetId(::prost::alloc::string::String),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCompletionMetadata {
#[prost(string, tag = "1")]
pub task_id: ::prost::alloc::string::String,
#[prost(enumeration = "BatchInferenceTaskStatus", tag = "2")]
pub task_status: i32,
#[prost(int64, tag = "3")]
pub completed_batches: i64,
#[prost(int64, tag = "4")]
pub total_batches: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCompletionResponse {
#[prost(string, tag = "1")]
pub task_id: ::prost::alloc::string::String,
#[prost(enumeration = "BatchInferenceTaskStatus", tag = "2")]
pub task_status: i32,
#[prost(string, tag = "3")]
pub result_dataset_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TokenizeRequest {
#[prost(string, tag = "1")]
pub model_uri: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub text: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TokenizeResponse {
#[prost(message, repeated, tag = "1")]
pub tokens: ::prost::alloc::vec::Vec<Token>,
#[prost(string, tag = "2")]
pub model_version: ::prost::alloc::string::String,
}
pub mod text_generation_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TextGenerationServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TextGenerationServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TextGenerationServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TextGenerationServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
TextGenerationServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn completion(
&mut self,
request: impl tonic::IntoRequest<super::CompletionRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::CompletionResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/yandex.cloud.ai.foundation_models.v1.TextGenerationService/Completion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.ai.foundation_models.v1.TextGenerationService",
"Completion",
),
);
self.inner.server_streaming(req, path, codec).await
}
}
}
pub mod text_generation_async_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TextGenerationAsyncServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TextGenerationAsyncServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TextGenerationAsyncServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TextGenerationAsyncServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
TextGenerationAsyncServiceClient::new(
InterceptedService::new(inner, interceptor),
)
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn completion(
&mut self,
request: impl tonic::IntoRequest<super::CompletionRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::operation::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/yandex.cloud.ai.foundation_models.v1.TextGenerationAsyncService/Completion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.ai.foundation_models.v1.TextGenerationAsyncService",
"Completion",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod text_generation_batch_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TextGenerationBatchServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TextGenerationBatchServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TextGenerationBatchServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TextGenerationBatchServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
TextGenerationBatchServiceClient::new(
InterceptedService::new(inner, interceptor),
)
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn completion(
&mut self,
request: impl tonic::IntoRequest<super::BatchCompletionRequest>,
) -> std::result::Result<
tonic::Response<super::super::super::super::operation::Operation>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/yandex.cloud.ai.foundation_models.v1.TextGenerationBatchService/Completion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.ai.foundation_models.v1.TextGenerationBatchService",
"Completion",
),
);
self.inner.unary(req, path, codec).await
}
}
}
pub mod tokenizer_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct TokenizerServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl TokenizerServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> TokenizerServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> TokenizerServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
TokenizerServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn tokenize(
&mut self,
request: impl tonic::IntoRequest<super::TokenizeRequest>,
) -> std::result::Result<
tonic::Response<super::TokenizeResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/yandex.cloud.ai.foundation_models.v1.TokenizerService/Tokenize",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.ai.foundation_models.v1.TokenizerService",
"Tokenize",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn tokenize_completion(
&mut self,
request: impl tonic::IntoRequest<super::CompletionRequest>,
) -> std::result::Result<
tonic::Response<super::TokenizeResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/yandex.cloud.ai.foundation_models.v1.TokenizerService/TokenizeCompletion",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.ai.foundation_models.v1.TokenizerService",
"TokenizeCompletion",
),
);
self.inner.unary(req, path, codec).await
}
}
}