pub struct CacheBuilder { /* private fields */ }
Expand description
Builder for creating cached content with a fluent API.
Implementations§
Source§impl CacheBuilder
impl CacheBuilder
Sourcepub fn with_display_name<S: Into<String>>(
self,
display_name: S,
) -> Result<Self, Error>
pub fn with_display_name<S: Into<String>>( self, display_name: S, ) -> Result<Self, Error>
Set a display name for the cached content. Maximum 128 Unicode characters.
Sourcepub fn with_system_instruction<S: Into<String>>(self, instruction: S) -> Self
pub fn with_system_instruction<S: Into<String>>(self, instruction: S) -> Self
Set the system instruction for the cached content.
Sourcepub fn with_user_message<S: Into<String>>(self, message: S) -> Self
pub fn with_user_message<S: Into<String>>(self, message: S) -> Self
Add a user message to the cached content.
Sourcepub fn with_model_message<S: Into<String>>(self, message: S) -> Self
pub fn with_model_message<S: Into<String>>(self, message: S) -> Self
Add a model message to the cached content.
Sourcepub fn with_content(self, content: Content) -> Self
pub fn with_content(self, content: Content) -> Self
Add content directly to the cached content.
Sourcepub fn with_contents(self, contents: Vec<Content>) -> Self
pub fn with_contents(self, contents: Vec<Content>) -> Self
Add multiple contents to the cached content.
Sourcepub fn with_tools(self, tools: Vec<Tool>) -> Self
pub fn with_tools(self, tools: Vec<Tool>) -> Self
Add multiple tools to the cached content.
Sourcepub fn with_tool_config(self, tool_config: ToolConfig) -> Self
pub fn with_tool_config(self, tool_config: ToolConfig) -> Self
Set the tool configuration.
Sourcepub fn with_ttl(self, ttl: Duration) -> Self
pub fn with_ttl(self, ttl: Duration) -> Self
Set the TTL (Time To Live) for the cached content. The cache will automatically expire after this duration.
Sourcepub fn with_expire_time(self, expire_time: OffsetDateTime) -> Self
pub fn with_expire_time(self, expire_time: OffsetDateTime) -> Self
Set an explicit expiration time for the cached content.
Sourcepub async fn execute(self) -> Result<CachedContentHandle, Error>
pub async fn execute(self) -> Result<CachedContentHandle, Error>
Execute the cache creation request.
Auto Trait Implementations§
impl Freeze for CacheBuilder
impl !RefUnwindSafe for CacheBuilder
impl Send for CacheBuilder
impl Sync for CacheBuilder
impl Unpin for CacheBuilder
impl !UnwindSafe for CacheBuilder
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
Mutably borrows from an owned value. Read more