#[non_exhaustive]pub struct CountTokensRequest {
pub endpoint: String,
pub model: String,
pub instances: Vec<Value>,
pub contents: Vec<Content>,
pub system_instruction: Option<Content>,
pub tools: Vec<Tool>,
pub generation_config: Option<GenerationConfig>,
/* private fields */
}llm-utility-service only.Expand description
Request message for [PredictionService.CountTokens][].
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.endpoint: StringRequired. The name of the Endpoint requested to perform token counting.
Format:
projects/{project}/locations/{location}/endpoints/{endpoint}
model: StringOptional. The name of the publisher model requested to serve the
prediction. Format:
projects/{project}/locations/{location}/publishers/*/models/*
instances: Vec<Value>Optional. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model.
contents: Vec<Content>Optional. Input content.
system_instruction: Option<Content>Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph.
tools: Vec<Tool>Optional. A list of Tools the model may use to generate the next
response.
A Tool is a piece of code that enables the system to interact with
external systems to perform an action, or set of actions, outside of
knowledge and scope of the model.
generation_config: Option<GenerationConfig>Optional. Generation config that the model will use to generate the response.
Implementations§
Source§impl CountTokensRequest
impl CountTokensRequest
pub fn new() -> Self
Sourcepub fn set_endpoint<T: Into<String>>(self, v: T) -> Self
pub fn set_endpoint<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_instances<T, V>(self, v: T) -> Self
pub fn set_instances<T, V>(self, v: T) -> Self
Sourcepub fn set_contents<T, V>(self, v: T) -> Self
pub fn set_contents<T, V>(self, v: T) -> Self
Sourcepub fn set_system_instruction<T>(self, v: T) -> Self
pub fn set_system_instruction<T>(self, v: T) -> Self
Sets the value of system_instruction.
§Example
use google_cloud_aiplatform_v1::model::Content;
let x = CountTokensRequest::new().set_system_instruction(Content::default()/* use setters */);Sourcepub fn set_or_clear_system_instruction<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_system_instruction<T>(self, v: Option<T>) -> Self
Sets or clears the value of system_instruction.
§Example
use google_cloud_aiplatform_v1::model::Content;
let x = CountTokensRequest::new().set_or_clear_system_instruction(Some(Content::default()/* use setters */));
let x = CountTokensRequest::new().set_or_clear_system_instruction(None::<Content>);Sourcepub fn set_generation_config<T>(self, v: T) -> Selfwhere
T: Into<GenerationConfig>,
pub fn set_generation_config<T>(self, v: T) -> Selfwhere
T: Into<GenerationConfig>,
Sets the value of generation_config.
§Example
use google_cloud_aiplatform_v1::model::GenerationConfig;
let x = CountTokensRequest::new().set_generation_config(GenerationConfig::default()/* use setters */);Sourcepub fn set_or_clear_generation_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<GenerationConfig>,
pub fn set_or_clear_generation_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<GenerationConfig>,
Sets or clears the value of generation_config.
§Example
use google_cloud_aiplatform_v1::model::GenerationConfig;
let x = CountTokensRequest::new().set_or_clear_generation_config(Some(GenerationConfig::default()/* use setters */));
let x = CountTokensRequest::new().set_or_clear_generation_config(None::<GenerationConfig>);Trait Implementations§
Source§impl Clone for CountTokensRequest
impl Clone for CountTokensRequest
Source§fn clone(&self) -> CountTokensRequest
fn clone(&self) -> CountTokensRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more