hindsight-client 0.0.13__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 +26 -0
- hindsight_client/hindsight_client.py +432 -0
- hindsight_client-0.0.13.dist-info/METADATA +56 -0
- hindsight_client-0.0.13.dist-info/RECORD +134 -0
- hindsight_client-0.0.13.dist-info/WHEEL +4 -0
- hindsight_client_api/__init__.py +126 -0
- hindsight_client_api/api/__init__.py +6 -0
- hindsight_client_api/api/default_api.py +5976 -0
- hindsight_client_api/api/monitoring_api.py +281 -0
- hindsight_client_api/api_client.py +807 -0
- hindsight_client_api/api_response.py +21 -0
- hindsight_client_api/configuration.py +572 -0
- hindsight_client_api/docs/AddBackgroundRequest.md +31 -0
- hindsight_client_api/docs/BackgroundResponse.md +31 -0
- hindsight_client_api/docs/BankListItem.md +35 -0
- hindsight_client_api/docs/BankListResponse.md +30 -0
- hindsight_client_api/docs/BankProfileResponse.md +33 -0
- hindsight_client_api/docs/Budget.md +15 -0
- hindsight_client_api/docs/ChunkData.md +33 -0
- hindsight_client_api/docs/ChunkIncludeOptions.md +30 -0
- hindsight_client_api/docs/ChunkResponse.md +35 -0
- hindsight_client_api/docs/CreateBankRequest.md +32 -0
- hindsight_client_api/docs/DefaultApi.md +1569 -0
- hindsight_client_api/docs/DeleteResponse.md +30 -0
- hindsight_client_api/docs/DocumentResponse.md +36 -0
- hindsight_client_api/docs/EntityDetailResponse.md +36 -0
- hindsight_client_api/docs/EntityIncludeOptions.md +30 -0
- hindsight_client_api/docs/EntityListItem.md +35 -0
- hindsight_client_api/docs/EntityListResponse.md +30 -0
- hindsight_client_api/docs/EntityObservationResponse.md +31 -0
- hindsight_client_api/docs/EntityStateResponse.md +32 -0
- hindsight_client_api/docs/GraphDataResponse.md +33 -0
- hindsight_client_api/docs/HTTPValidationError.md +29 -0
- hindsight_client_api/docs/IncludeOptions.md +31 -0
- hindsight_client_api/docs/ListDocumentsResponse.md +33 -0
- hindsight_client_api/docs/ListMemoryUnitsResponse.md +33 -0
- hindsight_client_api/docs/MemoryItem.md +34 -0
- hindsight_client_api/docs/MetadataFilter.md +32 -0
- hindsight_client_api/docs/MonitoringApi.md +72 -0
- hindsight_client_api/docs/PersonalityTraits.md +35 -0
- hindsight_client_api/docs/RecallRequest.md +37 -0
- hindsight_client_api/docs/RecallResponse.md +33 -0
- hindsight_client_api/docs/RecallResult.md +40 -0
- hindsight_client_api/docs/ReflectFact.md +35 -0
- hindsight_client_api/docs/ReflectIncludeOptions.md +30 -0
- hindsight_client_api/docs/ReflectRequest.md +34 -0
- hindsight_client_api/docs/ReflectResponse.md +31 -0
- hindsight_client_api/docs/RetainRequest.md +31 -0
- hindsight_client_api/docs/RetainResponse.md +33 -0
- hindsight_client_api/docs/UpdatePersonalityRequest.md +30 -0
- hindsight_client_api/docs/ValidationError.md +31 -0
- hindsight_client_api/docs/ValidationErrorLocInner.md +28 -0
- hindsight_client_api/exceptions.py +219 -0
- hindsight_client_api/models/__init__.py +54 -0
- hindsight_client_api/models/add_background_request.py +89 -0
- hindsight_client_api/models/background_response.py +98 -0
- hindsight_client_api/models/bank_list_item.py +111 -0
- hindsight_client_api/models/bank_list_response.py +95 -0
- hindsight_client_api/models/bank_profile_response.py +97 -0
- hindsight_client_api/models/budget.py +38 -0
- hindsight_client_api/models/chunk_data.py +93 -0
- hindsight_client_api/models/chunk_include_options.py +87 -0
- hindsight_client_api/models/chunk_response.py +97 -0
- hindsight_client_api/models/create_bank_request.py +110 -0
- hindsight_client_api/models/delete_response.py +87 -0
- hindsight_client_api/models/document_response.py +104 -0
- hindsight_client_api/models/entity_detail_response.py +122 -0
- hindsight_client_api/models/entity_include_options.py +87 -0
- hindsight_client_api/models/entity_list_item.py +112 -0
- hindsight_client_api/models/entity_list_response.py +95 -0
- hindsight_client_api/models/entity_observation_response.py +94 -0
- hindsight_client_api/models/entity_state_response.py +99 -0
- hindsight_client_api/models/graph_data_response.py +93 -0
- hindsight_client_api/models/http_validation_error.py +95 -0
- hindsight_client_api/models/include_options.py +107 -0
- hindsight_client_api/models/list_documents_response.py +93 -0
- hindsight_client_api/models/list_memory_units_response.py +93 -0
- hindsight_client_api/models/memory_item.py +116 -0
- hindsight_client_api/models/metadata_filter.py +96 -0
- hindsight_client_api/models/personality_traits.py +98 -0
- hindsight_client_api/models/recall_request.py +129 -0
- hindsight_client_api/models/recall_response.py +142 -0
- hindsight_client_api/models/recall_result.py +152 -0
- hindsight_client_api/models/reflect_fact.py +122 -0
- hindsight_client_api/models/reflect_include_options.py +87 -0
- hindsight_client_api/models/reflect_request.py +118 -0
- hindsight_client_api/models/reflect_response.py +97 -0
- hindsight_client_api/models/retain_request.py +97 -0
- hindsight_client_api/models/retain_response.py +93 -0
- hindsight_client_api/models/update_personality_request.py +91 -0
- hindsight_client_api/models/validation_error.py +99 -0
- hindsight_client_api/models/validation_error_loc_inner.py +138 -0
- hindsight_client_api/rest.py +213 -0
- hindsight_client_api/test/__init__.py +0 -0
- hindsight_client_api/test/test_add_background_request.py +53 -0
- hindsight_client_api/test/test_background_response.py +53 -0
- hindsight_client_api/test/test_bank_list_item.py +60 -0
- hindsight_client_api/test/test_bank_list_response.py +68 -0
- hindsight_client_api/test/test_bank_profile_response.py +58 -0
- hindsight_client_api/test/test_budget.py +33 -0
- hindsight_client_api/test/test_chunk_data.py +57 -0
- hindsight_client_api/test/test_chunk_include_options.py +51 -0
- hindsight_client_api/test/test_chunk_response.py +62 -0
- hindsight_client_api/test/test_create_bank_request.py +53 -0
- hindsight_client_api/test/test_default_api.py +178 -0
- hindsight_client_api/test/test_delete_response.py +52 -0
- hindsight_client_api/test/test_document_response.py +64 -0
- hindsight_client_api/test/test_entity_detail_response.py +71 -0
- hindsight_client_api/test/test_entity_include_options.py +51 -0
- hindsight_client_api/test/test_entity_list_item.py +61 -0
- hindsight_client_api/test/test_entity_list_response.py +56 -0
- hindsight_client_api/test/test_entity_observation_response.py +53 -0
- hindsight_client_api/test/test_entity_state_response.py +64 -0
- hindsight_client_api/test/test_graph_data_response.py +82 -0
- hindsight_client_api/test/test_http_validation_error.py +58 -0
- hindsight_client_api/test/test_include_options.py +54 -0
- hindsight_client_api/test/test_list_documents_response.py +66 -0
- hindsight_client_api/test/test_list_memory_units_response.py +66 -0
- hindsight_client_api/test/test_memory_item.py +58 -0
- hindsight_client_api/test/test_metadata_filter.py +54 -0
- hindsight_client_api/test/test_monitoring_api.py +38 -0
- hindsight_client_api/test/test_personality_traits.py +62 -0
- hindsight_client_api/test/test_recall_request.py +67 -0
- hindsight_client_api/test/test_recall_response.py +76 -0
- hindsight_client_api/test/test_recall_result.py +67 -0
- hindsight_client_api/test/test_reflect_fact.py +57 -0
- hindsight_client_api/test/test_reflect_include_options.py +51 -0
- hindsight_client_api/test/test_reflect_request.py +59 -0
- hindsight_client_api/test/test_reflect_response.py +55 -0
- hindsight_client_api/test/test_retain_request.py +57 -0
- hindsight_client_api/test/test_retain_response.py +58 -0
- hindsight_client_api/test/test_update_personality_request.py +52 -0
- hindsight_client_api/test/test_validation_error.py +60 -0
- hindsight_client_api/test/test_validation_error_loc_inner.py +50 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hindsight HTTP API
|
|
5
|
+
|
|
6
|
+
HTTP API for Hindsight
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.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, Optional
|
|
22
|
+
from hindsight_client_api.models.chunk_data import ChunkData
|
|
23
|
+
from hindsight_client_api.models.entity_state_response import EntityStateResponse
|
|
24
|
+
from hindsight_client_api.models.recall_result import RecallResult
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class RecallResponse(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Response model for recall endpoints.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
results: List[RecallResult]
|
|
33
|
+
trace: Optional[Dict[str, Any]] = None
|
|
34
|
+
entities: Optional[Dict[str, EntityStateResponse]] = None
|
|
35
|
+
chunks: Optional[Dict[str, ChunkData]] = None
|
|
36
|
+
__properties: ClassVar[List[str]] = ["results", "trace", "entities", "chunks"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
populate_by_name=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
56
|
+
"""Create an instance of RecallResponse from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
|
61
|
+
|
|
62
|
+
This has the following differences from calling pydantic's
|
|
63
|
+
`self.model_dump(by_alias=True)`:
|
|
64
|
+
|
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
|
66
|
+
were set at model initialization. Other fields with value `None`
|
|
67
|
+
are ignored.
|
|
68
|
+
"""
|
|
69
|
+
excluded_fields: Set[str] = set([
|
|
70
|
+
])
|
|
71
|
+
|
|
72
|
+
_dict = self.model_dump(
|
|
73
|
+
by_alias=True,
|
|
74
|
+
exclude=excluded_fields,
|
|
75
|
+
exclude_none=True,
|
|
76
|
+
)
|
|
77
|
+
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
|
78
|
+
_items = []
|
|
79
|
+
if self.results:
|
|
80
|
+
for _item_results in self.results:
|
|
81
|
+
if _item_results:
|
|
82
|
+
_items.append(_item_results.to_dict())
|
|
83
|
+
_dict['results'] = _items
|
|
84
|
+
# override the default output from pydantic by calling `to_dict()` of each value in entities (dict)
|
|
85
|
+
_field_dict = {}
|
|
86
|
+
if self.entities:
|
|
87
|
+
for _key_entities in self.entities:
|
|
88
|
+
if self.entities[_key_entities]:
|
|
89
|
+
_field_dict[_key_entities] = self.entities[_key_entities].to_dict()
|
|
90
|
+
_dict['entities'] = _field_dict
|
|
91
|
+
# override the default output from pydantic by calling `to_dict()` of each value in chunks (dict)
|
|
92
|
+
_field_dict = {}
|
|
93
|
+
if self.chunks:
|
|
94
|
+
for _key_chunks in self.chunks:
|
|
95
|
+
if self.chunks[_key_chunks]:
|
|
96
|
+
_field_dict[_key_chunks] = self.chunks[_key_chunks].to_dict()
|
|
97
|
+
_dict['chunks'] = _field_dict
|
|
98
|
+
# set to None if trace (nullable) is None
|
|
99
|
+
# and model_fields_set contains the field
|
|
100
|
+
if self.trace is None and "trace" in self.model_fields_set:
|
|
101
|
+
_dict['trace'] = None
|
|
102
|
+
|
|
103
|
+
# set to None if entities (nullable) is None
|
|
104
|
+
# and model_fields_set contains the field
|
|
105
|
+
if self.entities is None and "entities" in self.model_fields_set:
|
|
106
|
+
_dict['entities'] = None
|
|
107
|
+
|
|
108
|
+
# set to None if chunks (nullable) is None
|
|
109
|
+
# and model_fields_set contains the field
|
|
110
|
+
if self.chunks is None and "chunks" in self.model_fields_set:
|
|
111
|
+
_dict['chunks'] = None
|
|
112
|
+
|
|
113
|
+
return _dict
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
117
|
+
"""Create an instance of RecallResponse from a dict"""
|
|
118
|
+
if obj is None:
|
|
119
|
+
return None
|
|
120
|
+
|
|
121
|
+
if not isinstance(obj, dict):
|
|
122
|
+
return cls.model_validate(obj)
|
|
123
|
+
|
|
124
|
+
_obj = cls.model_validate({
|
|
125
|
+
"results": [RecallResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
|
126
|
+
"trace": obj.get("trace"),
|
|
127
|
+
"entities": dict(
|
|
128
|
+
(_k, EntityStateResponse.from_dict(_v))
|
|
129
|
+
for _k, _v in obj["entities"].items()
|
|
130
|
+
)
|
|
131
|
+
if obj.get("entities") is not None
|
|
132
|
+
else None,
|
|
133
|
+
"chunks": dict(
|
|
134
|
+
(_k, ChunkData.from_dict(_v))
|
|
135
|
+
for _k, _v in obj["chunks"].items()
|
|
136
|
+
)
|
|
137
|
+
if obj.get("chunks") is not None
|
|
138
|
+
else None
|
|
139
|
+
})
|
|
140
|
+
return _obj
|
|
141
|
+
|
|
142
|
+
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hindsight HTTP API
|
|
5
|
+
|
|
6
|
+
HTTP API for Hindsight
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class RecallResult(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Single recall result item.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
id: StrictStr
|
|
30
|
+
text: StrictStr
|
|
31
|
+
type: Optional[StrictStr] = None
|
|
32
|
+
entities: Optional[List[StrictStr]] = None
|
|
33
|
+
context: Optional[StrictStr] = None
|
|
34
|
+
occurred_start: Optional[StrictStr] = None
|
|
35
|
+
occurred_end: Optional[StrictStr] = None
|
|
36
|
+
mentioned_at: Optional[StrictStr] = None
|
|
37
|
+
document_id: Optional[StrictStr] = None
|
|
38
|
+
metadata: Optional[Dict[str, StrictStr]] = None
|
|
39
|
+
chunk_id: Optional[StrictStr] = None
|
|
40
|
+
__properties: ClassVar[List[str]] = ["id", "text", "type", "entities", "context", "occurred_start", "occurred_end", "mentioned_at", "document_id", "metadata", "chunk_id"]
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
populate_by_name=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def to_str(self) -> str:
|
|
50
|
+
"""Returns the string representation of the model using alias"""
|
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
52
|
+
|
|
53
|
+
def to_json(self) -> str:
|
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
56
|
+
return json.dumps(self.to_dict())
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
|
+
"""Create an instance of RecallResult from a JSON string"""
|
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
|
65
|
+
|
|
66
|
+
This has the following differences from calling pydantic's
|
|
67
|
+
`self.model_dump(by_alias=True)`:
|
|
68
|
+
|
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
|
70
|
+
were set at model initialization. Other fields with value `None`
|
|
71
|
+
are ignored.
|
|
72
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
_dict = self.model_dump(
|
|
77
|
+
by_alias=True,
|
|
78
|
+
exclude=excluded_fields,
|
|
79
|
+
exclude_none=True,
|
|
80
|
+
)
|
|
81
|
+
# set to None if type (nullable) is None
|
|
82
|
+
# and model_fields_set contains the field
|
|
83
|
+
if self.type is None and "type" in self.model_fields_set:
|
|
84
|
+
_dict['type'] = None
|
|
85
|
+
|
|
86
|
+
# set to None if entities (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.entities is None and "entities" in self.model_fields_set:
|
|
89
|
+
_dict['entities'] = None
|
|
90
|
+
|
|
91
|
+
# set to None if context (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.context is None and "context" in self.model_fields_set:
|
|
94
|
+
_dict['context'] = None
|
|
95
|
+
|
|
96
|
+
# set to None if occurred_start (nullable) is None
|
|
97
|
+
# and model_fields_set contains the field
|
|
98
|
+
if self.occurred_start is None and "occurred_start" in self.model_fields_set:
|
|
99
|
+
_dict['occurred_start'] = None
|
|
100
|
+
|
|
101
|
+
# set to None if occurred_end (nullable) is None
|
|
102
|
+
# and model_fields_set contains the field
|
|
103
|
+
if self.occurred_end is None and "occurred_end" in self.model_fields_set:
|
|
104
|
+
_dict['occurred_end'] = None
|
|
105
|
+
|
|
106
|
+
# set to None if mentioned_at (nullable) is None
|
|
107
|
+
# and model_fields_set contains the field
|
|
108
|
+
if self.mentioned_at is None and "mentioned_at" in self.model_fields_set:
|
|
109
|
+
_dict['mentioned_at'] = None
|
|
110
|
+
|
|
111
|
+
# set to None if document_id (nullable) is None
|
|
112
|
+
# and model_fields_set contains the field
|
|
113
|
+
if self.document_id is None and "document_id" in self.model_fields_set:
|
|
114
|
+
_dict['document_id'] = None
|
|
115
|
+
|
|
116
|
+
# set to None if metadata (nullable) is None
|
|
117
|
+
# and model_fields_set contains the field
|
|
118
|
+
if self.metadata is None and "metadata" in self.model_fields_set:
|
|
119
|
+
_dict['metadata'] = None
|
|
120
|
+
|
|
121
|
+
# set to None if chunk_id (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.chunk_id is None and "chunk_id" in self.model_fields_set:
|
|
124
|
+
_dict['chunk_id'] = None
|
|
125
|
+
|
|
126
|
+
return _dict
|
|
127
|
+
|
|
128
|
+
@classmethod
|
|
129
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
130
|
+
"""Create an instance of RecallResult from a dict"""
|
|
131
|
+
if obj is None:
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
if not isinstance(obj, dict):
|
|
135
|
+
return cls.model_validate(obj)
|
|
136
|
+
|
|
137
|
+
_obj = cls.model_validate({
|
|
138
|
+
"id": obj.get("id"),
|
|
139
|
+
"text": obj.get("text"),
|
|
140
|
+
"type": obj.get("type"),
|
|
141
|
+
"entities": obj.get("entities"),
|
|
142
|
+
"context": obj.get("context"),
|
|
143
|
+
"occurred_start": obj.get("occurred_start"),
|
|
144
|
+
"occurred_end": obj.get("occurred_end"),
|
|
145
|
+
"mentioned_at": obj.get("mentioned_at"),
|
|
146
|
+
"document_id": obj.get("document_id"),
|
|
147
|
+
"metadata": obj.get("metadata"),
|
|
148
|
+
"chunk_id": obj.get("chunk_id")
|
|
149
|
+
})
|
|
150
|
+
return _obj
|
|
151
|
+
|
|
152
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hindsight HTTP API
|
|
5
|
+
|
|
6
|
+
HTTP API for Hindsight
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class ReflectFact(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
A fact used in think response.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
id: Optional[StrictStr] = None
|
|
30
|
+
text: StrictStr
|
|
31
|
+
type: Optional[StrictStr] = None
|
|
32
|
+
context: Optional[StrictStr] = None
|
|
33
|
+
occurred_start: Optional[StrictStr] = None
|
|
34
|
+
occurred_end: Optional[StrictStr] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["id", "text", "type", "context", "occurred_start", "occurred_end"]
|
|
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 ReflectFact 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
|
+
# set to None if id (nullable) is None
|
|
77
|
+
# and model_fields_set contains the field
|
|
78
|
+
if self.id is None and "id" in self.model_fields_set:
|
|
79
|
+
_dict['id'] = None
|
|
80
|
+
|
|
81
|
+
# set to None if type (nullable) is None
|
|
82
|
+
# and model_fields_set contains the field
|
|
83
|
+
if self.type is None and "type" in self.model_fields_set:
|
|
84
|
+
_dict['type'] = None
|
|
85
|
+
|
|
86
|
+
# set to None if context (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.context is None and "context" in self.model_fields_set:
|
|
89
|
+
_dict['context'] = None
|
|
90
|
+
|
|
91
|
+
# set to None if occurred_start (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.occurred_start is None and "occurred_start" in self.model_fields_set:
|
|
94
|
+
_dict['occurred_start'] = None
|
|
95
|
+
|
|
96
|
+
# set to None if occurred_end (nullable) is None
|
|
97
|
+
# and model_fields_set contains the field
|
|
98
|
+
if self.occurred_end is None and "occurred_end" in self.model_fields_set:
|
|
99
|
+
_dict['occurred_end'] = None
|
|
100
|
+
|
|
101
|
+
return _dict
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
105
|
+
"""Create an instance of ReflectFact from a dict"""
|
|
106
|
+
if obj is None:
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
if not isinstance(obj, dict):
|
|
110
|
+
return cls.model_validate(obj)
|
|
111
|
+
|
|
112
|
+
_obj = cls.model_validate({
|
|
113
|
+
"id": obj.get("id"),
|
|
114
|
+
"text": obj.get("text"),
|
|
115
|
+
"type": obj.get("type"),
|
|
116
|
+
"context": obj.get("context"),
|
|
117
|
+
"occurred_start": obj.get("occurred_start"),
|
|
118
|
+
"occurred_end": obj.get("occurred_end")
|
|
119
|
+
})
|
|
120
|
+
return _obj
|
|
121
|
+
|
|
122
|
+
|
|
@@ -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: 1.0.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 typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class ReflectIncludeOptions(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Options for including additional data in reflect results.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
facts: Optional[Dict[str, Any]] = Field(default=None, description="Options for including facts (based_on) in reflect results.")
|
|
30
|
+
__properties: ClassVar[List[str]] = ["facts"]
|
|
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 ReflectIncludeOptions 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 ReflectIncludeOptions 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
|
+
"facts": obj.get("facts")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hindsight HTTP API
|
|
5
|
+
|
|
6
|
+
HTTP API for Hindsight
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.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, Optional
|
|
22
|
+
from hindsight_client_api.models.budget import Budget
|
|
23
|
+
from hindsight_client_api.models.metadata_filter import MetadataFilter
|
|
24
|
+
from hindsight_client_api.models.reflect_include_options import ReflectIncludeOptions
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class ReflectRequest(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Request model for reflect endpoint.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
query: StrictStr
|
|
33
|
+
budget: Optional[Budget] = None
|
|
34
|
+
context: Optional[StrictStr] = None
|
|
35
|
+
filters: Optional[List[MetadataFilter]] = None
|
|
36
|
+
include: Optional[ReflectIncludeOptions] = Field(default=None, description="Options for including additional data (disabled by default)")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["query", "budget", "context", "filters", "include"]
|
|
38
|
+
|
|
39
|
+
model_config = ConfigDict(
|
|
40
|
+
populate_by_name=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of ReflectRequest from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
"""
|
|
70
|
+
excluded_fields: Set[str] = set([
|
|
71
|
+
])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of each item in filters (list)
|
|
79
|
+
_items = []
|
|
80
|
+
if self.filters:
|
|
81
|
+
for _item_filters in self.filters:
|
|
82
|
+
if _item_filters:
|
|
83
|
+
_items.append(_item_filters.to_dict())
|
|
84
|
+
_dict['filters'] = _items
|
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of include
|
|
86
|
+
if self.include:
|
|
87
|
+
_dict['include'] = self.include.to_dict()
|
|
88
|
+
# set to None if context (nullable) is None
|
|
89
|
+
# and model_fields_set contains the field
|
|
90
|
+
if self.context is None and "context" in self.model_fields_set:
|
|
91
|
+
_dict['context'] = None
|
|
92
|
+
|
|
93
|
+
# set to None if filters (nullable) is None
|
|
94
|
+
# and model_fields_set contains the field
|
|
95
|
+
if self.filters is None and "filters" in self.model_fields_set:
|
|
96
|
+
_dict['filters'] = None
|
|
97
|
+
|
|
98
|
+
return _dict
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
102
|
+
"""Create an instance of ReflectRequest from a dict"""
|
|
103
|
+
if obj is None:
|
|
104
|
+
return None
|
|
105
|
+
|
|
106
|
+
if not isinstance(obj, dict):
|
|
107
|
+
return cls.model_validate(obj)
|
|
108
|
+
|
|
109
|
+
_obj = cls.model_validate({
|
|
110
|
+
"query": obj.get("query"),
|
|
111
|
+
"budget": obj.get("budget"),
|
|
112
|
+
"context": obj.get("context"),
|
|
113
|
+
"filters": [MetadataFilter.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None,
|
|
114
|
+
"include": ReflectIncludeOptions.from_dict(obj["include"]) if obj.get("include") is not None else None
|
|
115
|
+
})
|
|
116
|
+
return _obj
|
|
117
|
+
|
|
118
|
+
|