pub struct Request {
pub contents: Vec<Content>,
pub tools: Vec<Tools>,
pub safety_settings: Vec<SafetySettings>,
pub generation_config: Option<GenerationConfig>,
pub system_instruction: Option<SystemInstructionContent>,
}Expand description
Holds the data to be used for a specific text request
Fields§
§contents: Vec<Content>§tools: Vec<Tools>§safety_settings: Vec<SafetySettings>§generation_config: Option<GenerationConfig>§system_instruction: Option<SystemInstructionContent>Available on crate feature
beta only.Implementations§
Source§impl Request
impl Request
pub fn new( contents: Vec<Content>, tools: Vec<Tools>, safety_settings: Vec<SafetySettings>, generation_config: Option<GenerationConfig>, ) -> Self
pub fn set_system_instruction(&mut self, instruction: SystemInstructionContent)
Available on crate feature
beta only.Sourcepub fn get_prompt_character_count(&self) -> usize
pub fn get_prompt_character_count(&self) -> usize
Gets the total character count of the prompt. As per the Gemini API, “Text input is charged by every 1,000 characters of input (prompt). Characters are counted by UTF-8 code points and white space is excluded from the count.” See: https://cloud.google.com/vertex-ai/pricing
Returns the total character count of the prompt as per the Gemini API.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Request
impl<'de> Deserialize<'de> for Request
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnwindSafe for Request
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