pub struct Request { /* private fields */ }
Expand description
Request data type used for the embedding endpoint.
Implementations§
Source§impl Request
impl Request
Sourcepub fn new(
model: String,
text: Option<String>,
image: Option<String>,
) -> Request
pub fn new( model: String, text: Option<String>, image: Option<String>, ) -> Request
Creates a new request for embedding. Text and/or an image is specified.
§Arguments
model
- The model to be used for the request.text
- The text used to generate the embedding.image
- A base64 encoded image used to generate the embedding.
Sourcepub fn truncate(self, direction: Direction) -> Self
pub fn truncate(self, direction: Direction) -> Self
Sets the truncate parameter and the truncate direction on the request.
§Arguments
truncate_direction
- The enum value of the direction to truncate the embeddings.
Sourcepub fn add_input(self, text: Option<String>, image: Option<String>) -> Self
pub fn add_input(self, text: Option<String>, image: Option<String>) -> Self
Adds input data to the request.
§Arguments
text
- The text used to generate the embedding.image
- A base64 encoded image used to generate the embedding.
Sourcepub fn add_inputs(self, inputs: Vec<Input>) -> Self
pub fn add_inputs(self, inputs: Vec<Input>) -> Self
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