Skip to main content

FilesModel

Trait FilesModel 

Source
pub trait FilesModel:
    Send
    + Sync
    + Debug {
    // Required methods
    fn provider(&self) -> &str;
    fn upload_file<'life0, 'async_trait>(
        &'life0 self,
        options: UploadFileOptions,
    ) -> Pin<Box<dyn Future<Output = Result<UploadFileResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn specification_version(&self) -> &'static str { ... }
}
Expand description

Contract every file-upload model implements.

Mirrors FilesV4.

Required Methods§

Source

fn provider(&self) -> &str

Provider id, e.g. "anthropic.files".

Source

fn upload_file<'life0, 'async_trait>( &'life0 self, options: UploadFileOptions, ) -> Pin<Box<dyn Future<Output = Result<UploadFileResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Upload a file to the provider and return a reusable reference.

§Errors

Returns a crate::ProviderError when the upstream call fails or the response is malformed. Implementations should return crate::ProviderError::invalid_argument when given an UploadFileData variant the endpoint cannot handle.

Provided Methods§

Source

fn specification_version(&self) -> &'static str

Specification version (currently "v4").

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§