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.
Files changed (89) hide show
  1. hindsight_client/__init__.py +9 -8
  2. hindsight_client/hindsight_client.py +394 -59
  3. {hindsight_client-0.3.0.dist-info → hindsight_client-0.4.1.dist-info}/METADATA +1 -1
  4. hindsight_client-0.4.1.dist-info/RECORD +89 -0
  5. hindsight_client_api/__init__.py +26 -2
  6. hindsight_client_api/api/__init__.py +2 -0
  7. hindsight_client_api/api/banks_api.py +998 -132
  8. hindsight_client_api/api/directives_api.py +1619 -0
  9. hindsight_client_api/api/documents_api.py +1 -1
  10. hindsight_client_api/api/entities_api.py +10 -7
  11. hindsight_client_api/api/memory_api.py +1 -1
  12. hindsight_client_api/api/mental_models_api.py +1897 -0
  13. hindsight_client_api/api/monitoring_api.py +247 -1
  14. hindsight_client_api/api/operations_api.py +351 -5
  15. hindsight_client_api/api_client.py +1 -1
  16. hindsight_client_api/configuration.py +2 -2
  17. hindsight_client_api/exceptions.py +1 -1
  18. hindsight_client_api/models/__init__.py +23 -1
  19. hindsight_client_api/models/add_background_request.py +3 -3
  20. hindsight_client_api/models/async_operation_submit_response.py +89 -0
  21. hindsight_client_api/models/background_response.py +11 -4
  22. hindsight_client_api/models/bank_list_item.py +7 -7
  23. hindsight_client_api/models/bank_list_response.py +1 -1
  24. hindsight_client_api/models/bank_profile_response.py +12 -5
  25. hindsight_client_api/models/bank_stats_response.py +16 -5
  26. hindsight_client_api/models/budget.py +1 -1
  27. hindsight_client_api/models/cancel_operation_response.py +1 -1
  28. hindsight_client_api/models/chunk_data.py +1 -1
  29. hindsight_client_api/models/chunk_include_options.py +1 -1
  30. hindsight_client_api/models/chunk_response.py +1 -1
  31. hindsight_client_api/models/consolidation_response.py +89 -0
  32. hindsight_client_api/models/create_bank_request.py +9 -2
  33. hindsight_client_api/models/create_directive_request.py +95 -0
  34. hindsight_client_api/models/create_mental_model_request.py +100 -0
  35. hindsight_client_api/models/create_mental_model_response.py +87 -0
  36. hindsight_client_api/models/delete_document_response.py +1 -1
  37. hindsight_client_api/models/delete_response.py +1 -1
  38. hindsight_client_api/models/directive_list_response.py +95 -0
  39. hindsight_client_api/models/directive_response.py +113 -0
  40. hindsight_client_api/models/disposition_traits.py +1 -1
  41. hindsight_client_api/models/document_response.py +1 -1
  42. hindsight_client_api/models/entity_detail_response.py +1 -1
  43. hindsight_client_api/models/entity_include_options.py +1 -1
  44. hindsight_client_api/models/entity_input.py +1 -1
  45. hindsight_client_api/models/entity_list_item.py +1 -1
  46. hindsight_client_api/models/entity_list_response.py +1 -1
  47. hindsight_client_api/models/entity_observation_response.py +1 -1
  48. hindsight_client_api/models/entity_state_response.py +1 -1
  49. hindsight_client_api/models/features_info.py +91 -0
  50. hindsight_client_api/models/graph_data_response.py +1 -1
  51. hindsight_client_api/models/http_validation_error.py +1 -1
  52. hindsight_client_api/models/include_options.py +1 -1
  53. hindsight_client_api/models/list_documents_response.py +1 -1
  54. hindsight_client_api/models/list_memory_units_response.py +1 -1
  55. hindsight_client_api/models/list_tags_response.py +1 -1
  56. hindsight_client_api/models/memory_item.py +1 -1
  57. hindsight_client_api/models/mental_model_list_response.py +95 -0
  58. hindsight_client_api/models/mental_model_response.py +126 -0
  59. hindsight_client_api/models/mental_model_trigger.py +87 -0
  60. hindsight_client_api/models/operation_response.py +2 -2
  61. hindsight_client_api/models/operation_status_response.py +131 -0
  62. hindsight_client_api/models/operations_list_response.py +9 -3
  63. hindsight_client_api/models/recall_request.py +1 -1
  64. hindsight_client_api/models/recall_response.py +1 -1
  65. hindsight_client_api/models/recall_result.py +1 -1
  66. hindsight_client_api/models/reflect_based_on.py +115 -0
  67. hindsight_client_api/models/reflect_directive.py +91 -0
  68. hindsight_client_api/models/reflect_fact.py +1 -1
  69. hindsight_client_api/models/reflect_include_options.py +14 -3
  70. hindsight_client_api/models/reflect_llm_call.py +89 -0
  71. hindsight_client_api/models/reflect_mental_model.py +96 -0
  72. hindsight_client_api/models/reflect_request.py +1 -1
  73. hindsight_client_api/models/reflect_response.py +24 -12
  74. hindsight_client_api/models/reflect_tool_call.py +100 -0
  75. hindsight_client_api/models/reflect_trace.py +105 -0
  76. hindsight_client_api/models/retain_request.py +1 -1
  77. hindsight_client_api/models/retain_response.py +1 -1
  78. hindsight_client_api/models/tag_item.py +1 -1
  79. hindsight_client_api/models/token_usage.py +1 -1
  80. hindsight_client_api/models/tool_calls_include_options.py +87 -0
  81. hindsight_client_api/models/update_directive_request.py +120 -0
  82. hindsight_client_api/models/update_disposition_request.py +1 -1
  83. hindsight_client_api/models/update_mental_model_request.py +125 -0
  84. hindsight_client_api/models/validation_error.py +1 -1
  85. hindsight_client_api/models/validation_error_loc_inner.py +1 -1
  86. hindsight_client_api/models/version_response.py +93 -0
  87. hindsight_client_api/rest.py +1 -1
  88. hindsight_client-0.3.0.dist-info/RECORD +0 -65
  89. {hindsight_client-0.3.0.dist-info → hindsight_client-0.4.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,126 @@
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, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from hindsight_client_api.models.mental_model_trigger import MentalModelTrigger
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class MentalModelResponse(BaseModel):
27
+ """
28
+ Response model for a mental model (stored reflect response).
29
+ """ # noqa: E501
30
+ id: StrictStr
31
+ bank_id: StrictStr
32
+ name: StrictStr
33
+ source_query: StrictStr
34
+ content: StrictStr
35
+ tags: Optional[List[StrictStr]] = None
36
+ max_tokens: Optional[StrictInt] = 2048
37
+ trigger: Optional[MentalModelTrigger] = None
38
+ last_refreshed_at: Optional[StrictStr] = None
39
+ created_at: Optional[StrictStr] = None
40
+ reflect_response: Optional[Dict[str, Any]] = None
41
+ __properties: ClassVar[List[str]] = ["id", "bank_id", "name", "source_query", "content", "tags", "max_tokens", "trigger", "last_refreshed_at", "created_at", "reflect_response"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of MentalModelResponse from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ # override the default output from pydantic by calling `to_dict()` of trigger
83
+ if self.trigger:
84
+ _dict['trigger'] = self.trigger.to_dict()
85
+ # set to None if last_refreshed_at (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.last_refreshed_at is None and "last_refreshed_at" in self.model_fields_set:
88
+ _dict['last_refreshed_at'] = None
89
+
90
+ # set to None if created_at (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.created_at is None and "created_at" in self.model_fields_set:
93
+ _dict['created_at'] = None
94
+
95
+ # set to None if reflect_response (nullable) is None
96
+ # and model_fields_set contains the field
97
+ if self.reflect_response is None and "reflect_response" in self.model_fields_set:
98
+ _dict['reflect_response'] = None
99
+
100
+ return _dict
101
+
102
+ @classmethod
103
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104
+ """Create an instance of MentalModelResponse from a dict"""
105
+ if obj is None:
106
+ return None
107
+
108
+ if not isinstance(obj, dict):
109
+ return cls.model_validate(obj)
110
+
111
+ _obj = cls.model_validate({
112
+ "id": obj.get("id"),
113
+ "bank_id": obj.get("bank_id"),
114
+ "name": obj.get("name"),
115
+ "source_query": obj.get("source_query"),
116
+ "content": obj.get("content"),
117
+ "tags": obj.get("tags"),
118
+ "max_tokens": obj.get("max_tokens") if obj.get("max_tokens") is not None else 2048,
119
+ "trigger": MentalModelTrigger.from_dict(obj["trigger"]) if obj.get("trigger") is not None else None,
120
+ "last_refreshed_at": obj.get("last_refreshed_at"),
121
+ "created_at": obj.get("created_at"),
122
+ "reflect_response": obj.get("reflect_response")
123
+ })
124
+ return _obj
125
+
126
+
@@ -0,0 +1,87 @@
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, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class MentalModelTrigger(BaseModel):
26
+ """
27
+ Trigger settings for a mental model.
28
+ """ # noqa: E501
29
+ refresh_after_consolidation: Optional[StrictBool] = Field(default=False, description="If true, refresh this mental model after observations consolidation (real-time mode)")
30
+ __properties: ClassVar[List[str]] = ["refresh_after_consolidation"]
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 MentalModelTrigger 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 MentalModelTrigger 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
+ "refresh_after_consolidation": obj.get("refresh_after_consolidation") if obj.get("refresh_after_consolidation") is not None else False
84
+ })
85
+ return _obj
86
+
87
+
@@ -5,7 +5,7 @@
5
5
 
