perceptic-core-client 0.30.0__py3-none-any.whl → 0.31.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of perceptic-core-client might be problematic. Click here for more details.

Files changed (29) hide show
  1. perceptic_core_client/__init__.py +22 -0
  2. perceptic_core_client/api/__init__.py +1 -0
  3. perceptic_core_client/api/citations_resource_api.py +569 -0
  4. perceptic_core_client/models/__init__.py +10 -0
  5. perceptic_core_client/models/biotech_analysis_api_dto.py +119 -0
  6. perceptic_core_client/models/biotech_analysis_image_annotated_citation_api_dto.py +91 -0
  7. perceptic_core_client/models/bulk_get_citations_request.py +87 -0
  8. perceptic_core_client/models/bulk_get_citations_response.py +95 -0
  9. perceptic_core_client/models/citation_api_dto.py +102 -0
  10. perceptic_core_client/models/citation_metadata_api_dto.py +189 -0
  11. perceptic_core_client/models/get_citation_output_uri_response.py +87 -0
  12. perceptic_core_client/models/highlighted_text_citation_metadata_api_dto.py +91 -0
  13. perceptic_core_client/models/image_detection_box_api_dto.py +97 -0
  14. perceptic_core_client/models/web_page_citation_metadata_api_dto.py +89 -0
  15. perceptic_core_client/test/test_biotech_analysis_api_dto.py +77 -0
  16. perceptic_core_client/test/test_biotech_analysis_image_annotated_citation_api_dto.py +78 -0
  17. perceptic_core_client/test/test_bulk_get_citations_request.py +53 -0
  18. perceptic_core_client/test/test_bulk_get_citations_response.py +57 -0
  19. perceptic_core_client/test/test_citation_api_dto.py +54 -0
  20. perceptic_core_client/test/test_citation_metadata_api_dto.py +83 -0
  21. perceptic_core_client/test/test_citations_resource_api.py +45 -0
  22. perceptic_core_client/test/test_get_citation_output_uri_response.py +51 -0
  23. perceptic_core_client/test/test_highlighted_text_citation_metadata_api_dto.py +53 -0
  24. perceptic_core_client/test/test_image_detection_box_api_dto.py +56 -0
  25. perceptic_core_client/test/test_web_page_citation_metadata_api_dto.py +52 -0
  26. {perceptic_core_client-0.30.0.dist-info → perceptic_core_client-0.31.1.dist-info}/METADATA +1 -1
  27. {perceptic_core_client-0.30.0.dist-info → perceptic_core_client-0.31.1.dist-info}/RECORD +29 -7
  28. {perceptic_core_client-0.30.0.dist-info → perceptic_core_client-0.31.1.dist-info}/WHEEL +0 -0
  29. {perceptic_core_client-0.30.0.dist-info → perceptic_core_client-0.31.1.dist-info}/top_level.txt +0 -0
@@ -18,6 +18,12 @@ from perceptic_core_client.models.action_type import ActionType
18
18
  from perceptic_core_client.models.add_tag_to_file_request import AddTagToFileRequest
19
19
  from perceptic_core_client.models.azure_blob_connection_settings_api_dto import AzureBlobConnectionSettingsApiDto
20
20
  from perceptic_core_client.models.azure_blob_file_system_root_metadata_api_dto import AzureBlobFileSystemRootMetadataApiDto
21
+ from perceptic_core_client.models.biotech_analysis_api_dto import BiotechAnalysisApiDto
22
+ from perceptic_core_client.models.biotech_analysis_image_annotated_citation_api_dto import BiotechAnalysisImageAnnotatedCitationApiDto
23
+ from perceptic_core_client.models.bulk_get_citations_request import BulkGetCitationsRequest
24
+ from perceptic_core_client.models.bulk_get_citations_response import BulkGetCitationsResponse
25
+ from perceptic_core_client.models.citation_api_dto import CitationApiDto
26
+ from perceptic_core_client.models.citation_metadata_api_dto import CitationMetadataApiDto
21
27
  from perceptic_core_client.models.connection_api_dto import ConnectionApiDto
22
28
  from perceptic_core_client.models.connection_settings_api_dto import ConnectionSettingsApiDto
23
29
  from perceptic_core_client.models.create_connection_request import CreateConnectionRequest
@@ -37,6 +43,7 @@ from perceptic_core_client.models.cron_trigger import CronTrigger
37
43
  from perceptic_core_client.models.execution_trigger_reason import ExecutionTriggerReason
38
44
  from perceptic_core_client.models.file_system_api_dto import FileSystemApiDto
39
45
  from perceptic_core_client.models.file_system_root_metadata_api_dto import FileSystemRootMetadataApiDto
