hindsight-client 0.2.0__py3-none-any.whl → 0.3.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.
Files changed (76) hide show
  1. hindsight_client/hindsight_client.py +2 -0
  2. {hindsight_client-0.2.0.dist-info → hindsight_client-0.3.0.dist-info}/METADATA +1 -1
  3. hindsight_client-0.3.0.dist-info/RECORD +65 -0
  4. hindsight_client_api/__init__.py +61 -119
  5. hindsight_client_api/api/banks_api.py +15 -0
  6. hindsight_client_api/api/entities_api.py +20 -3
  7. hindsight_client_api/api/memory_api.py +713 -73
  8. hindsight_client_api/api_client.py +6 -13
  9. hindsight_client_api/configuration.py +4 -15
  10. hindsight_client_api/exceptions.py +2 -22
  11. hindsight_client_api/models/__init__.py +4 -1
  12. hindsight_client_api/models/document_response.py +5 -3
  13. hindsight_client_api/models/entity_input.py +22 -10
  14. hindsight_client_api/models/entity_list_response.py +9 -3
  15. hindsight_client_api/models/graph_data_response.py +4 -2
  16. hindsight_client_api/models/list_tags_response.py +101 -0
  17. hindsight_client_api/models/memory_item.py +19 -8
  18. hindsight_client_api/models/recall_request.py +22 -3
  19. hindsight_client_api/models/recall_result.py +9 -2
  20. hindsight_client_api/models/reflect_request.py +22 -3
  21. hindsight_client_api/models/reflect_response.py +13 -2
  22. hindsight_client_api/models/retain_request.py +10 -3
  23. hindsight_client_api/models/retain_response.py +21 -3
  24. hindsight_client_api/models/tag_item.py +89 -0
  25. hindsight_client_api/models/token_usage.py +91 -0
  26. hindsight_client_api/rest.py +60 -38
  27. hindsight_client-0.2.0.dist-info/RECORD +0 -110
  28. hindsight_client_api/docs/AddBackgroundRequest.md +0 -31
  29. hindsight_client_api/docs/BackgroundResponse.md +0 -31
  30. hindsight_client_api/docs/BankListItem.md +0 -35
  31. hindsight_client_api/docs/BankListResponse.md +0 -30
  32. hindsight_client_api/docs/BankProfileResponse.md +0 -33
  33. hindsight_client_api/docs/BankStatsResponse.md +0 -39
  34. hindsight_client_api/docs/BanksApi.md +0 -517
  35. hindsight_client_api/docs/Budget.md +0 -15
  36. hindsight_client_api/docs/CancelOperationResponse.md +0 -32
  37. hindsight_client_api/docs/ChunkData.md +0 -33
  38. hindsight_client_api/docs/ChunkIncludeOptions.md +0 -30
  39. hindsight_client_api/docs/ChunkResponse.md +0 -35
  40. hindsight_client_api/docs/CreateBankRequest.md +0 -32
  41. hindsight_client_api/docs/DeleteDocumentResponse.md +0 -33
  42. hindsight_client_api/docs/DeleteResponse.md +0 -32
  43. hindsight_client_api/docs/DispositionTraits.md +0 -32
  44. hindsight_client_api/docs/DocumentResponse.md +0 -36
  45. hindsight_client_api/docs/DocumentsApi.md +0 -313
  46. hindsight_client_api/docs/EntitiesApi.md +0 -230
  47. hindsight_client_api/docs/EntityDetailResponse.md +0 -36
  48. hindsight_client_api/docs/EntityIncludeOptions.md +0 -30
  49. hindsight_client_api/docs/EntityListItem.md +0 -35
  50. hindsight_client_api/docs/EntityListResponse.md +0 -30
  51. hindsight_client_api/docs/EntityObservationResponse.md +0 -31
  52. hindsight_client_api/docs/EntityStateResponse.md +0 -32
  53. hindsight_client_api/docs/GraphDataResponse.md +0 -33
  54. hindsight_client_api/docs/HTTPValidationError.md +0 -29
  55. hindsight_client_api/docs/IncludeOptions.md +0 -31
  56. hindsight_client_api/docs/ListDocumentsResponse.md +0 -33
  57. hindsight_client_api/docs/ListMemoryUnitsResponse.md +0 -33
  58. hindsight_client_api/docs/MemoryApi.md +0 -499
  59. hindsight_client_api/docs/MemoryItem.md +0 -34
  60. hindsight_client_api/docs/MonitoringApi.md +0 -136
  61. hindsight_client_api/docs/OperationResponse.md +0 -36
  62. hindsight_client_api/docs/OperationsApi.md +0 -154
  63. hindsight_client_api/docs/OperationsListResponse.md +0 -31
  64. hindsight_client_api/docs/RecallRequest.md +0 -36
  65. hindsight_client_api/docs/RecallResponse.md +0 -33
  66. hindsight_client_api/docs/RecallResult.md +0 -40
  67. hindsight_client_api/docs/ReflectFact.md +0 -35
  68. hindsight_client_api/docs/ReflectIncludeOptions.md +0 -30
  69. hindsight_client_api/docs/ReflectRequest.md +0 -35
  70. hindsight_client_api/docs/ReflectResponse.md +0 -32
  71. hindsight_client_api/docs/RetainRequest.md +0 -31
  72. hindsight_client_api/docs/RetainResponse.md +0 -33
  73. hindsight_client_api/docs/UpdateDispositionRequest.md +0 -30
  74. hindsight_client_api/docs/ValidationError.md +0 -31
  75. hindsight_client_api/docs/ValidationErrorLocInner.md +0 -28
  76. {hindsight_client-0.2.0.dist-info → hindsight_client-0.3.0.dist-info}/WHEEL +0 -0