6
6
  HTTP API for Hindsight
7
7
 
8
- The version of the OpenAPI document: 0.1.0
8
+ The version of the OpenAPI document: 0.4.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -29,7 +29,7 @@ class OperationResponse(BaseModel):
29
29
  id: StrictStr
30
30
  task_type: StrictStr
31
31
  items_count: StrictInt
32
- document_id: Optional[StrictStr]
32
+ document_id: Optional[StrictStr] = None
33
33
  created_at: StrictStr
34
34
  status: StrictStr
35
35
  error_message: Optional[StrictStr]
@@ -0,0 +1,131 @@
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, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class OperationStatusResponse(BaseModel):
26
+ """
27
+ Response model for getting a single operation status.
28
+ """ # noqa: E501
29
+ operation_id: StrictStr
30
+ status: StrictStr
31
+ operation_type: Optional[StrictStr] = None
32
+ created_at: Optional[StrictStr] = None
33
+ updated_at: Optional[StrictStr] = None
34
+ completed_at: Optional[StrictStr] = None
35
+ error_message: Optional[StrictStr] = None
36
+ __properties: ClassVar[List[str]] = ["operation_id", "status", "operation_type", "created_at", "updated_at", "completed_at", "error_message"]
37
+
38
+ @field_validator('status')
39
+ def status_validate_enum(cls, value):
40
+ """Validates the enum"""
41
+ if value not in set(['pending', 'completed', 'failed', 'not_found']):
42
+ raise ValueError("must be one of enum values ('pending', 'completed', 'failed', 'not_found')")
43
+ return value
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 OperationStatusResponse 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
+ # set to None if operation_type (nullable) is None
85
+ # and model_fields_set contains the field
86
+ if self.operation_type is None and "operation_type" in self.model_fields_set:
87
+ _dict['operation_type'] = None
88
+
89
+ # set to None if created_at (nullable) is None
90
+ # and model_fields_set contains the field
91
+ if self.created_at is None and "created_at" in self.model_fields_set:
92
+ _dict['created_at'] = None
93
+
94
+ # set to None if updated_at (nullable) is None
95
+ # and model_fields_set contains the field
96
+ if self.updated_at is None and "updated_at" in self.model_fields_set:
97
+ _dict['updated_at'] = None
98
+
99
+ # set to None if completed_at (nullable) is None
100
+ # and model_fields_set contains the field
101
+ if self.completed_at is None and "completed_at" in self.model_fields_set:
102
+ _dict['completed_at'] = None
103
+
104
+ # set to None if error_message (nullable) is None
105
+ # and model_fields_set contains the field
106
+ if self.error_message is None and "error_message" in self.model_fields_set:
107
+ _dict['error_message'] = None
108
+
109
+ return _dict
110
+
111
+ @classmethod
112
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
113
+ """Create an instance of OperationStatusResponse from a dict"""
114
+ if obj is None:
115
+ return None
116
+
117
+ if not isinstance(obj, dict):
118
+ return cls.model_validate(obj)
119
+
120
+ _obj = cls.model_validate({
121
+ "operation_id": obj.get("operation_id"),
122
+ "status": obj.get("status"),
123
+ "operation_type": obj.get("operation_type"),
124
+ "created_at": obj.get("created_at"),
125
+ "updated_at": obj.get("updated_at"),
126
+ "completed_at": obj.get("completed_at"),
127
+ "error_message": obj.get("error_message")
128
+ })
129
+ return _obj
130
+
131
+
@@ -5,7 +5,7 @@
5
5
 
