#[non_exhaustive]pub struct CachedContent {
pub name: String,
pub display_name: String,
pub model: String,
pub system_instruction: Option<Content>,
pub contents: Vec<Content>,
pub tools: Vec<Tool>,
pub tool_config: Option<ToolConfig>,
pub create_time: Option<Timestamp>,
pub update_time: Option<Timestamp>,
pub usage_metadata: Option<UsageMetadata>,
pub encryption_spec: Option<EncryptionSpec>,
pub expiration: Option<Expiration>,
/* private fields */
}gen-ai-cache-service only.Expand description
A resource used in LLM queries for users to explicitly specify what to cache and how to cache.
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.name: StringImmutable. Identifier. The server-generated resource name of the cached content Format: projects/{project}/locations/{location}/cachedContents/{cached_content}
display_name: StringOptional. Immutable. The user-generated meaningful display name of the cached content.
model: StringImmutable. The name of the Model to use for cached content. Currently,
only the published Gemini base models are supported, in form of
projects/{PROJECT}/locations/{LOCATION}/publishers/google/models/{MODEL}
system_instruction: Option<Content>Optional. Input only. Immutable. Developer set system instruction. Currently, text only
contents: Vec<Content>Optional. Input only. Immutable. The content to cache
tools: Vec<Tool>Optional. Input only. Immutable. A list of Tools the model may use to
generate the next response
tool_config: Option<ToolConfig>Optional. Input only. Immutable. Tool config. This config is shared for all tools
create_time: Option<Timestamp>Output only. Creation time of the cache entry.
update_time: Option<Timestamp>Output only. When the cache entry was last updated in UTC time.
usage_metadata: Option<UsageMetadata>Output only. Metadata on the usage of the cached content.
encryption_spec: Option<EncryptionSpec>Input only. Immutable. Customer-managed encryption key spec for a
CachedContent. If set, this CachedContent and all its sub-resources
will be secured by this key.
expiration: Option<Expiration>Expiration time of the cached content.
Implementations§
Source§impl CachedContent
impl CachedContent
Sourcepub fn set_display_name<T: Into<String>>(self, v: T) -> Self
pub fn set_display_name<T: Into<String>>(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 = CachedContent::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 = CachedContent::new().set_or_clear_system_instruction(Some(Content::default()/* use setters */));
let x = CachedContent::new().set_or_clear_system_instruction(None::<Content>);Sourcepub fn set_contents<T, V>(self, v: T) -> Self
pub fn set_contents<T, V>(self, v: T) -> Self
Sourcepub fn set_tool_config<T>(self, v: T) -> Selfwhere
T: Into<ToolConfig>,
pub fn set_tool_config<T>(self, v: T) -> Selfwhere
T: Into<ToolConfig>,
Sets the value of tool_config.
§Example
use google_cloud_aiplatform_v1::model::ToolConfig;
let x = CachedContent::new().set_tool_config(ToolConfig::default()/* use setters */);Sourcepub fn set_or_clear_tool_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<ToolConfig>,
pub fn set_or_clear_tool_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<ToolConfig>,
Sets or clears the value of tool_config.
§Example
use google_cloud_aiplatform_v1::model::ToolConfig;
let x = CachedContent::new().set_or_clear_tool_config(Some(ToolConfig::default()/* use setters */));
let x = CachedContent::new().set_or_clear_tool_config(None::<ToolConfig>);Sourcepub fn set_create_time<T>(self, v: T) -> Self
pub fn set_create_time<T>(self, v: T) -> Self
Sets the value of create_time.
§Example
use wkt::Timestamp;
let x = CachedContent::new().set_create_time(Timestamp::default()/* use setters */);Sourcepub fn set_or_clear_create_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_create_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of create_time.
§Example
use wkt::Timestamp;
let x = CachedContent::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
let x = CachedContent::new().set_or_clear_create_time(None::<Timestamp>);Sourcepub fn set_update_time<T>(self, v: T) -> Self
pub fn set_update_time<T>(self, v: T) -> Self
Sets the value of update_time.
§Example
use wkt::Timestamp;
let x = CachedContent::new().set_update_time(Timestamp::default()/* use setters */);Sourcepub fn set_or_clear_update_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_update_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of update_time.
§Example
use wkt::Timestamp;
let x = CachedContent::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
let x = CachedContent::new().set_or_clear_update_time(None::<Timestamp>);Sourcepub fn set_usage_metadata<T>(self, v: T) -> Selfwhere
T: Into<UsageMetadata>,
pub fn set_usage_metadata<T>(self, v: T) -> Selfwhere
T: Into<UsageMetadata>,
Sets the value of usage_metadata.
§Example
use google_cloud_aiplatform_v1::model::cached_content::UsageMetadata;
let x = CachedContent::new().set_usage_metadata(UsageMetadata::default()/* use setters */);Sourcepub fn set_or_clear_usage_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<UsageMetadata>,
pub fn set_or_clear_usage_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<UsageMetadata>,
Sets or clears the value of usage_metadata.
§Example
use google_cloud_aiplatform_v1::model::cached_content::UsageMetadata;
let x = CachedContent::new().set_or_clear_usage_metadata(Some(UsageMetadata::default()/* use setters */));
let x = CachedContent::new().set_or_clear_usage_metadata(None::<UsageMetadata>);Sourcepub fn set_encryption_spec<T>(self, v: T) -> Selfwhere
T: Into<EncryptionSpec>,
pub fn set_encryption_spec<T>(self, v: T) -> Selfwhere
T: Into<EncryptionSpec>,
Sets the value of encryption_spec.
§Example
use google_cloud_aiplatform_v1::model::EncryptionSpec;
let x = CachedContent::new().set_encryption_spec(EncryptionSpec::default()/* use setters */);Sourcepub fn set_or_clear_encryption_spec<T>(self, v: Option<T>) -> Selfwhere
T: Into<EncryptionSpec>,
pub fn set_or_clear_encryption_spec<T>(self, v: Option<T>) -> Selfwhere
T: Into<EncryptionSpec>,
Sets or clears the value of encryption_spec.
§Example
use google_cloud_aiplatform_v1::model::EncryptionSpec;
let x = CachedContent::new().set_or_clear_encryption_spec(Some(EncryptionSpec::default()/* use setters */));
let x = CachedContent::new().set_or_clear_encryption_spec(None::<EncryptionSpec>);Sourcepub fn set_expiration<T: Into<Option<Expiration>>>(self, v: T) -> Self
pub fn set_expiration<T: Into<Option<Expiration>>>(self, v: T) -> Self
Sets the value of expiration.
Note that all the setters affecting expiration are mutually
exclusive.
§Example
use wkt::Timestamp;
let x = CachedContent::new().set_expiration(Some(
google_cloud_aiplatform_v1::model::cached_content::Expiration::ExpireTime(Timestamp::default().into())));Sourcepub fn expire_time(&self) -> Option<&Box<Timestamp>>
pub fn expire_time(&self) -> Option<&Box<Timestamp>>
The value of expiration
if it holds a ExpireTime, None if the field is not set or
holds a different branch.
Sourcepub fn set_expire_time<T: Into<Box<Timestamp>>>(self, v: T) -> Self
pub fn set_expire_time<T: Into<Box<Timestamp>>>(self, v: T) -> Self
Sets the value of expiration
to hold a ExpireTime.
Note that all the setters affecting expiration are
mutually exclusive.
§Example
use wkt::Timestamp;
let x = CachedContent::new().set_expire_time(Timestamp::default()/* use setters */);
assert!(x.expire_time().is_some());
assert!(x.ttl().is_none());Sourcepub fn ttl(&self) -> Option<&Box<Duration>>
pub fn ttl(&self) -> Option<&Box<Duration>>
The value of expiration
if it holds a Ttl, None if the field is not set or
holds a different branch.
Sourcepub fn set_ttl<T: Into<Box<Duration>>>(self, v: T) -> Self
pub fn set_ttl<T: Into<Box<Duration>>>(self, v: T) -> Self
Sets the value of expiration
to hold a Ttl.
Note that all the setters affecting expiration are
mutually exclusive.
§Example
use wkt::Duration;
let x = CachedContent::new().set_ttl(Duration::default()/* use setters */);
assert!(x.ttl().is_some());
assert!(x.expire_time().is_none());Trait Implementations§
Source§impl Clone for CachedContent
impl Clone for CachedContent
Source§fn clone(&self) -> CachedContent
fn clone(&self) -> CachedContent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CachedContent
impl Debug for CachedContent
Source§impl Default for CachedContent
impl Default for CachedContent
Source§fn default() -> CachedContent
fn default() -> CachedContent
Source§impl Message for CachedContent
impl Message for CachedContent
Source§impl PartialEq for CachedContent
impl PartialEq for CachedContent
impl StructuralPartialEq for CachedContent
Auto Trait Implementations§
impl Freeze for CachedContent
impl RefUnwindSafe for CachedContent
impl Send for CachedContent
impl Sync for CachedContent
impl Unpin for CachedContent
impl UnsafeUnpin for CachedContent
impl UnwindSafe for CachedContent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request