pub struct FileParseRequest { /* private fields */ }Expand description
Request that uploads a local file and creates a parsing task.
§Examples
use zai_rs::tool::file_parser_create::{FileParseRequest, ToolType};
use std::path::Path;
let file_path = Path::new("document.pdf");
let request = FileParseRequest::new(file_path, ToolType::Lite)?;Implementations§
Source§impl FileParseRequest
impl FileParseRequest
Sourcepub fn new(file_path: &Path, tool_type: ToolType) -> ZaiResult<Self>
pub fn new(file_path: &Path, tool_type: ToolType) -> ZaiResult<Self>
Create a request after verifying that file_path is a regular file.
Sourcepub fn with_file_type(self, file_type: FileType) -> ZaiResult<Self>
pub fn with_file_type(self, file_type: FileType) -> ZaiResult<Self>
Declare the input file type instead of relying on service detection.
Sourcepub fn new_with_auto_type(
file_path: &Path,
tool_type: ToolType,
) -> ZaiResult<Self>
pub fn new_with_auto_type( file_path: &Path, tool_type: ToolType, ) -> ZaiResult<Self>
Create a request and infer the declared file type from the path suffix.
Sourcepub async fn send_via(
&self,
client: &ZaiClient,
) -> ZaiResult<FileParserCreateResponse>
pub async fn send_via( &self, client: &ZaiClient, ) -> ZaiResult<FileParserCreateResponse>
Upload the file and create the parser task through client.
Auto Trait Implementations§
impl Freeze for FileParseRequest
impl RefUnwindSafe for FileParseRequest
impl Send for FileParseRequest
impl Sync for FileParseRequest
impl Unpin for FileParseRequest
impl UnsafeUnpin for FileParseRequest
impl UnwindSafe for FileParseRequest
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