perceptic-core-client 0.29.0__py3-none-any.whl → 0.31.0__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.
- perceptic_core_client/__init__.py +26 -0
- perceptic_core_client/api/__init__.py +1 -0
- perceptic_core_client/api/citations_resource_api.py +569 -0
- perceptic_core_client/api/user_resource_api.py +269 -0
- perceptic_core_client/api/worker_resource_api.py +273 -0
- perceptic_core_client/models/__init__.py +12 -0
- perceptic_core_client/models/biotech_analysis_api_dto.py +119 -0
- perceptic_core_client/models/biotech_analysis_image_annotated_citation_api_dto.py +91 -0
- perceptic_core_client/models/bulk_get_citations_request.py +87 -0
- perceptic_core_client/models/bulk_get_citations_response.py +95 -0
- perceptic_core_client/models/citation_api_dto.py +102 -0
- perceptic_core_client/models/citation_metadata_api_dto.py +189 -0
- perceptic_core_client/models/get_citation_output_uri_response.py +87 -0
- perceptic_core_client/models/get_worker_run_response.py +97 -0
- perceptic_core_client/models/highlighted_text_citation_metadata_api_dto.py +91 -0
- perceptic_core_client/models/image_detection_box_api_dto.py +97 -0
- perceptic_core_client/models/info_event.py +4 -1
- perceptic_core_client/models/progress_event.py +5 -2
- perceptic_core_client/models/request_for_input_event.py +4 -1
- perceptic_core_client/models/user_info_response.py +115 -0
- perceptic_core_client/models/web_page_citation_metadata_api_dto.py +89 -0
- perceptic_core_client/test/test_biotech_analysis_api_dto.py +77 -0
- perceptic_core_client/test/test_biotech_analysis_image_annotated_citation_api_dto.py +78 -0
- perceptic_core_client/test/test_bulk_get_citations_request.py +53 -0
- perceptic_core_client/test/test_bulk_get_citations_response.py +57 -0
- perceptic_core_client/test/test_citation_api_dto.py +54 -0
- perceptic_core_client/test/test_citation_metadata_api_dto.py +83 -0
- perceptic_core_client/test/test_citations_resource_api.py +45 -0
- perceptic_core_client/test/test_get_citation_output_uri_response.py +51 -0
- perceptic_core_client/test/test_get_worker_run_response.py +55 -0
- perceptic_core_client/test/test_highlighted_text_citation_metadata_api_dto.py +53 -0
- perceptic_core_client/test/test_image_detection_box_api_dto.py +56 -0
- perceptic_core_client/test/test_info_event.py +1 -0
- perceptic_core_client/test/test_progress_event.py +1 -0
- perceptic_core_client/test/test_request_for_input_event.py +1 -0
- perceptic_core_client/test/test_user_info_response.py +56 -0
- perceptic_core_client/test/test_user_resource_api.py +7 -0
- perceptic_core_client/test/test_web_page_citation_metadata_api_dto.py +52 -0
- perceptic_core_client/test/test_worker_event.py +1 -0
- perceptic_core_client/test/test_worker_resource_api.py +7 -0
- {perceptic_core_client-0.29.0.dist-info → perceptic_core_client-0.31.0.dist-info}/METADATA +1 -1
- {perceptic_core_client-0.29.0.dist-info → perceptic_core_client-0.31.0.dist-info}/RECORD +44 -18
- {perceptic_core_client-0.29.0.dist-info → perceptic_core_client-0.31.0.dist-info}/WHEEL +0 -0
- {perceptic_core_client-0.29.0.dist-info → perceptic_core_client-0.31.0.dist-info}/top_level.txt +0 -0
|
@@ -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
|
+
|
|
@@ -0,0 +1,189 @@
|
|
|
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 json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from perceptic_core_client.models.biotech_analysis_image_annotated_citation_api_dto import BiotechAnalysisImageAnnotatedCitationApiDto
|
|
21
|
+
from perceptic_core_client.models.highlighted_text_citation_metadata_api_dto import HighlightedTextCitationMetadataApiDto
|
|
22
|
+
from perceptic_core_client.models.web_page_citation_metadata_api_dto import WebPageCitationMetadataApiDto
|
|
23
|
+
from pydantic import StrictStr, Field
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
|
+
from typing_extensions import Literal, Self
|
|
26
|
+
|
|
27
|
+
CITATIONMETADATAAPIDTO_ONE_OF_SCHEMAS = ["BiotechAnalysisImageAnnotatedCitationApiDto", "HighlightedTextCitationMetadataApiDto", "WebPageCitationMetadataApiDto"]
|
|
28
|
+
|
|
29
|
+
class CitationMetadataApiDto(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
CitationMetadataApiDto
|
|
32
|
+
"""
|
|
33
|
+
# data type: HighlightedTextCitationMetadataApiDto
|
|
34
|
+
oneof_schema_1_validator: Optional[HighlightedTextCitationMetadataApiDto] = None
|
|
35
|
+
# data type: WebPageCitationMetadataApiDto
|
|
36
|
+
oneof_schema_2_validator: Optional[WebPageCitationMetadataApiDto] = None
|
|
37
|
+
# data type: BiotechAnalysisImageAnnotatedCitationApiDto
|
|
38
|
+
oneof_schema_3_validator: Optional[BiotechAnalysisImageAnnotatedCitationApiDto] = None
|
|
39
|
+
actual_instance: Optional[Union[BiotechAnalysisImageAnnotatedCitationApiDto, HighlightedTextCitationMetadataApiDto, WebPageCitationMetadataApiDto]] = None
|
|
40
|
+
one_of_schemas: Set[str] = { "BiotechAnalysisImageAnnotatedCitationApiDto", "HighlightedTextCitationMetadataApiDto", "WebPageCitationMetadataApiDto" }
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
52
|
+
if args:
|
|
53
|
+
if len(args) > 1:
|
|
54
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
55
|
+
if kwargs:
|
|
56
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
57
|
+
super().__init__(actual_instance=args[0])
|
|
58
|
+
else:
|
|
59
|
+
super().__init__(**kwargs)
|
|
60
|
+
|
|
61
|
+
@field_validator('actual_instance')
|
|
62
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
63
|
+
instance = CitationMetadataApiDto.model_construct()
|
|
64
|
+
error_messages = []
|
|
65
|
+
match = 0
|
|
66
|
+
# validate data type: HighlightedTextCitationMetadataApiDto
|
|
67
|
+
if not isinstance(v, HighlightedTextCitationMetadataApiDto):
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `HighlightedTextCitationMetadataApiDto`")
|
|
69
|
+
else:
|
|
70
|
+
match += 1
|
|
71
|
+
# validate data type: WebPageCitationMetadataApiDto
|
|
72
|
+
if not isinstance(v, WebPageCitationMetadataApiDto):
|
|
73
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `WebPageCitationMetadataApiDto`")
|
|
74
|
+
else:
|
|
75
|
+
match += 1
|
|
76
|
+
# validate data type: BiotechAnalysisImageAnnotatedCitationApiDto
|
|
77
|
+
if not isinstance(v, BiotechAnalysisImageAnnotatedCitationApiDto):
|
|
78
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `BiotechAnalysisImageAnnotatedCitationApiDto`")
|
|
79
|
+
else:
|
|
80
|
+
match += 1
|
|
81
|
+
if match > 1:
|
|
82
|
+
# more than 1 match
|
|
83
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CitationMetadataApiDto with oneOf schemas: BiotechAnalysisImageAnnotatedCitationApiDto, HighlightedTextCitationMetadataApiDto, WebPageCitationMetadataApiDto. Details: " + ", ".join(error_messages))
|
|
84
|
+
elif match == 0:
|
|
85
|
+
# no match
|
|
86
|
+
raise ValueError("No match found when setting `actual_instance` in CitationMetadataApiDto with oneOf schemas: BiotechAnalysisImageAnnotatedCitationApiDto, HighlightedTextCitationMetadataApiDto, WebPageCitationMetadataApiDto. Details: " + ", ".join(error_messages))
|
|
87
|
+
else:
|
|
88
|
+
return v
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
92
|
+
return cls.from_json(json.dumps(obj))
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_json(cls, json_str: str) -> Self:
|
|
96
|
+
"""Returns the object represented by the json string"""
|
|
97
|
+
instance = cls.model_construct()
|
|
98
|
+
error_messages = []
|
|
99
|
+
match = 0
|
|
100
|
+
|
|
101
|
+
# use oneOf discriminator to lookup the data type
|
|
102
|
+
_data_type = json.loads(json_str).get("type")
|
|
103
|
+
if not _data_type:
|
|
104
|
+
raise ValueError("Failed to lookup data type from the field `type` in the input.")
|
|
105
|
+
|
|
106
|
+
# check if data type is `AnnotatedImageCitationMetadataApiDto`
|
|
107
|
+
if _data_type == "annotated-image":
|
|
108
|
+
instance.actual_instance = AnnotatedImageCitationMetadataApiDto.from_json(json_str)
|
|
109
|
+
return instance
|
|
110
|
+
|
|
111
|
+
# check if data type is `HighlightedTextCitationMetadataApiDto`
|
|
112
|
+
if _data_type == "highlighted-text":
|
|
113
|
+
instance.actual_instance = HighlightedTextCitationMetadataApiDto.from_json(json_str)
|
|
114
|
+
return instance
|
|
115
|
+
|
|
116
|
+
# check if data type is `WebPageCitationMetadataApiDto`
|
|
117
|
+
if _data_type == "web-page":
|
|
118
|
+
instance.actual_instance = WebPageCitationMetadataApiDto.from_json(json_str)
|
|
119
|
+
return instance
|
|
120
|
+
|
|
121
|
+
# check if data type is `AnnotatedImageCitationMetadataApiDto`
|
|
122
|
+
if _data_type == "AnnotatedImageCitationMetadataApiDto":
|
|
123
|
+
instance.actual_instance = AnnotatedImageCitationMetadataApiDto.from_json(json_str)
|
|
124
|
+
return instance
|
|
125
|
+
|
|
126
|
+
# check if data type is `HighlightedTextCitationMetadataApiDto`
|
|
127
|
+
if _data_type == "HighlightedTextCitationMetadataApiDto":
|
|
128
|
+
instance.actual_instance = HighlightedTextCitationMetadataApiDto.from_json(json_str)
|
|
129
|
+
return instance
|
|
130
|
+
|
|
131
|
+
# check if data type is `WebPageCitationMetadataApiDto`
|
|
132
|
+
if _data_type == "WebPageCitationMetadataApiDto":
|
|
133
|
+
instance.actual_instance = WebPageCitationMetadataApiDto.from_json(json_str)
|
|
134
|
+
return instance
|
|
135
|
+
|
|
136
|
+
# deserialize data into HighlightedTextCitationMetadataApiDto
|
|
137
|
+
try:
|
|
138
|
+
instance.actual_instance = HighlightedTextCitationMetadataApiDto.from_json(json_str)
|
|
139
|
+
match += 1
|
|
140
|
+
except (ValidationError, ValueError) as e:
|
|
141
|
+
error_messages.append(str(e))
|
|
142
|
+
# deserialize data into WebPageCitationMetadataApiDto
|
|
143
|
+
try:
|
|
144
|
+
instance.actual_instance = WebPageCitationMetadataApiDto.from_json(json_str)
|
|
145
|
+
match += 1
|
|
146
|
+
except (ValidationError, ValueError) as e:
|
|
147
|
+
error_messages.append(str(e))
|
|
148
|
+
# deserialize data into BiotechAnalysisImageAnnotatedCitationApiDto
|
|
149
|
+
try:
|
|
150
|
+
instance.actual_instance = BiotechAnalysisImageAnnotatedCitationApiDto.from_json(json_str)
|
|
151
|
+
match += 1
|
|
152
|
+
except (ValidationError, ValueError) as e:
|
|
153
|
+
error_messages.append(str(e))
|
|
154
|
+
|
|
155
|
+
if match > 1:
|
|
156
|
+
# more than 1 match
|
|
157
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CitationMetadataApiDto with oneOf schemas: BiotechAnalysisImageAnnotatedCitationApiDto, HighlightedTextCitationMetadataApiDto, WebPageCitationMetadataApiDto. Details: " + ", ".join(error_messages))
|
|
158
|
+
elif match == 0:
|
|
159
|
+
# no match
|
|
160
|
+
raise ValueError("No match found when deserializing the JSON string into CitationMetadataApiDto with oneOf schemas: BiotechAnalysisImageAnnotatedCitationApiDto, HighlightedTextCitationMetadataApiDto, WebPageCitationMetadataApiDto. Details: " + ", ".join(error_messages))
|
|
161
|
+
else:
|
|
162
|
+
return instance
|
|
163
|
+
|
|
164
|
+
def to_json(self) -> str:
|
|
165
|
+
"""Returns the JSON representation of the actual instance"""
|
|
166
|
+
if self.actual_instance is None:
|
|
167
|
+
return "null"
|
|
168
|
+
|
|
169
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
170
|
+
return self.actual_instance.to_json()
|
|
171
|
+
else:
|
|
172
|
+
return json.dumps(self.actual_instance)
|
|
173
|
+
|
|
174
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], BiotechAnalysisImageAnnotatedCitationApiDto, HighlightedTextCitationMetadataApiDto, WebPageCitationMetadataApiDto]]:
|
|
175
|
+
"""Returns the dict representation of the actual instance"""
|
|
176
|
+
if self.actual_instance is None:
|
|
177
|
+
return None
|
|
178
|
+
|
|
179
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
180
|
+
return self.actual_instance.to_dict()
|
|
181
|
+
else:
|
|
182
|
+
# primitive type
|
|
183
|
+
return self.actual_instance
|
|
184
|
+
|
|
185
|
+
def to_str(self) -> str:
|
|
186
|
+
"""Returns the string representation of the actual instance"""
|
|
187
|
+
return pprint.pformat(self.model_dump())
|
|
188
|
+
|
|
189
|
+
|