pub struct FileUploadParams {
pub content: Vec<u8>,
pub filename: String,
pub content_type: String,
pub purpose: FilePurpose,
pub metadata: HashMap<String, String>,
}
Expand description
Parameters for uploading a file
Fields§
§content: Vec<u8>
File content
filename: String
Original filename
content_type: String
MIME type
purpose: FilePurpose
Purpose of the file
metadata: HashMap<String, String>
Additional metadata
Implementations§
Source§impl FileUploadParams
impl FileUploadParams
Sourcepub fn new(
content: Vec<u8>,
filename: impl Into<String>,
content_type: impl Into<String>,
purpose: FilePurpose,
) -> Self
pub fn new( content: Vec<u8>, filename: impl Into<String>, content_type: impl Into<String>, purpose: FilePurpose, ) -> Self
Create new upload parameters
Sourcepub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
pub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
Add metadata to the upload
Sourcepub fn with_meta(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_meta(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a single metadata entry
Sourcepub fn validate(&self) -> Result<(), AnthropicError>
pub fn validate(&self) -> Result<(), AnthropicError>
Validate the upload parameters
Trait Implementations§
Source§impl Clone for FileUploadParams
impl Clone for FileUploadParams
Source§fn clone(&self) -> FileUploadParams
fn clone(&self) -> FileUploadParams
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for FileUploadParams
impl RefUnwindSafe for FileUploadParams
impl Send for FileUploadParams
impl Sync for FileUploadParams
impl Unpin for FileUploadParams
impl UnwindSafe for FileUploadParams
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