vectorize_client.models.extraction_result
Vectorize API (Beta)
API for Vectorize services
The version of the OpenAPI document: 0.0.1 Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
1# coding: utf-8 2 3""" 4 Vectorize API (Beta) 5 6 API for Vectorize services 7 8 The version of the OpenAPI document: 0.0.1 9 Generated by OpenAPI Generator (https://openapi-generator.tech) 10 11 Do not edit the class manually. 12""" # noqa: E501 13 14 15from __future__ import annotations 16import pprint 17import re # noqa: F401 18import json 19 20from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr 21from typing import Any, ClassVar, Dict, List, Optional 22from typing import Optional, Set 23from typing_extensions import Self 24 25class ExtractionResult(BaseModel): 26 """ 27 ExtractionResult 28 """ # noqa: E501 29 success: StrictBool 30 chunks: Optional[List[StrictStr]] = None 31 text: Optional[StrictStr] = None 32 metadata: Optional[StrictStr] = None 33 metadata_schema: Optional[StrictStr] = Field(default=None, alias="metadataSchema") 34 chunks_metadata: Optional[List[StrictStr]] = Field(default=None, alias="chunksMetadata") 35 chunks_schema: Optional[List[StrictStr]] = Field(default=None, alias="chunksSchema") 36 error: Optional[StrictStr] = None 37 __properties: ClassVar[List[str]] = ["success", "chunks", "text", "metadata", "metadataSchema", "chunksMetadata", "chunksSchema", "error"] 38 39 model_config = ConfigDict( 40 populate_by_name=True, 41 validate_assignment=True, 42 protected_namespaces=(), 43 ) 44 45 46 def to_str(self) -> str: 47 """Returns the string representation of the model using alias""" 48 return pprint.pformat(self.model_dump(by_alias=True)) 49 50 def to_json(self) -> str: 51 """Returns the JSON representation of the model using alias""" 52 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 53 return json.dumps(self.to_dict()) 54 55 @classmethod 56 def from_json(cls, json_str: str) -> Optional[Self]: 57 """Create an instance of ExtractionResult from a JSON string""" 58 return cls.from_dict(json.loads(json_str)) 59 60 def to_dict(self) -> Dict[str, Any]: 61 """Return the dictionary representation of the model using alias. 62 63 This has the following differences from calling pydantic's 64 `self.model_dump(by_alias=True)`: 65 66 * `None` is only added to the output dict for nullable fields that 67 were set at model initialization. Other fields with value `None` 68 are ignored. 69 """ 70 excluded_fields: Set[str] = set([ 71 ]) 72 73 _dict = self.model_dump( 74 by_alias=True, 75 exclude=excluded_fields, 76 exclude_none=True, 77 ) 78 return _dict 79 80 @classmethod 81 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 82 """Create an instance of ExtractionResult from a dict""" 83 if obj is None: 84 return None 85 86 if not isinstance(obj, dict): 87 return cls.model_validate(obj) 88 89 _obj = cls.model_validate({ 90 "success": obj.get("success"), 91 "chunks": obj.get("chunks"), 92 "text": obj.get("text"), 93 "metadata": obj.get("metadata"), 94 "metadataSchema": obj.get("metadataSchema"), 95 "chunksMetadata": obj.get("chunksMetadata"), 96 "chunksSchema": obj.get("chunksSchema"), 97 "error": obj.get("error") 98 }) 99 return _obj
class
ExtractionResult(pydantic.main.BaseModel):
26class ExtractionResult(BaseModel): 27 """ 28 ExtractionResult 29 """ # noqa: E501 30 success: StrictBool 31 chunks: Optional[List[StrictStr]] = None 32 text: Optional[StrictStr] = None 33 metadata: Optional[StrictStr] = None 34 metadata_schema: Optional[StrictStr] = Field(default=None, alias="metadataSchema") 35 chunks_metadata: Optional[List[StrictStr]] = Field(default=None, alias="chunksMetadata") 36 chunks_schema: Optional[List[StrictStr]] = Field(default=None, alias="chunksSchema") 37 error: Optional[StrictStr] = None 38 __properties: ClassVar[List[str]] = ["success", "chunks", "text", "metadata", "metadataSchema", "chunksMetadata", "chunksSchema", "error"] 39 40 model_config = ConfigDict( 41 populate_by_name=True, 42 validate_assignment=True, 43 protected_namespaces=(), 44 ) 45 46 47 def to_str(self) -> str: 48 """Returns the string representation of the model using alias""" 49 return pprint.pformat(self.model_dump(by_alias=True)) 50 51 def to_json(self) -> str: 52 """Returns the JSON representation of the model using alias""" 53 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 54 return json.dumps(self.to_dict()) 55 56 @classmethod 57 def from_json(cls, json_str: str) -> Optional[Self]: 58 """Create an instance of ExtractionResult from a JSON string""" 59 return cls.from_dict(json.loads(json_str)) 60 61 def to_dict(self) -> Dict[str, Any]: 62 """Return the dictionary representation of the model using alias. 63 64 This has the following differences from calling pydantic's 65 `self.model_dump(by_alias=True)`: 66 67 * `None` is only added to the output dict for nullable fields that 68 were set at model initialization. Other fields with value `None` 69 are ignored. 70 """ 71 excluded_fields: Set[str] = set([ 72 ]) 73 74 _dict = self.model_dump( 75 by_alias=True, 76 exclude=excluded_fields, 77 exclude_none=True, 78 ) 79 return _dict 80 81 @classmethod 82 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 83 """Create an instance of ExtractionResult from a dict""" 84 if obj is None: 85 return None 86 87 if not isinstance(obj, dict): 88 return cls.model_validate(obj) 89 90 _obj = cls.model_validate({ 91 "success": obj.get("success"), 92 "chunks": obj.get("chunks"), 93 "text": obj.get("text"), 94 "metadata": obj.get("metadata"), 95 "metadataSchema": obj.get("metadataSchema"), 96 "chunksMetadata": obj.get("chunksMetadata"), 97 "chunksSchema": obj.get("chunksSchema"), 98 "error": obj.get("error") 99 }) 100 return _obj
ExtractionResult
model_config =
{'populate_by_name': True, 'validate_assignment': True, 'protected_namespaces': ()}
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
def
to_str(self) -> str:
47 def to_str(self) -> str: 48 """Returns the string representation of the model using alias""" 49 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
def
to_json(self) -> str:
51 def to_json(self) -> str: 52 """Returns the JSON representation of the model using alias""" 53 # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead 54 return json.dumps(self.to_dict())
Returns the JSON representation of the model using alias
@classmethod
def
from_json(cls, json_str: str) -> Optional[Self]:
56 @classmethod 57 def from_json(cls, json_str: str) -> Optional[Self]: 58 """Create an instance of ExtractionResult from a JSON string""" 59 return cls.from_dict(json.loads(json_str))
Create an instance of ExtractionResult from a JSON string
def
to_dict(self) -> Dict[str, Any]:
61 def to_dict(self) -> Dict[str, Any]: 62 """Return the dictionary representation of the model using alias. 63 64 This has the following differences from calling pydantic's 65 `self.model_dump(by_alias=True)`: 66 67 * `None` is only added to the output dict for nullable fields that 68 were set at model initialization. Other fields with value `None` 69 are ignored. 70 """ 71 excluded_fields: Set[str] = set([ 72 ]) 73 74 _dict = self.model_dump( 75 by_alias=True, 76 exclude=excluded_fields, 77 exclude_none=True, 78 ) 79 return _dict
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 valueNone
are ignored.
@classmethod
def
from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81 @classmethod 82 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 83 """Create an instance of ExtractionResult from a dict""" 84 if obj is None: 85 return None 86 87 if not isinstance(obj, dict): 88 return cls.model_validate(obj) 89 90 _obj = cls.model_validate({ 91 "success": obj.get("success"), 92 "chunks": obj.get("chunks"), 93 "text": obj.get("text"), 94 "metadata": obj.get("metadata"), 95 "metadataSchema": obj.get("metadataSchema"), 96 "chunksMetadata": obj.get("chunksMetadata"), 97 "chunksSchema": obj.get("chunksSchema"), 98 "error": obj.get("error") 99 }) 100 return _obj
Create an instance of ExtractionResult from a dict