hindsight-client 0.2.1__py3-none-any.whl → 0.4.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.
- hindsight_client/__init__.py +9 -8
- hindsight_client/hindsight_client.py +396 -59
- {hindsight_client-0.2.1.dist-info → hindsight_client-0.4.0.dist-info}/METADATA +1 -1
- hindsight_client-0.4.0.dist-info/RECORD +89 -0
- hindsight_client_api/__init__.py +27 -0
- hindsight_client_api/api/__init__.py +2 -0
- hindsight_client_api/api/banks_api.py +1012 -131
- hindsight_client_api/api/directives_api.py +1619 -0
- hindsight_client_api/api/entities_api.py +29 -9
- hindsight_client_api/api/memory_api.py +713 -73
- hindsight_client_api/api/mental_models_api.py +1897 -0
- hindsight_client_api/api/monitoring_api.py +246 -0
- hindsight_client_api/api/operations_api.py +350 -4
- hindsight_client_api/models/__init__.py +25 -0
- hindsight_client_api/models/add_background_request.py +2 -2
- hindsight_client_api/models/async_operation_submit_response.py +89 -0
- hindsight_client_api/models/background_response.py +10 -3
- hindsight_client_api/models/bank_list_item.py +6 -6
- hindsight_client_api/models/bank_profile_response.py +11 -4
- hindsight_client_api/models/bank_stats_response.py +15 -4
- hindsight_client_api/models/consolidation_response.py +89 -0
- hindsight_client_api/models/create_bank_request.py +8 -1
- 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/directive_list_response.py +95 -0
- hindsight_client_api/models/directive_response.py +113 -0
- hindsight_client_api/models/document_response.py +5 -3
- hindsight_client_api/models/entity_list_response.py +9 -3
- hindsight_client_api/models/features_info.py +91 -0
- hindsight_client_api/models/graph_data_response.py +4 -2
- hindsight_client_api/models/list_tags_response.py +101 -0
- hindsight_client_api/models/memory_item.py +9 -2
- 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 +1 -1
- hindsight_client_api/models/operation_status_response.py +131 -0
- hindsight_client_api/models/operations_list_response.py +8 -2
- hindsight_client_api/models/recall_request.py +22 -3
- hindsight_client_api/models/recall_result.py +9 -2
- hindsight_client_api/models/reflect_based_on.py +115 -0
- hindsight_client_api/models/reflect_directive.py +91 -0
- hindsight_client_api/models/reflect_include_options.py +13 -2
- 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 +22 -3
- hindsight_client_api/models/reflect_response.py +34 -11
- 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 +10 -3
- hindsight_client_api/models/retain_response.py +21 -3
- hindsight_client_api/models/tag_item.py +89 -0
- hindsight_client_api/models/token_usage.py +91 -0
- 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_mental_model_request.py +125 -0
- hindsight_client_api/models/version_response.py +93 -0
- hindsight_client-0.2.1.dist-info/RECORD +0 -62
- {hindsight_client-0.2.1.dist-info → hindsight_client-0.4.0.dist-info}/WHEEL +0 -0
|
@@ -30,10 +30,10 @@ class BankListItem(BaseModel):
|
|
|
30
30
|
bank_id: StrictStr
|
|
31
31
|
name: Optional[StrictStr] = None
|
|
32
32
|
disposition: DispositionTraits
|
|
33
|
-
|
|
33
|
+
mission: Optional[StrictStr] = None
|
|
34
34
|
created_at: Optional[StrictStr] = None
|
|
35
35
|
updated_at: Optional[StrictStr] = None
|
|
36
|
-
__properties: ClassVar[List[str]] = ["bank_id", "name", "disposition", "
|
|
36
|
+
__properties: ClassVar[List[str]] = ["bank_id", "name", "disposition", "mission", "created_at", "updated_at"]
|
|
37
37
|
|
|
38
38
|
model_config = ConfigDict(
|
|
39
39
|
populate_by_name=True,
|
|
@@ -82,10 +82,10 @@ class BankListItem(BaseModel):
|
|
|
82
82
|
if self.name is None and "name" in self.model_fields_set:
|
|
83
83
|
_dict['name'] = None
|
|
84
84
|
|
|
85
|
-
# set to None if
|
|
85
|
+
# set to None if mission (nullable) is None
|
|
86
86
|
# and model_fields_set contains the field
|
|
87
|
-
if self.
|
|
88
|
-
_dict['
|
|
87
|
+
if self.mission is None and "mission" in self.model_fields_set:
|
|
88
|
+
_dict['mission'] = None
|
|
89
89
|
|
|
90
90
|
# set to None if created_at (nullable) is None
|
|
91
91
|
# and model_fields_set contains the field
|
|
@@ -112,7 +112,7 @@ class BankListItem(BaseModel):
|
|
|
112
112
|
"bank_id": obj.get("bank_id"),
|
|
113
113
|
"name": obj.get("name"),
|
|
114
114
|
"disposition": DispositionTraits.from_dict(obj["disposition"]) if obj.get("disposition") is not None else None,
|
|
115
|
-
"
|
|
115
|
+
"mission": obj.get("mission"),
|
|
116
116
|
"created_at": obj.get("created_at"),
|
|
117
117
|
"updated_at": obj.get("updated_at")
|
|
118
118
|
})
|
|
@@ -17,8 +17,8 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
21
|
-
from typing import Any, ClassVar, Dict, List
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from hindsight_client_api.models.disposition_traits import DispositionTraits
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
@@ -30,8 +30,9 @@ class BankProfileResponse(BaseModel):
|
|
|
30
30
|
bank_id: StrictStr
|
|
31
31
|
name: StrictStr
|
|
32
32
|
disposition: DispositionTraits
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
mission: StrictStr = Field(description="The agent's mission - who they are and what they're trying to accomplish")
|
|
34
|
+
background: Optional[StrictStr] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["bank_id", "name", "disposition", "mission", "background"]
|
|
35
36
|
|
|
36
37
|
model_config = ConfigDict(
|
|
37
38
|
populate_by_name=True,
|
|
@@ -75,6 +76,11 @@ class BankProfileResponse(BaseModel):
|
|
|
75
76
|
# override the default output from pydantic by calling `to_dict()` of disposition
|
|
76
77
|
if self.disposition:
|
|
77
78
|
_dict['disposition'] = self.disposition.to_dict()
|
|
79
|
+
# set to None if background (nullable) is None
|
|
80
|
+
# and model_fields_set contains the field
|
|
81
|
+
if self.background is None and "background" in self.model_fields_set:
|
|
82
|
+
_dict['background'] = None
|
|
83
|
+
|
|
78
84
|
return _dict
|
|
79
85
|
|
|
80
86
|
@classmethod
|
|
@@ -90,6 +96,7 @@ class BankProfileResponse(BaseModel):
|
|
|
90
96
|
"bank_id": obj.get("bank_id"),
|
|
91
97
|
"name": obj.get("name"),
|
|
92
98
|
"disposition": DispositionTraits.from_dict(obj["disposition"]) if obj.get("disposition") is not None else None,
|
|
99
|
+
"mission": obj.get("mission"),
|
|
93
100
|
"background": obj.get("background")
|
|
94
101
|
})
|
|
95
102
|
return _obj
|
|
@@ -17,8 +17,8 @@ import pprint
|
|
|
17
17
|
import re # noqa: F401
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
|
21
|
-
from typing import Any, ClassVar, Dict, List
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from typing import Optional, Set
|
|
23
23
|
from typing_extensions import Self
|
|
24
24
|
|
|
@@ -36,7 +36,10 @@ class BankStatsResponse(BaseModel):
|
|
|
36
36
|
links_breakdown: Dict[str, Dict[str, StrictInt]]
|
|
37
37
|
pending_operations: StrictInt
|
|
38
38
|
failed_operations: StrictInt
|
|
39
|
-
|
|
39
|
+
last_consolidated_at: Optional[StrictStr] = None
|
|
40
|
+
pending_consolidation: Optional[StrictInt] = Field(default=0, description="Number of memories not yet processed into observations")
|
|
41
|
+
total_observations: Optional[StrictInt] = Field(default=0, description="Total number of observations")
|
|
42
|
+
__properties: ClassVar[List[str]] = ["bank_id", "total_nodes", "total_links", "total_documents", "nodes_by_fact_type", "links_by_link_type", "links_by_fact_type", "links_breakdown", "pending_operations", "failed_operations", "last_consolidated_at", "pending_consolidation", "total_observations"]
|
|
40
43
|
|
|
41
44
|
model_config = ConfigDict(
|
|
42
45
|
populate_by_name=True,
|
|
@@ -77,6 +80,11 @@ class BankStatsResponse(BaseModel):
|
|
|
77
80
|
exclude=excluded_fields,
|
|
78
81
|
exclude_none=True,
|
|
79
82
|
)
|
|
83
|
+
# set to None if last_consolidated_at (nullable) is None
|
|
84
|
+
# and model_fields_set contains the field
|
|
85
|
+
if self.last_consolidated_at is None and "last_consolidated_at" in self.model_fields_set:
|
|
86
|
+
_dict['last_consolidated_at'] = None
|
|
87
|
+
|
|
80
88
|
return _dict
|
|
81
89
|
|
|
82
90
|
@classmethod
|
|
@@ -98,7 +106,10 @@ class BankStatsResponse(BaseModel):
|
|
|
98
106
|
"links_by_fact_type": obj.get("links_by_fact_type"),
|
|
99
107
|
"links_breakdown": obj.get("links_breakdown"),
|
|
100
108
|
"pending_operations": obj.get("pending_operations"),
|
|
101
|
-
"failed_operations": obj.get("failed_operations")
|
|
109
|
+
"failed_operations": obj.get("failed_operations"),
|
|
110
|
+
"last_consolidated_at": obj.get("last_consolidated_at"),
|
|
111
|
+
"pending_consolidation": obj.get("pending_consolidation") if obj.get("pending_consolidation") is not None else 0,
|
|
112
|
+
"total_observations": obj.get("total_observations") if obj.get("total_observations") is not None else 0
|
|
102
113
|
})
|
|
103
114
|
return _obj
|
|
104
115
|
|
|
@@ -0,0 +1,89 @@
|
|
|
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.1.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, 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 ConsolidationResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Response model for consolidation trigger endpoint.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
operation_id: StrictStr = Field(description="ID of the async consolidation operation")
|
|
30
|
+
deduplicated: Optional[StrictBool] = Field(default=False, description="True if an existing pending task was reused")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["operation_id", "deduplicated"]
|
|
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 ConsolidationResponse 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
|
+
return _dict
|
|
73
|
+
|
|
74
|
+
@classmethod
|
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
76
|
+
"""Create an instance of ConsolidationResponse from a dict"""
|
|
77
|
+
if obj is None:
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
if not isinstance(obj, dict):
|
|
81
|
+
return cls.model_validate(obj)
|
|
82
|
+
|
|
83
|
+
_obj = cls.model_validate({
|
|
84
|
+
"operation_id": obj.get("operation_id"),
|
|
85
|
+
"deduplicated": obj.get("deduplicated") if obj.get("deduplicated") is not None else False
|
|
86
|
+
})
|
|
87
|
+
return _obj
|
|
88
|
+
|
|
89
|
+
|
|
@@ -29,8 +29,9 @@ class CreateBankRequest(BaseModel):
|
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
name: Optional[StrictStr] = None
|
|
31
31
|
disposition: Optional[DispositionTraits] = None
|
|
32
|
+
mission: Optional[StrictStr] = None
|
|
32
33
|
background: Optional[StrictStr] = None
|
|
33
|
-
__properties: ClassVar[List[str]] = ["name", "disposition", "background"]
|
|
34
|
+
__properties: ClassVar[List[str]] = ["name", "disposition", "mission", "background"]
|
|
34
35
|
|
|
35
36
|
model_config = ConfigDict(
|
|
36
37
|
populate_by_name=True,
|
|
@@ -84,6 +85,11 @@ class CreateBankRequest(BaseModel):
|
|
|
84
85
|
if self.disposition is None and "disposition" in self.model_fields_set:
|
|
85
86
|
_dict['disposition'] = None
|
|
86
87
|
|
|
88
|
+
# set to None if mission (nullable) is None
|
|
89
|
+
# and model_fields_set contains the field
|
|
90
|
+
if self.mission is None and "mission" in self.model_fields_set:
|
|
91
|
+
_dict['mission'] = None
|
|
92
|
+
|
|
87
93
|
# set to None if background (nullable) is None
|
|
88
94
|
# and model_fields_set contains the field
|
|
89
95
|
if self.background is None and "background" in self.model_fields_set:
|
|
@@ -103,6 +109,7 @@ class CreateBankRequest(BaseModel):
|
|
|
103
109
|
_obj = cls.model_validate({
|
|
104
110
|
"name": obj.get("name"),
|
|
105
111
|
"disposition": DispositionTraits.from_dict(obj["disposition"]) if obj.get("disposition") is not None else None,
|
|
112
|
+
"mission": obj.get("mission"),
|
|
106
113
|
"background": obj.get("background")
|
|
107
114
|
})
|
|
108
115
|
return _obj
|
|
@@ -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.1.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, 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 CreateDirectiveRequest(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Request model for creating a directive.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
name: StrictStr = Field(description="Human-readable name for the directive")
|
|
30
|
+
content: StrictStr = Field(description="The directive text to inject into prompts")
|
|
31
|
+
priority: Optional[StrictInt] = Field(default=0, description="Higher priority directives are injected first")
|
|
32
|
+
is_active: Optional[StrictBool] = Field(default=True, description="Whether this directive is active")
|
|
33
|
+
tags: Optional[List[StrictStr]] = Field(default=None, description="Tags for filtering")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["name", "content", "priority", "is_active", "tags"]
|
|
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 CreateDirectiveRequest 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
|
+
return _dict
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
79
|
+
"""Create an instance of CreateDirectiveRequest 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
|
+
"name": obj.get("name"),
|
|
88
|
+
"content": obj.get("content"),
|
|
89
|
+
"priority": obj.get("priority") if obj.get("priority") is not None else 0,
|
|
90
|
+
"is_active": obj.get("is_active") if obj.get("is_active") is not None else True,
|
|
91
|
+
"tags": obj.get("tags")
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
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.1.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 typing_extensions import Annotated
|
|
23
|
+
from hindsight_client_api.models.mental_model_trigger import MentalModelTrigger
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class CreateMentalModelRequest(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Request model for creating a mental model.
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
name: StrictStr = Field(description="Human-readable name for the mental model")
|
|
32
|
+
source_query: StrictStr = Field(description="The query to run to generate content")
|
|
33
|
+
tags: Optional[List[StrictStr]] = Field(default=None, description="Tags for scoped visibility")
|
|
34
|
+
max_tokens: Optional[Annotated[int, Field(le=8192, strict=True, ge=256)]] = Field(default=2048, description="Maximum tokens for generated content")
|
|
35
|
+
trigger: Optional[MentalModelTrigger] = Field(default=None, description="Trigger settings")
|
|
36
|
+
__properties: ClassVar[List[str]] = ["name", "source_query", "tags", "max_tokens", "trigger"]
|
|
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 CreateMentalModelRequest 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 trigger
|
|
78
|
+
if self.trigger:
|
|
79
|
+
_dict['trigger'] = self.trigger.to_dict()
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of CreateMentalModelRequest from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({
|
|
92
|
+
"name": obj.get("name"),
|
|
93
|
+
"source_query": obj.get("source_query"),
|
|
94
|
+
"tags": obj.get("tags"),
|
|
95
|
+
"max_tokens": obj.get("max_tokens") if obj.get("max_tokens") is not None else 2048,
|
|
96
|
+
"trigger": MentalModelTrigger.from_dict(obj["trigger"]) if obj.get("trigger") is not None else None
|
|
97
|
+
})
|
|
98
|
+
return _obj
|
|
99
|
+
|
|
100
|
+
|
|
@@ -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.1.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 CreateMentalModelResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Response model for mental model creation.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
operation_id: StrictStr = Field(description="Operation ID to track progress")
|
|
30
|
+
__properties: ClassVar[List[str]] = ["operation_id"]
|
|
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 CreateMentalModelResponse 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 CreateMentalModelResponse 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
|
+
"operation_id": obj.get("operation_id")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -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.1.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
|
+
|