Skip to content

Sync Asset Ocr V1

immichpy.client.generated.models.sync_asset_ocr_v1.SyncAssetOcrV1 pydantic-model

Bases: BaseModel

SyncAssetOcrV1

Show JSON schema:
{
  "description": "SyncAssetOcrV1",
  "properties": {
    "assetId": {
      "description": "Asset ID",
      "format": "uuid",
      "title": "Assetid",
      "type": "string"
    },
    "boxScore": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Confidence score of the bounding box",
      "title": "Boxscore"
    },
    "id": {
      "description": "OCR entry ID",
      "format": "uuid",
      "title": "Id",
      "type": "string"
    },
    "isVisible": {
      "description": "Whether the OCR entry is visible",
      "title": "Isvisible",
      "type": "boolean"
    },
    "text": {
      "description": "Recognized text content",
      "title": "Text",
      "type": "string"
    },
    "textScore": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Confidence score of the recognized text",
      "title": "Textscore"
    },
    "x1": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Top-left X coordinate (normalized 0\u20131)",
      "title": "X1"
    },
    "x2": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Top-right X coordinate (normalized 0\u20131)",
      "title": "X2"
    },
    "x3": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Bottom-right X coordinate (normalized 0\u20131)",
      "title": "X3"
    },
    "x4": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Bottom-left X coordinate (normalized 0\u20131)",
      "title": "X4"
    },
    "y1": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Top-left Y coordinate (normalized 0\u20131)",
      "title": "Y1"
    },
    "y2": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Top-right Y coordinate (normalized 0\u20131)",
      "title": "Y2"
    },
    "y3": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Bottom-right Y coordinate (normalized 0\u20131)",
      "title": "Y3"
    },
    "y4": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Bottom-left Y coordinate (normalized 0\u20131)",
      "title": "Y4"
    }
  },
  "required": [
    "assetId",
    "boxScore",
    "id",
    "isVisible",
    "text",
    "textScore",
    "x1",
    "x2",
    "x3",
    "x4",
    "y1",
    "y2",
    "y3",
    "y4"
  ],
  "title": "SyncAssetOcrV1",
  "type": "object"
}

Config:

  • validate_by_name: True
  • validate_by_alias: True
  • validate_assignment: True
  • protected_namespaces: ()

Fields:

Validators:

asset_id pydantic-field

asset_id: UUID

Asset ID

box_score pydantic-field

box_score: Union[StrictFloat, StrictInt]

Confidence score of the bounding box

id pydantic-field

id: UUID

OCR entry ID

is_visible pydantic-field

is_visible: StrictBool

Whether the OCR entry is visible

text pydantic-field

text: StrictStr

Recognized text content

text_score pydantic-field

text_score: Union[StrictFloat, StrictInt]

Confidence score of the recognized text

x1 pydantic-field

x1: Union[StrictFloat, StrictInt]

Top-left X coordinate (normalized 0–1)

x2 pydantic-field

x2: Union[StrictFloat, StrictInt]

Top-right X coordinate (normalized 0–1)

x3 pydantic-field

x3: Union[StrictFloat, StrictInt]

Bottom-right X coordinate (normalized 0–1)

x4 pydantic-field

x4: Union[StrictFloat, StrictInt]

Bottom-left X coordinate (normalized 0–1)

y1 pydantic-field

y1: Union[StrictFloat, StrictInt]

Top-left Y coordinate (normalized 0–1)

y2 pydantic-field

y2: Union[StrictFloat, StrictInt]

Top-right Y coordinate (normalized 0–1)

y3 pydantic-field

y3: Union[StrictFloat, StrictInt]

Bottom-right Y coordinate (normalized 0–1)

y4 pydantic-field

y4: Union[StrictFloat, StrictInt]

Bottom-left Y coordinate (normalized 0–1)

asset_id_validate_regular_expression pydantic-validator

asset_id_validate_regular_expression(value)

Validates the regular expression

Source code in immichpy/client/generated/models/sync_asset_ocr_v1.py
 94
 95
 96
 97
 98
 99
100
101
102
103
104
@field_validator("asset_id", mode="before")
def asset_id_validate_regular_expression(cls, value):
    """Validates the regular expression"""
    if isinstance(value, str) and not re.match(
        r"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        value,
    ):
        raise ValueError(
            r"must validate the regular expression /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$/"
        )
    return value

from_dict classmethod

from_dict(obj: Optional[Dict[str, Any]]) -> Optional[Self]

Create an instance of SyncAssetOcrV1 from a dict

Source code in immichpy/client/generated/models/sync_asset_ocr_v1.py
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
    """Create an instance of SyncAssetOcrV1 from a dict"""
    if obj is None:
        return None

    if not isinstance(obj, dict):
        return cls.model_validate(obj)

    _obj = cls.model_validate(
        {
            "assetId": obj.get("assetId"),
            "boxScore": obj.get("boxScore"),
            "id": obj.get("id"),
            "isVisible": obj.get("isVisible"),
            "text": obj.get("text"),
            "textScore": obj.get("textScore"),
            "x1": obj.get("x1"),
            "x2": obj.get("x2"),
            "x3": obj.get("x3"),
            "x4": obj.get("x4"),
            "y1": obj.get("y1"),
            "y2": obj.get("y2"),
            "y3": obj.get("y3"),
            "y4": obj.get("y4"),
        }
    )
    return _obj

from_json classmethod

from_json(json_str: str) -> Optional[Self]

Create an instance of SyncAssetOcrV1 from a JSON string

Source code in immichpy/client/generated/models/sync_asset_ocr_v1.py
133
134
135
136
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
    """Create an instance of SyncAssetOcrV1 from a JSON string"""
    return cls.from_dict(json.loads(json_str))

id_validate_regular_expression pydantic-validator

id_validate_regular_expression(value)

Validates the regular expression

Source code in immichpy/client/generated/models/sync_asset_ocr_v1.py
106
107
108
109
110
111
112
113
114
115
116
@field_validator("id", mode="before")
def id_validate_regular_expression(cls, value):
    """Validates the regular expression"""
    if isinstance(value, str) and not re.match(
        r"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        value,
    ):
        raise ValueError(
            r"must validate the regular expression /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$/"
        )
    return value

to_dict

to_dict() -> Dict[str, Any]

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.
Source code in immichpy/client/generated/models/sync_asset_ocr_v1.py
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
def to_dict(self) -> Dict[str, Any]:
    """Return the dictionary representation of the model using alias.

    This has the following differences from calling pydantic's
    `self.model_dump(by_alias=True)`:

    * `None` is only added to the output dict for nullable fields that
      were set at model initialization. Other fields with value `None`
      are ignored.
    """
    excluded_fields: Set[str] = set([])

    _dict = self.model_dump(
        by_alias=True,
        exclude=excluded_fields,
        exclude_none=True,
    )
    return _dict

to_json

to_json() -> str

Returns the JSON representation of the model using alias

Source code in immichpy/client/generated/models/sync_asset_ocr_v1.py
129
130
131
def to_json(self) -> str:
    """Returns the JSON representation of the model using alias"""
    return json.dumps(to_jsonable_python(self.to_dict()))

to_str

to_str() -> str

Returns the string representation of the model using alias

Source code in immichpy/client/generated/models/sync_asset_ocr_v1.py
125
126
127
def to_str(self) -> str:
    """Returns the string representation of the model using alias"""
    return pprint.pformat(self.model_dump(by_alias=True))