6
6
  HTTP API for Hindsight
7
7
 
8
- The version of the OpenAPI document: 0.1.0
8
+ The version of the OpenAPI document: 0.4.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -17,7 +17,7 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List
22
22
  from hindsight_client_api.models.operation_response import OperationResponse
23
23
  from typing import Optional, Set
@@ -28,8 +28,11 @@ class OperationsListResponse(BaseModel):
28
28
  Response model for list operations endpoint.
29
29
  """ # noqa: E501
30
30
  bank_id: StrictStr
31
+ total: StrictInt
32
+ limit: StrictInt
33
+ offset: StrictInt
31
34
  operations: List[OperationResponse]
32
- __properties: ClassVar[List[str]] = ["bank_id", "operations"]
35
+ __properties: ClassVar[List[str]] = ["bank_id", "total", "limit", "offset", "operations"]
33
36
 
34
37
  model_config = ConfigDict(
35
38
  populate_by_name=True,
@@ -90,6 +93,9 @@ class OperationsListResponse(BaseModel):
90
93
 
91
94
  _obj = cls.model_validate({
92
95
  "bank_id": obj.get("bank_id"),
96
+ "total": obj.get("total"),
97
+ "limit": obj.get("limit"),
98
+ "offset": obj.get("offset"),
93
99
  "operations": [OperationResponse.from_dict(_item) for _item in obj["operations"]] if obj.get("operations") is not None else None
94
100
  })
95
101
  return _obj
@@ -5,7 +5,7 @@
5
5
 
6
6
  HTTP API for Hindsight
7
7
 
8
- The version of the OpenAPI document: 0.1.0
8
+ The version of the OpenAPI document: 0.4.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  HTTP API for Hindsight
7
7
 
8
- The version of the OpenAPI document: 0.1.0
8
+ The version of the OpenAPI document: 0.4.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  HTTP API for Hindsight
7
7
 
8
- The version of the OpenAPI document: 0.1.0
8
+ The version of the OpenAPI document: 0.4.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -0,0 +1,115 @@
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from hindsight_client_api.models.reflect_directive import ReflectDirective
23
+ from hindsight_client_api.models.reflect_fact import ReflectFact
24
+ from hindsight_client_api.models.reflect_mental_model import ReflectMentalModel
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class ReflectBasedOn(BaseModel):
29
+ """
30
+ Evidence the response is based on: memories, mental models, and directives.
31
+ """ # noqa: E501
32
+ memories: Optional[List[ReflectFact]] = Field(default=None, description="Memory facts used to generate the response")
33
+ mental_models: Optional[List[ReflectMentalModel]] = Field(default=None, description="Mental models used during reflection")
34
+ directives: Optional[List[ReflectDirective]] = Field(default=None, description="Directives applied during reflection")
35
+ __properties: ClassVar[List[str]] = ["memories", "mental_models", "directives"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of ReflectBasedOn from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # override the default output from pydantic by calling `to_dict()` of each item in memories (list)
77
+ _items = []
78
+ if self.memories:
79
+ for _item_memories in self.memories:
80
+ if _item_memories:
81
+ _items.append(_item_memories.to_dict())
82
+ _dict['memories'] = _items
83
+ # override the default output from pydantic by calling `to_dict()` of each item in mental_models (list)
84
+ _items = []
85
+ if self.mental_models:
86
+ for _item_mental_models in self.mental_models:
87
+ if _item_mental_models:
88
+ _items.append(_item_mental_models.to_dict())
89
+ _dict['mental_models'] = _items
90
+ # override the default output from pydantic by calling `to_dict()` of each item in directives (list)
91
+ _items = []
92
+ if self.directives:
93
+ for _item_directives in self.directives:
94
+ if _item_directives:
95
+ _items.append(_item_directives.to_dict())
96
+ _dict['directives'] = _items
97
+ return _dict
98
+
99
+ @classmethod
100
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
101
+ """Create an instance of ReflectBasedOn from a dict"""
102
+ if obj is None:
103
+ return None
104
+
105
+ if not isinstance(obj, dict):
106
+ return cls.model_validate(obj)
107
+
108
+ _obj = cls.model_validate({
109
+ "memories": [ReflectFact.from_dict(_item) for _item in obj["memories"]] if obj.get("memories") is not None else None,
110
+ "mental_models": [ReflectMentalModel.from_dict(_item) for _item in obj["mental_models"]] if obj.get("mental_models") is not None else None,
111
+ "directives": [ReflectDirective.from_dict(_item) for _item in obj["directives"]] if obj.get("directives") is not None else None
112
+ })
113
+ return _obj
114
+
115
+
@@ -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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class ReflectDirective(BaseModel):
26
+ """
27
+ A directive applied during reflect.
28
+ """ # noqa: E501
29
+ id: StrictStr = Field(description="Directive ID")
30
+ name: StrictStr = Field(description="Directive name")
31
+ content: StrictStr = Field(description="Directive content")
32
+ __properties: ClassVar[List[str]] = ["id", "name", "content"]
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 ReflectDirective 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 ReflectDirective 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
+ "id": obj.get("id"),
86
+ "name": obj.get("name"),
87
+ "content": obj.get("content")
88
+ })
89
+ return _obj
90
+
91
+
@@ -5,7 +5,7 @@
5
5
 
6
6
  HTTP API for Hindsight
7
7
 
8
- The version of the OpenAPI document: 0.1.0
8
+ The version of the OpenAPI document: 0.4.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.