46
+ from perceptic_core_client.models.get_citation_output_uri_response import GetCitationOutputUriResponse
40
47
  from perceptic_core_client.models.get_connection_response import GetConnectionResponse
41
48
  from perceptic_core_client.models.get_indexer_response import GetIndexerResponse
42
49
  from perceptic_core_client.models.get_indexing_schedule_response import GetIndexingScheduleResponse
@@ -50,6 +57,8 @@ from perceptic_core_client.models.get_worker_metadata_response import GetWorkerM
50
57
  from perceptic_core_client.models.get_worker_run_response import GetWorkerRunResponse
51
58
  from perceptic_core_client.models.get_worker_status_response import GetWorkerStatusResponse
52
59
  from perceptic_core_client.models.get_workers_response import GetWorkersResponse
60
+ from perceptic_core_client.models.highlighted_text_citation_metadata_api_dto import HighlightedTextCitationMetadataApiDto
61
+ from perceptic_core_client.models.image_detection_box_api_dto import ImageDetectionBoxApiDto
53
62
  from perceptic_core_client.models.indexer_dto import IndexerDto
54
63
  from perceptic_core_client.models.indexing_action_dto import IndexingActionDto
55
64
  from perceptic_core_client.models.indexing_action_status import IndexingActionStatus
@@ -96,5 +105,6 @@ from perceptic_core_client.models.update_tag_request import UpdateTagRequest
96
105
  from perceptic_core_client.models.update_tag_response import UpdateTagResponse
97
106
  from perceptic_core_client.models.upload_file_to_managed_file_system_response import UploadFileToManagedFileSystemResponse
98
107
  from perceptic_core_client.models.user_info_response import UserInfoResponse
108
+ from perceptic_core_client.models.web_page_citation_metadata_api_dto import WebPageCitationMetadataApiDto
99
109
  from perceptic_core_client.models.worker_event import WorkerEvent
100
110
  from perceptic_core_client.models.worker_metadata_dto import WorkerMetadataDto
