hindsight-client 0.3.0__py3-none-any.whl → 0.4.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.
- hindsight_client/__init__.py +9 -8
- hindsight_client/hindsight_client.py +394 -59
- {hindsight_client-0.3.0.dist-info → hindsight_client-0.4.1.dist-info}/METADATA +1 -1
- hindsight_client-0.4.1.dist-info/RECORD +89 -0
- hindsight_client_api/__init__.py +26 -2
- hindsight_client_api/api/__init__.py +2 -0
- hindsight_client_api/api/banks_api.py +998 -132
- hindsight_client_api/api/directives_api.py +1619 -0
- hindsight_client_api/api/documents_api.py +1 -1
- hindsight_client_api/api/entities_api.py +10 -7
- hindsight_client_api/api/memory_api.py +1 -1
- hindsight_client_api/api/mental_models_api.py +1897 -0
- hindsight_client_api/api/monitoring_api.py +247 -1
- hindsight_client_api/api/operations_api.py +351 -5
- hindsight_client_api/api_client.py +1 -1
- hindsight_client_api/configuration.py +2 -2
- hindsight_client_api/exceptions.py +1 -1
- hindsight_client_api/models/__init__.py +23 -1
- hindsight_client_api/models/add_background_request.py +3 -3
- hindsight_client_api/models/async_operation_submit_response.py +89 -0
- hindsight_client_api/models/background_response.py +11 -4
- hindsight_client_api/models/bank_list_item.py +7 -7
- hindsight_client_api/models/bank_list_response.py +1 -1
- hindsight_client_api/models/bank_profile_response.py +12 -5
- hindsight_client_api/models/bank_stats_response.py +16 -5
- hindsight_client_api/models/budget.py +1 -1
- hindsight_client_api/models/cancel_operation_response.py +1 -1
- hindsight_client_api/models/chunk_data.py +1 -1
- hindsight_client_api/models/chunk_include_options.py +1 -1
- hindsight_client_api/models/chunk_response.py +1 -1
- hindsight_client_api/models/consolidation_response.py +89 -0
- hindsight_client_api/models/create_bank_request.py +9 -2
- hindsight_client_api/models/create_directive_request.py +95 -0
- hindsight_client_api/models/create_mental_model_request.py +100 -0
- hindsight_client_api/models/create_mental_model_response.py +87 -0
- hindsight_client_api/models/delete_document_response.py +1 -1
- hindsight_client_api/models/delete_response.py +1 -1
- hindsight_client_api/models/directive_list_response.py +95 -0
- hindsight_client_api/models/directive_response.py +113 -0
- hindsight_client_api/models/disposition_traits.py +1 -1
- hindsight_client_api/models/document_response.py +1 -1
- hindsight_client_api/models/entity_detail_response.py +1 -1
- hindsight_client_api/models/entity_include_options.py +1 -1
- hindsight_client_api/models/entity_input.py +1 -1
- hindsight_client_api/models/entity_list_item.py +1 -1
- hindsight_client_api/models/entity_list_response.py +1 -1
- hindsight_client_api/models/entity_observation_response.py +1 -1
- hindsight_client_api/models/entity_state_response.py +1 -1
- hindsight_client_api/models/features_info.py +91 -0
- hindsight_client_api/models/graph_data_response.py +1 -1
- hindsight_client_api/models/http_validation_error.py +1 -1
- hindsight_client_api/models/include_options.py +1 -1
- hindsight_client_api/models/list_documents_response.py +1 -1
- hindsight_client_api/models/list_memory_units_response.py +1 -1
- hindsight_client_api/models/list_tags_response.py +1 -1
- hindsight_client_api/models/memory_item.py +1 -1
- hindsight_client_api/models/mental_model_list_response.py +95 -0
- hindsight_client_api/models/mental_model_response.py +126 -0
- hindsight_client_api/models/mental_model_trigger.py +87 -0
- hindsight_client_api/models/operation_response.py +2 -2
- hindsight_client_api/models/operation_status_response.py +131 -0
- hindsight_client_api/models/operations_list_response.py +9 -3
- hindsight_client_api/models/recall_request.py +1 -1
- hindsight_client_api/models/recall_response.py +1 -1
- hindsight_client_api/models/recall_result.py +1 -1
- hindsight_client_api/models/reflect_based_on.py +115 -0
- hindsight_client_api/models/reflect_directive.py +91 -0
- hindsight_client_api/models/reflect_fact.py +1 -1
- hindsight_client_api/models/reflect_include_options.py +14 -3
- hindsight_client_api/models/reflect_llm_call.py +89 -0
- hindsight_client_api/models/reflect_mental_model.py +96 -0
- hindsight_client_api/models/reflect_request.py +1 -1
- hindsight_client_api/models/reflect_response.py +24 -12
- hindsight_client_api/models/reflect_tool_call.py +100 -0
- hindsight_client_api/models/reflect_trace.py +105 -0
- hindsight_client_api/models/retain_request.py +1 -1
- hindsight_client_api/models/retain_response.py +1 -1
- hindsight_client_api/models/tag_item.py +1 -1
- hindsight_client_api/models/token_usage.py +1 -1
- hindsight_client_api/models/tool_calls_include_options.py +87 -0
- hindsight_client_api/models/update_directive_request.py +120 -0
- hindsight_client_api/models/update_disposition_request.py +1 -1
- hindsight_client_api/models/update_mental_model_request.py +125 -0
- hindsight_client_api/models/validation_error.py +1 -1
- hindsight_client_api/models/validation_error_loc_inner.py +1 -1
- hindsight_client_api/models/version_response.py +93 -0
- hindsight_client_api/rest.py +1 -1
- hindsight_client-0.3.0.dist-info/RECORD +0 -65
- {hindsight_client-0.3.0.dist-info → hindsight_client-0.4.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hindsight HTTP API
|
|
5
|
+
|
|
6
|
+
HTTP API for Hindsight
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.4.0
|
|
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
|
|
22
|
+
from hindsight_client_api.models.directive_response import DirectiveResponse
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class DirectiveListResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Response model for listing directives.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
items: List[DirectiveResponse]
|
|
31
|
+
__properties: ClassVar[List[str]] = ["items"]
|
|
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 DirectiveListResponse 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 items (list)
|
|
73
|
+
_items = []
|
|
74
|
+
if self.items:
|
|
75
|
+
for _item_items in self.items:
|
|
76
|
+
if _item_items:
|
|
77
|
+
_items.append(_item_items.to_dict())
|
|
78
|
+
_dict['items'] = _items
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of DirectiveListResponse 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
|
+
"items": [DirectiveResponse.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hindsight HTTP API
|
|
5
|
+
|
|
6
|
+
HTTP API for Hindsight
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.4.0
|
|
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, StrictBool, StrictInt, 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 DirectiveResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Response model for a directive.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
id: StrictStr
|
|
30
|
+
bank_id: StrictStr
|
|
31
|
+
name: StrictStr
|
|
32
|
+
content: StrictStr
|
|
33
|
+
priority: Optional[StrictInt] = 0
|
|
34
|
+
is_active: Optional[StrictBool] = True
|
|
35
|
+
tags: Optional[List[StrictStr]] = None
|
|
36
|
+
created_at: Optional[StrictStr] = None
|
|
37
|
+
updated_at: Optional[StrictStr] = None
|
|
38
|
+
__properties: ClassVar[List[str]] = ["id", "bank_id", "name", "content", "priority", "is_active", "tags", "created_at", "updated_at"]
|
|
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 DirectiveResponse 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
|
+
# set to None if created_at (nullable) is None
|
|
80
|
+
# and model_fields_set contains the field
|
|
81
|
+
if self.created_at is None and "created_at" in self.model_fields_set:
|
|
82
|
+
_dict['created_at'] = None
|
|
83
|
+
|
|
84
|
+
# set to None if updated_at (nullable) is None
|
|
85
|
+
# and model_fields_set contains the field
|
|
86
|
+
if self.updated_at is None and "updated_at" in self.model_fields_set:
|
|
87
|
+
_dict['updated_at'] = None
|
|
88
|
+
|
|
89
|
+
return _dict
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
|
+
"""Create an instance of DirectiveResponse from a dict"""
|
|
94
|
+
if obj is None:
|
|
95
|
+
return None
|
|
96
|
+
|
|
97
|
+
if not isinstance(obj, dict):
|
|
98
|
+
return cls.model_validate(obj)
|
|
99
|
+
|
|
100
|
+
_obj = cls.model_validate({
|
|
101
|
+
"id": obj.get("id"),
|
|
102
|
+
"bank_id": obj.get("bank_id"),
|
|
103
|
+
"name": obj.get("name"),
|
|
104
|
+
"content": obj.get("content"),
|
|
105
|
+
"priority": obj.get("priority") if obj.get("priority") is not None else 0,
|
|
106
|
+
"is_active": obj.get("is_active") if obj.get("is_active") is not None else True,
|
|
107
|
+
"tags": obj.get("tags"),
|
|
108
|
+
"created_at": obj.get("created_at"),
|
|
109
|
+
"updated_at": obj.get("updated_at")
|
|
110
|
+
})
|
|
111
|
+
return _obj
|
|
112
|
+
|
|
113
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hindsight HTTP API
|
|
5
|
+
|
|
6
|
+
HTTP API for Hindsight
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.4.0
|
|
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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class FeaturesInfo(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Feature flags indicating which capabilities are enabled.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
observations: StrictBool = Field(description="Whether observations (auto-consolidation) are enabled")
|
|
30
|
+
mcp: StrictBool = Field(description="Whether MCP (Model Context Protocol) server is enabled")
|
|
31
|
+
worker: StrictBool = Field(description="Whether the background worker is enabled")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["observations", "mcp", "worker"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of FeaturesInfo from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([
|
|
66
|
+
])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of FeaturesInfo from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate({
|
|
85
|
+
"observations": obj.get("observations"),
|
|
86
|
+
"mcp": obj.get("mcp"),
|
|
87
|
+
"worker": obj.get("worker")
|
|
88
|
+
})
|
|
89
|
+
return _obj
|
|
90
|
+
|
|
91
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hindsight HTTP API
|
|
5
|
+
|
|
6
|
+
HTTP API for Hindsight
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 0.4.0
|
|
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
|
|
22
|
+
from hindsight_client_api.models.mental_model_response import MentalModelResponse
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class MentalModelListResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Response model for listing mental models.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
items: List[MentalModelResponse]
|
|
31
|
+
__properties: ClassVar[List[str]] = ["items"]
|
|
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 MentalModelListResponse 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 items (list)
|
|
73
|
+
_items = []
|
|
74
|
+
if self.items:
|
|
75
|
+
for _item_items in self.items:
|
|
76
|
+
if _item_items:
|
|
77
|
+
_items.append(_item_items.to_dict())
|
|
78
|
+
_dict['items'] = _items
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of MentalModelListResponse 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
|
+
"items": [MentalModelResponse.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|