pub struct EmbeddingBody {
pub model: EmbeddingModel,
pub input: EmbeddingInput,
pub dimensions: Option<EmbeddingDimensions>,
}Expand description
Request body for embeddings
Fields§
§model: EmbeddingModelEmbedding model (embedding-3 or embedding-2).
input: EmbeddingInputA single input string or a batch of strings.
dimensions: Option<EmbeddingDimensions>Output dimensions. embedding-3 supports all variants;
embedding-2 accepts only 1,024 dimensions or omission.
Implementations§
Source§impl EmbeddingBody
impl EmbeddingBody
Sourcepub fn new(model: EmbeddingModel, input: EmbeddingInput) -> Self
pub fn new(model: EmbeddingModel, input: EmbeddingInput) -> Self
Create a new embedding request body from a model and input.
Sourcepub fn with_dimensions(self, dims: EmbeddingDimensions) -> Self
pub fn with_dimensions(self, dims: EmbeddingDimensions) -> Self
Set the output vector dimensionality (embedding-3 only).
Sourcepub fn validate_model_constraints(&self) -> Result<(), ValidationError>
pub fn validate_model_constraints(&self) -> Result<(), ValidationError>
Enforce input and model/dimension constraints before sending.
Trait Implementations§
Source§impl Clone for EmbeddingBody
impl Clone for EmbeddingBody
Source§fn clone(&self) -> EmbeddingBody
fn clone(&self) -> EmbeddingBody
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EmbeddingBody
impl Debug for EmbeddingBody
Auto Trait Implementations§
impl Freeze for EmbeddingBody
impl RefUnwindSafe for EmbeddingBody
impl Send for EmbeddingBody
impl Sync for EmbeddingBody
impl Unpin for EmbeddingBody
impl UnsafeUnpin for EmbeddingBody
impl UnwindSafe for EmbeddingBody
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