@@ -0,0 +1,119 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ perceptic-core-server API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.0.1-SNAPSHOT
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
+ from perceptic_core_client.models.image_detection_box_api_dto import ImageDetectionBoxApiDto
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class BiotechAnalysisApiDto(BaseModel):
27
+ """
28
+ BiotechAnalysisApiDto
29
+ """ # noqa: E501
30
+ raw_analysis: Optional[StrictStr] = Field(default=None, alias="rawAnalysis")
31
+ compound_data_present: Optional[StrictBool] = Field(default=None, alias="compoundDataPresent")
32
+ compounds: Optional[List[StrictStr]] = None
33
+ development_stage: Optional[StrictStr] = Field(default=None, alias="developmentStage")
34
+ therapeutic_area: Optional[StrictStr] = Field(default=None, alias="therapeuticArea")
35
+ key_findings: Optional[List[StrictStr]] = Field(default=None, alias="keyFindings")
36
+ risks: Optional[List[StrictStr]] = None
37
+ market_potential: Optional[StrictStr] = Field(default=None, alias="marketPotential")
38
+ confidence: Optional[Union[StrictFloat, StrictInt]] = None
39
+ reasoning: Optional[StrictStr] = None
40
+ bounding_boxes: Optional[List[ImageDetectionBoxApiDto]] = Field(default=None, alias="boundingBoxes")
41
+ page_index: Optional[StrictInt] = Field(default=None, alias="pageIndex")
42
+ character_count: Optional[StrictInt] = Field(default=None, alias="characterCount")
43
+ __properties: ClassVar[List[str]] = ["rawAnalysis", "compoundDataPresent", "compounds", "developmentStage", "therapeuticArea", "keyFindings", "risks", "marketPotential", "confidence", "reasoning", "boundingBoxes", "pageIndex", "characterCount"]
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of BiotechAnalysisApiDto from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([
77
+ ])
78
+
79
+ _dict = self.model_dump(
80
+ by_alias=True,
81
+ exclude=excluded_fields,
82
+ exclude_none=True,
83
+ )
84
+ # override the default output from pydantic by calling `to_dict()` of each item in bounding_boxes (list)
85
+ _items = []
86
+ if self.bounding_boxes:
87
+ for _item_bounding_boxes in self.bounding_boxes:
88
+ if _item_bounding_boxes:
89
+ _items.append(_item_bounding_boxes.to_dict())
90
+ _dict['boundingBoxes'] = _items
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of BiotechAnalysisApiDto from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ _obj = cls.model_validate({
103
+ "rawAnalysis": obj.get("rawAnalysis"),
104
+ "compoundDataPresent": obj.get("compoundDataPresent"),
105
+ "compounds": obj.get("compounds"),
106
+ "developmentStage": obj.get("developmentStage"),
107
+ "therapeuticArea": obj.get("therapeuticArea"),
108
+ "keyFindings": obj.get("keyFindings"),
109
+ "risks": obj.get("risks"),
110
+ "marketPotential": obj.get("marketPotential"),
111
+ "confidence": obj.get("confidence"),
112
+ "reasoning": obj.get("reasoning"),
113
+ "boundingBoxes": [ImageDetectionBoxApiDto.from_dict(_item) for _item in obj["boundingBoxes"]] if obj.get("boundingBoxes") is not None else None,
114
+ "pageIndex": obj.get("pageIndex"),
115
+ "characterCount": obj.get("characterCount")
116
+ })
117
+ return _obj
118
+
119
+
@@ -0,0 +1,91 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ perceptic-core-server API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.0.1-SNAPSHOT
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from perceptic_core_client.models.biotech_analysis_api_dto import BiotechAnalysisApiDto
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class BiotechAnalysisImageAnnotatedCitationApiDto(BaseModel):
27
+ """
28
+ BiotechAnalysisImageAnnotatedCitationApiDto
29
+ """ # noqa: E501
30
+ analysis: Optional[BiotechAnalysisApiDto] = None
31
+ __properties: ClassVar[List[str]] = ["analysis"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of BiotechAnalysisImageAnnotatedCitationApiDto from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of analysis
73
+ if self.analysis:
74
+ _dict['analysis'] = self.analysis.to_dict()
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of BiotechAnalysisImageAnnotatedCitationApiDto from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate({
87
+ "analysis": BiotechAnalysisApiDto.from_dict(obj["analysis"]) if obj.get("analysis") is not None else None
88
+ })
89
+ return _obj
90
+
91
+
@@ -0,0 +1,87 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ perceptic-core-server API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.0.1-SNAPSHOT
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class BulkGetCitationsRequest(BaseModel):
26
+ """
27
+ BulkGetCitationsRequest
28
+ """ # noqa: E501
29
+ ids: Optional[List[StrictStr]] = None
30
+ __properties: ClassVar[List[str]] = ["ids"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of BulkGetCitationsRequest from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([
64
+ ])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of BulkGetCitationsRequest from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({
83
+ "ids": obj.get("ids")
84
+ })
85
+ return _obj
86
+
87
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ perceptic-core-server API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.0.1-SNAPSHOT
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from perceptic_core_client.models.citation_api_dto import CitationApiDto
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class BulkGetCitationsResponse(BaseModel):
27
+ """
28
+ BulkGetCitationsResponse
29
+ """ # noqa: E501
30
+ citations: Optional[List[CitationApiDto]] = None
31
+ __properties: ClassVar[List[str]] = ["citations"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of BulkGetCitationsResponse from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of each item in citations (list)
73
+ _items = []
74
+ if self.citations:
75
+ for _item_citations in self.citations:
76
+ if _item_citations:
77
+ _items.append(_item_citations.to_dict())
78
+ _dict['citations'] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of BulkGetCitationsResponse 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
+ "citations": [CitationApiDto.from_dict(_item) for _item in obj["citations"]] if obj.get("citations") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,102 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ perceptic-core-server API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.0.1-SNAPSHOT
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from perceptic_core_client.models.citation_metadata_api_dto import CitationMetadataApiDto
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CitationApiDto(BaseModel):
27
+ """
28
+ CitationApiDto
29
+ """ # noqa: E501
30
+ id: Optional[StrictStr] = None
31
+ input_uri: Optional[StrictStr] = Field(default=None, alias="inputUri")
32
+ output_artifact_uri: Optional[StrictStr] = Field(default=None, alias="outputArtifactUri")
33
+ metadata: Optional[CitationMetadataApiDto] = None
34
+ __properties: ClassVar[List[str]] = ["id", "inputUri", "outputArtifactUri", "metadata"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of CitationApiDto from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of metadata
76
+ if self.metadata:
77
+ _dict['metadata'] = self.metadata.to_dict()
78
+ # set to None if output_artifact_uri (nullable) is None
79
+ # and model_fields_set contains the field
80
+ if self.output_artifact_uri is None and "output_artifact_uri" in self.model_fields_set:
81
+ _dict['outputArtifactUri'] = None
82
+
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of CitationApiDto from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "id": obj.get("id"),
96
+ "inputUri": obj.get("inputUri"),
97
+ "outputArtifactUri": obj.get("outputArtifactUri"),
98
+ "metadata": CitationMetadataApiDto.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None
99
+ })
100
+ return _obj
101
+
102
+