@@ -21,7 +21,6 @@ import mimetypes
21
21
  import os
22
22
  import re
23
23
  import tempfile
24
- import uuid
25
24
 
26
25
  from urllib.parse import quote
27
26
  from typing import Tuple, Optional, List, Dict, Union
@@ -360,8 +359,6 @@ class ApiClient:
360
359
  return obj.get_secret_value()
361
360
  elif isinstance(obj, self.PRIMITIVE_TYPES):
362
361
  return obj
363
- elif isinstance(obj, uuid.UUID):
364
- return str(obj)
365
362
  elif isinstance(obj, list):
366
363
  return [
367
364
  self.sanitize_for_serialization(sub_obj) for sub_obj in obj
@@ -388,10 +385,6 @@ class ApiClient:
388
385
  else:
389
386
  obj_dict = obj.__dict__
390
387
 
391
- if isinstance(obj_dict, list):
392
- # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict()
393
- return self.sanitize_for_serialization(obj_dict)
394
-
395
388
  return {
396
389
  key: self.sanitize_for_serialization(val)
397
390
  for key, val in obj_dict.items()
@@ -414,7 +407,7 @@ class ApiClient:
414
407
  data = json.loads(response_text)
415
408
  except ValueError:
416
409
  data = response_text
417
- elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
410
+ elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
418
411
  if response_text == "":
419
412
  data = ""
420
413
  else:
@@ -463,13 +456,13 @@ class ApiClient:
463
456
 
464
457
  if klass in self.PRIMITIVE_TYPES:
465
458
  return self.__deserialize_primitive(data, klass)
466
- elif klass is object:
459
+ elif klass == object:
467
460
  return self.__deserialize_object(data)
468
- elif klass is datetime.date:
461
+ elif klass == datetime.date:
469
462
  return self.__deserialize_date(data)
470
- elif klass is datetime.datetime:
463
+ elif klass == datetime.datetime:
471
464
  return self.__deserialize_datetime(data)
472
- elif klass is decimal.Decimal:
465
+ elif klass == decimal.Decimal:
473
466
  return decimal.Decimal(data)
474
467
  elif issubclass(klass, Enum):
475
468
  return self.__deserialize_enum(data, klass)
@@ -527,7 +520,7 @@ class ApiClient:
527
520
  if k in collection_formats:
528
521
  collection_format = collection_formats[k]
529
522
  if collection_format == 'multi':
530
- new_params.extend((k, quote(str(value))) for value in v)
523
+ new_params.extend((k, str(value)) for value in v)
531
524
  else:
532
525
  if collection_format == 'ssv':
533
526
  delimiter = ' '
@@ -17,7 +17,7 @@ import http.client as httplib
17
17
  import logging
18
18
  from logging import FileHandler
19
19
  import sys
20
- from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union
20
+ from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict
21
21
  from typing_extensions import NotRequired, Self
22
22
 
23
23
  import urllib3
@@ -159,10 +159,6 @@ class Configuration:
159
159
  :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
160
160
  in PEM format.
161
161
  :param retries: Number of retries for API requests.
162
- :param ca_cert_data: verify the peer using concatenated CA certificate data
163
- in PEM (str) or DER (bytes) format.
164
- :param cert_file: the path to a client certificate file, for mTLS.
165
- :param key_file: the path to a client key file, for mTLS.
166
162
 
167
163
  """
168
164
 
@@ -176,16 +172,13 @@ class Configuration:
176
172
  username: Optional[str]=None,
177
173
  password: Optional[str]=None,
178
174
  access_token: Optional[str]=None,
179
- server_index: Optional[int]=None,
175
+ server_index: Optional[int]=None,
180
176
  server_variables: Optional[ServerVariablesT]=None,
181
177
  server_operation_index: Optional[Dict[int, int]]=None,
182
178
  server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
183
179
  ignore_operation_servers: bool=False,
184
180
  ssl_ca_cert: Optional[str]=None,
185
181
  retries: Optional[int] = None,
186
- ca_cert_data: Optional[Union[str, bytes]] = None,
187
- cert_file: Optional[str]=None,
188
- key_file: Optional[str]=None,
189
182
  *,
190
183
  debug: Optional[bool] = None,
191
184
  ) -> None:
@@ -263,14 +256,10 @@ class Configuration:
263
256
  self.ssl_ca_cert = ssl_ca_cert
264
257
  """Set this to customize the certificate file to verify the peer.
265
258
  """
266
- self.ca_cert_data = ca_cert_data
267
- """Set this to verify the peer using PEM (str) or DER (bytes)
268
- certificate data.
269
- """
270
- self.cert_file = cert_file
259
+ self.cert_file = None
271
260
  """client certificate file
272
261
  """
273
- self.key_file = key_file
262
+ self.key_file = None
274
263
  """client key file
275
264
  """
276
265
  self.assert_hostname = None
@@ -150,13 +150,6 @@ class ApiException(OpenApiException):
150
150
  if http_resp.status == 404:
151
151
  raise NotFoundException(http_resp=http_resp, body=body, data=data)
152
152
 
153
- # Added new conditions for 409 and 422
154
- if http_resp.status == 409:
155
- raise ConflictException(http_resp=http_resp, body=body, data=data)
156
-
157
- if http_resp.status == 422:
158
- raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
159
-
160
153
  if 500 <= http_resp.status <= 599:
161
154
  raise ServiceException(http_resp=http_resp, body=body, data=data)
162
155
  raise ApiException(http_resp=http_resp, body=body, data=data)
@@ -169,11 +162,8 @@ class ApiException(OpenApiException):
169
162
  error_message += "HTTP response headers: {0}\n".format(
170
163
  self.headers)
171
164
 
172
- if self.body:
173
- error_message += "HTTP response body: {0}\n".format(self.body)
174
-
175
- if self.data:
176
- error_message += "HTTP response data: {0}\n".format(self.data)
165
+ if self.data or self.body:
166
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
177
167
 
178
168
  return error_message
179
169
 
@@ -198,16 +188,6 @@ class ServiceException(ApiException):
198
188
  pass
199
189
 
200
190
 
201
- class ConflictException(ApiException):
202
- """Exception for HTTP 409 Conflict."""
203
- pass
204
-
205
-
206
- class UnprocessableEntityException(ApiException):
207
- """Exception for HTTP 422 Unprocessable Entity."""
208
- pass
209
-
210
-
211
191
  def render_path(path_to_item):
212
192
  """Returns a string representation of a path"""
213
193
  result = ""
@@ -12,6 +12,7 @@
12
12
  Do not edit the class manually.
13
13
  """ # noqa: E501
14
14
 
15
+
15
16
  # import models into model package
16
17
  from hindsight_client_api.models.add_background_request import AddBackgroundRequest
17
18
  from hindsight_client_api.models.background_response import BackgroundResponse
@@ -41,6 +42,7 @@ from hindsight_client_api.models.http_validation_error import HTTPValidationErro
41
42
  from hindsight_client_api.models.include_options import IncludeOptions
42
43
  from hindsight_client_api.models.list_documents_response import ListDocumentsResponse
43
44
  from hindsight_client_api.models.list_memory_units_response import ListMemoryUnitsResponse
45
+ from hindsight_client_api.models.list_tags_response import ListTagsResponse
44
46
  from hindsight_client_api.models.memory_item import MemoryItem
45
47
  from hindsight_client_api.models.operation_response import OperationResponse
46
48
  from hindsight_client_api.models.operations_list_response import OperationsListResponse
@@ -53,7 +55,8 @@ from hindsight_client_api.models.reflect_request import ReflectRequest
53
55
  from hindsight_client_api.models.reflect_response import ReflectResponse
54
56
  from hindsight_client_api.models.retain_request import RetainRequest
55
57
  from hindsight_client_api.models.retain_response import RetainResponse
58
+ from hindsight_client_api.models.tag_item import TagItem
59
+ from hindsight_client_api.models.token_usage import TokenUsage
56
60
  from hindsight_client_api.models.update_disposition_request import UpdateDispositionRequest
57
61
  from hindsight_client_api.models.validation_error import ValidationError
58
62
  from hindsight_client_api.models.validation_error_loc_inner import ValidationErrorLocInner
59
-
@@ -17,7 +17,7 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing import Optional, Set
23
23
  from typing_extensions import Self
@@ -33,7 +33,8 @@ class DocumentResponse(BaseModel):
33
33
  created_at: StrictStr
34
34
  updated_at: StrictStr
35
35
  memory_unit_count: StrictInt
36
- __properties: ClassVar[List[str]] = ["id", "bank_id", "original_text", "content_hash", "created_at", "updated_at", "memory_unit_count"]
36
+ tags: Optional[List[StrictStr]] = Field(default=None, description="Tags associated with this document")
37
+ __properties: ClassVar[List[str]] = ["id", "bank_id", "original_text", "content_hash", "created_at", "updated_at", "memory_unit_count", "tags"]
37
38
 
38
39
  model_config = ConfigDict(
39
40
  populate_by_name=True,
@@ -97,7 +98,8 @@ class DocumentResponse(BaseModel):
97
98
  "content_hash": obj.get("content_hash"),
98
99
  "created_at": obj.get("created_at"),
99
100
  "updated_at": obj.get("updated_at"),
100
- "memory_unit_count": obj.get("memory_unit_count")
101
+ "memory_unit_count": obj.get("memory_unit_count"),
102
+ "tags": obj.get("tags")
101
103
  })
102
104
  return _obj
103
105
 
@@ -22,16 +22,12 @@ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from typing import Optional, Set
23
23
  from typing_extensions import Self
24
24
 
25
-
26
25
  class EntityInput(BaseModel):
27
26
  """
28
27
  Entity to associate with retained content.
29
- """ # noqa: E501
30
-
28
+ """ # noqa: E501
31
29
  text: StrictStr = Field(description="The entity name/text")
32
- type: Optional[StrictStr] = Field(
33
- default=None, description="Optional entity type (e.g., 'PERSON', 'ORG', 'CONCEPT')"
34
- )
30
+ type: Optional[StrictStr] = None
35
31
  __properties: ClassVar[List[str]] = ["text", "type"]
36
32
 
37
33
  model_config = ConfigDict(
@@ -40,12 +36,14 @@ class EntityInput(BaseModel):
40
36
  protected_namespaces=(),
41
37
  )
42
38
 
39
+
43
40
  def to_str(self) -> str:
44
41
  """Returns the string representation of the model using alias"""
45
42
  return pprint.pformat(self.model_dump(by_alias=True))
46
43
 
47
44
  def to_json(self) -> str:
48
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
49
47
  return json.dumps(self.to_dict())
50
48
 
51
49
  @classmethod
@@ -54,8 +52,17 @@ class EntityInput(BaseModel):
54
52
  return cls.from_dict(json.loads(json_str))
55
53
 
56
54
  def to_dict(self) -> Dict[str, Any]:
57
- """Return the dictionary representation of the model using alias."""
58
- excluded_fields: Set[str] = set([])
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
+ ])
59
66
 
60
67
  _dict = self.model_dump(
61
68
  by_alias=True,
@@ -65,7 +72,7 @@ class EntityInput(BaseModel):
65
72
  # set to None if type (nullable) is None
66
73
  # and model_fields_set contains the field
67
74
  if self.type is None and "type" in self.model_fields_set:
68
- _dict["type"] = None
75
+ _dict['type'] = None
69
76
 
70
77
  return _dict
71
78
 
@@ -78,5 +85,10 @@ class EntityInput(BaseModel):
78
85
  if not isinstance(obj, dict):
79
86
  return cls.model_validate(obj)
80
87
 
81
- _obj = cls.model_validate({"text": obj.get("text"), "type": obj.get("type")})
88
+ _obj = cls.model_validate({
89
+ "text": obj.get("text"),
90
+ "type": obj.get("type")
91
+ })
82
92
  return _obj
93
+
94
+
@@ -17,7 +17,7 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict
20
+ from pydantic import BaseModel, ConfigDict, StrictInt
21
21
  from typing import Any, ClassVar, Dict, List
22
22
  from hindsight_client_api.models.entity_list_item import EntityListItem
23
23
  from typing import Optional, Set
@@ -28,7 +28,10 @@ class EntityListResponse(BaseModel):
28
28
  Response model for entity list endpoint.
29
29
  """ # noqa: E501
30
30
  items: List[EntityListItem]
31
- __properties: ClassVar[List[str]] = ["items"]
31
+ total: StrictInt
32
+ limit: StrictInt
33
+ offset: StrictInt
34
+ __properties: ClassVar[List[str]] = ["items", "total", "limit", "offset"]
32
35
 
33
36
  model_config = ConfigDict(
34
37
  populate_by_name=True,
@@ -88,7 +91,10 @@ class EntityListResponse(BaseModel):
88
91
  return cls.model_validate(obj)
89
92
 
90
93
  _obj = cls.model_validate({
91
- "items": [EntityListItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None
94
+ "items": [EntityListItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
95
+ "total": obj.get("total"),
96
+ "limit": obj.get("limit"),
97
+ "offset": obj.get("offset")
92
98
  })
93
99
  return _obj
94
100
 
@@ -30,7 +30,8 @@ class GraphDataResponse(BaseModel):
30
30
  edges: List[Dict[str, Any]]
31
31
  table_rows: List[Dict[str, Any]]
32
32
  total_units: StrictInt
33
- __properties: ClassVar[List[str]] = ["nodes", "edges", "table_rows", "total_units"]
33
+ limit: StrictInt
34
+ __properties: ClassVar[List[str]] = ["nodes", "edges", "table_rows", "total_units", "limit"]
34
35
 
35
36
  model_config = ConfigDict(
36
37
  populate_by_name=True,
@@ -86,7 +87,8 @@ class GraphDataResponse(BaseModel):
86
87
  "nodes": obj.get("nodes"),
87
88
  "edges": obj.get("edges"),
88
89
  "table_rows": obj.get("table_rows"),
89
- "total_units": obj.get("total_units")
90
+ "total_units": obj.get("total_units"),
91
+ "limit": obj.get("limit")
90
92
  })
91
93
  return _obj
92
94
 
@@ -0,0 +1,101 @@
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, StrictInt
21
+ from typing import Any, ClassVar, Dict, List
22
+ from hindsight_client_api.models.tag_item import TagItem
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ListTagsResponse(BaseModel):
27
+ """
28
+ Response model for list tags endpoint.
29
+ """ # noqa: E501
30
+ items: List[TagItem]
31
+ total: StrictInt
32
+ limit: StrictInt
33
+ offset: StrictInt
34
+ __properties: ClassVar[List[str]] = ["items", "total", "limit", "offset"]
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 ListTagsResponse from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
76
+ _items = []
77
+ if self.items:
78
+ for _item_items in self.items:
79
+ if _item_items:
80
+ _items.append(_item_items.to_dict())
81
+ _dict['items'] = _items
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of ListTagsResponse from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate({
94
+ "items": [TagItem.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
95
+ "total": obj.get("total"),
96
+ "limit": obj.get("limit"),
97
+ "offset": obj.get("offset")
98
+ })
99
+ return _obj
100
+
101
+
@@ -18,11 +18,11 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from datetime import datetime
21
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
+ from hindsight_client_api.models.entity_input import EntityInput
23
24
  from typing import Optional, Set
24
25
  from typing_extensions import Self
25
- from hindsight_client_api.models.entity_input import EntityInput
26
26
 
27
27
  class MemoryItem(BaseModel):
28
28
  """
@@ -33,11 +33,9 @@ class MemoryItem(BaseModel):
33
33
  context: Optional[StrictStr] = None
34
34
  metadata: Optional[Dict[str, StrictStr]] = None
35
35
  document_id: Optional[StrictStr] = None
36
- entities: Optional[List[EntityInput]] = Field(
37
- default=None,
38
- description="Optional entities to combine with auto-extracted entities."
39
- )
40
- __properties: ClassVar[List[str]] = ["content", "timestamp", "context", "metadata", "document_id", "entities"]
36
+ entities: Optional[List[EntityInput]] = None
37
+ tags: Optional[List[StrictStr]] = None
38
+ __properties: ClassVar[List[str]] = ["content", "timestamp", "context", "metadata", "document_id", "entities", "tags"]
41
39
 
42
40
  model_config = ConfigDict(
43
41
  populate_by_name=True,
@@ -78,6 +76,13 @@ class MemoryItem(BaseModel):
78
76
  exclude=excluded_fields,
79
77
  exclude_none=True,
80
78
  )
79
+ # override the default output from pydantic by calling `to_dict()` of each item in entities (list)
80
+ _items = []
81
+ if self.entities:
82
+ for _item_entities in self.entities:
83
+ if _item_entities:
84
+ _items.append(_item_entities.to_dict())
85
+ _dict['entities'] = _items
81
86
  # set to None if timestamp (nullable) is None
82
87
  # and model_fields_set contains the field
83
88
  if self.timestamp is None and "timestamp" in self.model_fields_set:
@@ -103,6 +108,11 @@ class MemoryItem(BaseModel):
103
108
  if self.entities is None and "entities" in self.model_fields_set:
104
109
  _dict['entities'] = None
105
110
 
111
+ # set to None if tags (nullable) is None
112
+ # and model_fields_set contains the field
113
+ if self.tags is None and "tags" in self.model_fields_set:
114
+ _dict['tags'] = None
115
+
106
116
  return _dict
107
117
 
108
118
  @classmethod
@@ -120,7 +130,8 @@ class MemoryItem(BaseModel):
120
130
  "context": obj.get("context"),
121
131
  "metadata": obj.get("metadata"),
122
132
  "document_id": obj.get("document_id"),
123
- "entities": [EntityInput.from_dict(_item) for _item in obj["entities"]] if obj.get("entities") is not None else None
133
+ "entities": [EntityInput.from_dict(_item) for _item in obj["entities"]] if obj.get("entities") is not None else None,
134
+ "tags": obj.get("tags")
124
135
  })
125
136
  return _obj
126
137
 
@@ -17,7 +17,7 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
22
  from hindsight_client_api.models.budget import Budget
23
23
  from hindsight_client_api.models.include_options import IncludeOptions
@@ -35,7 +35,19 @@ class RecallRequest(BaseModel):
35
35
  trace: Optional[StrictBool] = False
36
36
  query_timestamp: Optional[StrictStr] = None
37
37
  include: Optional[IncludeOptions] = Field(default=None, description="Options for including additional data (entities are included by default)")
38
- __properties: ClassVar[List[str]] = ["query", "types", "budget", "max_tokens", "trace", "query_timestamp", "include"]
38
+ tags: Optional[List[StrictStr]] = None
39
+ tags_match: Optional[StrictStr] = Field(default='any', description="How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, excludes untagged), 'all_strict' (AND, excludes untagged).")
40
+ __properties: ClassVar[List[str]] = ["query", "types", "budget", "max_tokens", "trace", "query_timestamp", "include", "tags", "tags_match"]
41
+
42
+ @field_validator('tags_match')
43
+ def tags_match_validate_enum(cls, value):
44
+ """Validates the enum"""
45
+ if value is None:
46
+ return value
47
+
48
+ if value not in set(['any', 'all', 'any_strict', 'all_strict']):
49
+ raise ValueError("must be one of enum values ('any', 'all', 'any_strict', 'all_strict')")
50
+ return value
39
51
 
40
52
  model_config = ConfigDict(
41
53
  populate_by_name=True,
@@ -89,6 +101,11 @@ class RecallRequest(BaseModel):
89
101
  if self.query_timestamp is None and "query_timestamp" in self.model_fields_set:
90
102
  _dict['query_timestamp'] = None
91
103
 
104
+ # set to None if tags (nullable) is None
105
+ # and model_fields_set contains the field
106
+ if self.tags is None and "tags" in self.model_fields_set:
107
+ _dict['tags'] = None
108
+
92
109
  return _dict
93
110
 
94
111
  @classmethod
@@ -107,7 +124,9 @@ class RecallRequest(BaseModel):
107
124
  "max_tokens": obj.get("max_tokens") if obj.get("max_tokens") is not None else 4096,
108
125
  "trace": obj.get("trace") if obj.get("trace") is not None else False,
109
126
  "query_timestamp": obj.get("query_timestamp"),
110
- "include": IncludeOptions.from_dict(obj["include"]) if obj.get("include") is not None else None
127
+ "include": IncludeOptions.from_dict(obj["include"]) if obj.get("include") is not None else None,
128
+ "tags": obj.get("tags"),
129
+ "tags_match": obj.get("tags_match") if obj.get("tags_match") is not None else 'any'
111
130
  })
112
131
  return _obj
113
132
 
@@ -37,7 +37,8 @@ class RecallResult(BaseModel):
37
37
  document_id: Optional[StrictStr] = None
38
38
  metadata: Optional[Dict[str, StrictStr]] = None
39
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"]
40
+ tags: Optional[List[StrictStr]] = None
41
+ __properties: ClassVar[List[str]] = ["id", "text", "type", "entities", "context", "occurred_start", "occurred_end", "mentioned_at", "document_id", "metadata", "chunk_id", "tags"]
41
42
 
42
43
  model_config = ConfigDict(
43
44
  populate_by_name=True,
@@ -123,6 +124,11 @@ class RecallResult(BaseModel):
123
124
  if self.chunk_id is None and "chunk_id" in self.model_fields_set:
124
125
  _dict['chunk_id'] = None
125
126
 
127
+ # set to None if tags (nullable) is None
128
+ # and model_fields_set contains the field
129
+ if self.tags is None and "tags" in self.model_fields_set:
130
+ _dict['tags'] = None
131
+
126
132
  return _dict
127
133
 
128
134
  @classmethod
@@ -145,7 +151,8 @@ class RecallResult(BaseModel):
145
151
  "mentioned_at": obj.get("mentioned_at"),
146
152
  "document_id": obj.get("document_id"),
147
153
  "metadata": obj.get("metadata"),
148
- "chunk_id": obj.get("chunk_id")
154
+ "chunk_id": obj.get("chunk_id"),
155
+ "tags": obj.get("tags")
149
156
  })
150
157
  return _obj
151
158
 
@@ -17,7 +17,7 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
22
  from hindsight_client_api.models.budget import Budget
23
23
  from hindsight_client_api.models.reflect_include_options import ReflectIncludeOptions
@@ -34,7 +34,19 @@ class ReflectRequest(BaseModel):
34
34
  max_tokens: Optional[StrictInt] = Field(default=4096, description="Maximum tokens for the response")
35
35
  include: Optional[ReflectIncludeOptions] = Field(default=None, description="Options for including additional data (disabled by default)")
36
36
  response_schema: Optional[Dict[str, Any]] = None
37
- __properties: ClassVar[List[str]] = ["query", "budget", "context", "max_tokens", "include", "response_schema"]
37
+ tags: Optional[List[StrictStr]] = None
38
+ tags_match: Optional[StrictStr] = Field(default='any', description="How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, excludes untagged), 'all_strict' (AND, excludes untagged).")
39
+ __properties: ClassVar[List[str]] = ["query", "budget", "context", "max_tokens", "include", "response_schema", "tags", "tags_match"]
40
+
41
+ @field_validator('tags_match')
42
+ def tags_match_validate_enum(cls, value):
43
+ """Validates the enum"""
44
+ if value is None:
45
+ return value
46
+
47
+ if value not in set(['any', 'all', 'any_strict', 'all_strict']):
48
+ raise ValueError("must be one of enum values ('any', 'all', 'any_strict', 'all_strict')")
49
+ return value
38
50
 
39
51
  model_config = ConfigDict(
40
52
  populate_by_name=True,
@@ -88,6 +100,11 @@ class ReflectRequest(BaseModel):
88
100
  if self.response_schema is None and "response_schema" in self.model_fields_set:
89
101
  _dict['response_schema'] = None
90
102
 
103
+ # set to None if tags (nullable) is None
104
+ # and model_fields_set contains the field
105
+ if self.tags is None and "tags" in self.model_fields_set:
106
+ _dict['tags'] = None
107
+
91
108
  return _dict
92
109
 
93
110
  @classmethod
@@ -105,7 +122,9 @@ class ReflectRequest(BaseModel):
105
122
  "context": obj.get("context"),
106
123
  "max_tokens": obj.get("max_tokens") if obj.get("max_tokens") is not None else 4096,
107
124
  "include": ReflectIncludeOptions.from_dict(obj["include"]) if obj.get("include") is not None else None,
108
- "response_schema": obj.get("response_schema")
125
+ "response_schema": obj.get("response_schema"),
126
+ "tags": obj.get("tags"),
127
+ "tags_match": obj.get("tags_match") if obj.get("tags_match") is not None else 'any'
109
128
  })
110
129
  return _obj
111
130