pub struct File {
pub filename: String,
pub file_data: String,
}Expand description
A single file attached to a message (PDF or other parser-supported type).
OpenRouter (and the Go SDK) carries both URLs and base64 data URLs in the
same file_data field — there is no separate file_url field on the
wire. The FileRef struct still exposes both
for forward compatibility, but in practice callers should populate
file_data.
Fields§
§filename: StringDisplay filename. Sent verbatim in the wire payload.
file_data: StringFile payload — either a public URL (see Self::from_url) or a
data URI when sending the bytes directly.
Implementations§
Source§impl File
impl File
Sourcepub fn from_url(filename: impl Into<String>, url: impl Into<String>) -> Self
pub fn from_url(filename: impl Into<String>, url: impl Into<String>) -> Self
File served from a public URL. The URL is sent in file_data (this
matches the Go SDK’s CreateUserMessageWithPDF).
Trait Implementations§
impl StructuralPartialEq for File
Auto Trait Implementations§
impl Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnsafeUnpin for File
impl UnwindSafe for File
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