Skip to main content

mistral_openapi_client/models/
ocr_request.rs

1/*
2 * Mistral AI API
3 *
4 * Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct OcrRequest {
16    #[serde(rename = "model", deserialize_with = "Option::deserialize")]
17    pub model: Option<String>,
18    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
19    pub id: Option<String>,
20    #[serde(rename = "document")]
21    pub document: Box<models::Document>,
22    #[serde(rename = "pages", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
23    pub pages: Option<Option<Vec<i32>>>,
24    #[serde(rename = "include_image_base64", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub include_image_base64: Option<Option<bool>>,
26    #[serde(rename = "image_limit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub image_limit: Option<Option<i32>>,
28    #[serde(rename = "image_min_size", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub image_min_size: Option<Option<i32>>,
30    #[serde(rename = "bbox_annotation_format", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub bbox_annotation_format: Option<Option<Box<models::ResponseFormat>>>,
32    #[serde(rename = "document_annotation_format", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub document_annotation_format: Option<Option<Box<models::ResponseFormat>>>,
34    #[serde(rename = "document_annotation_prompt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
35    pub document_annotation_prompt: Option<Option<String>>,
36    #[serde(rename = "table_format", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub table_format: Option<Option<TableFormat>>,
38    #[serde(rename = "extract_header", skip_serializing_if = "Option::is_none")]
39    pub extract_header: Option<bool>,
40    #[serde(rename = "extract_footer", skip_serializing_if = "Option::is_none")]
41    pub extract_footer: Option<bool>,
42}
43
44impl OcrRequest {
45    pub fn new(model: Option<String>, document: models::Document) -> OcrRequest {
46        OcrRequest {
47            model,
48            id: None,
49            document: Box::new(document),
50            pages: None,
51            include_image_base64: None,
52            image_limit: None,
53            image_min_size: None,
54            bbox_annotation_format: None,
55            document_annotation_format: None,
56            document_annotation_prompt: None,
57            table_format: None,
58            extract_header: None,
59            extract_footer: None,
60        }
61    }
62}
63/// 
64#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
65pub enum TableFormat {
66    #[serde(rename = "markdown")]
67    Markdown,
68    #[serde(rename = "html")]
69    Html,
70}
71
72impl Default for TableFormat {
73    fn default() -> TableFormat {
74        Self::Markdown
75    }
76}
77