hindsight-client 0.1.14__py3-none-any.whl → 0.1.16__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 (114) hide show
  1. hindsight_client/hindsight_client.py +11 -10
  2. {hindsight_client-0.1.14.dist-info → hindsight_client-0.1.16.dist-info}/METADATA +1 -1
  3. hindsight_client-0.1.16.dist-info/RECORD +109 -0
  4. hindsight_client_api/__init__.py +21 -3
  5. hindsight_client_api/api/__init__.py +5 -1
  6. hindsight_client_api/api/banks_api.py +2045 -0
  7. hindsight_client_api/api/documents_api.py +1234 -0
  8. hindsight_client_api/api/entities_api.py +921 -0
  9. hindsight_client_api/api/memory_api.py +1901 -0
  10. hindsight_client_api/api/monitoring_api.py +1 -1
  11. hindsight_client_api/api/operations_api.py +610 -0
  12. hindsight_client_api/api_client.py +1 -1
  13. hindsight_client_api/configuration.py +2 -2
  14. hindsight_client_api/docs/BankListItem.md +2 -2
  15. hindsight_client_api/docs/BankStatsResponse.md +39 -0
  16. hindsight_client_api/docs/BanksApi.md +517 -0
  17. hindsight_client_api/docs/CancelOperationResponse.md +32 -0
  18. hindsight_client_api/docs/DeleteDocumentResponse.md +33 -0
  19. hindsight_client_api/docs/DeleteResponse.md +2 -0
  20. hindsight_client_api/docs/DocumentsApi.md +313 -0
  21. hindsight_client_api/docs/EntitiesApi.md +230 -0
  22. hindsight_client_api/docs/MemoryApi.md +499 -0
  23. hindsight_client_api/docs/OperationResponse.md +36 -0
  24. hindsight_client_api/docs/OperationsApi.md +154 -0
  25. hindsight_client_api/docs/OperationsListResponse.md +31 -0
  26. hindsight_client_api/exceptions.py +1 -1
  27. hindsight_client_api/models/__init__.py +6 -1
  28. hindsight_client_api/models/add_background_request.py +1 -1
  29. hindsight_client_api/models/background_response.py +1 -1
  30. hindsight_client_api/models/bank_list_item.py +13 -3
  31. hindsight_client_api/models/bank_list_response.py +1 -1
  32. hindsight_client_api/models/bank_profile_response.py +1 -1
  33. hindsight_client_api/models/bank_stats_response.py +105 -0
  34. hindsight_client_api/models/budget.py +1 -1
  35. hindsight_client_api/models/cancel_operation_response.py +91 -0
  36. hindsight_client_api/models/chunk_data.py +1 -1
  37. hindsight_client_api/models/chunk_include_options.py +1 -1
  38. hindsight_client_api/models/chunk_response.py +1 -1
  39. hindsight_client_api/models/create_bank_request.py +1 -1
  40. hindsight_client_api/models/delete_document_response.py +93 -0
  41. hindsight_client_api/models/delete_response.py +19 -5
  42. hindsight_client_api/models/disposition_traits.py +1 -1
  43. hindsight_client_api/models/document_response.py +1 -1
  44. hindsight_client_api/models/entity_detail_response.py +1 -1
  45. hindsight_client_api/models/entity_include_options.py +1 -1
  46. hindsight_client_api/models/entity_list_item.py +1 -1
  47. hindsight_client_api/models/entity_list_response.py +1 -1
  48. hindsight_client_api/models/entity_observation_response.py +1 -1
  49. hindsight_client_api/models/entity_state_response.py +1 -1
  50. hindsight_client_api/models/graph_data_response.py +1 -1
  51. hindsight_client_api/models/http_validation_error.py +1 -1
  52. hindsight_client_api/models/include_options.py +1 -1
  53. hindsight_client_api/models/list_documents_response.py +1 -1
  54. hindsight_client_api/models/list_memory_units_response.py +1 -1
  55. hindsight_client_api/models/memory_item.py +1 -1
  56. hindsight_client_api/models/operation_response.py +109 -0
  57. hindsight_client_api/models/operations_list_response.py +97 -0
  58. hindsight_client_api/models/recall_request.py +1 -1
  59. hindsight_client_api/models/recall_response.py +1 -1
  60. hindsight_client_api/models/recall_result.py +1 -1
  61. hindsight_client_api/models/reflect_fact.py +1 -1
  62. hindsight_client_api/models/reflect_include_options.py +1 -1
  63. hindsight_client_api/models/reflect_request.py +1 -1
  64. hindsight_client_api/models/reflect_response.py +1 -1
  65. hindsight_client_api/models/retain_request.py +1 -1
  66. hindsight_client_api/models/retain_response.py +1 -1
  67. hindsight_client_api/models/update_disposition_request.py +1 -1
  68. hindsight_client_api/models/validation_error.py +1 -1
  69. hindsight_client_api/models/validation_error_loc_inner.py +1 -1
  70. hindsight_client_api/rest.py +1 -1
  71. hindsight_client-0.1.14.dist-info/RECORD +0 -131
  72. hindsight_client_api/api/default_api.py +0 -5976
  73. hindsight_client_api/docs/DefaultApi.md +0 -1568
  74. hindsight_client_api/test/__init__.py +0 -0
  75. hindsight_client_api/test/test_add_background_request.py +0 -53
  76. hindsight_client_api/test/test_background_response.py +0 -53
  77. hindsight_client_api/test/test_bank_list_item.py +0 -60
  78. hindsight_client_api/test/test_bank_list_response.py +0 -68
  79. hindsight_client_api/test/test_bank_profile_response.py +0 -58
  80. hindsight_client_api/test/test_budget.py +0 -33
  81. hindsight_client_api/test/test_chunk_data.py +0 -57
  82. hindsight_client_api/test/test_chunk_include_options.py +0 -51
  83. hindsight_client_api/test/test_chunk_response.py +0 -62
  84. hindsight_client_api/test/test_create_bank_request.py +0 -53
  85. hindsight_client_api/test/test_default_api.py +0 -178
  86. hindsight_client_api/test/test_delete_response.py +0 -52
  87. hindsight_client_api/test/test_disposition_traits.py +0 -56
  88. hindsight_client_api/test/test_document_response.py +0 -64
  89. hindsight_client_api/test/test_entity_detail_response.py +0 -71
  90. hindsight_client_api/test/test_entity_include_options.py +0 -51
  91. hindsight_client_api/test/test_entity_list_item.py +0 -61
  92. hindsight_client_api/test/test_entity_list_response.py +0 -56
  93. hindsight_client_api/test/test_entity_observation_response.py +0 -53
  94. hindsight_client_api/test/test_entity_state_response.py +0 -64
  95. hindsight_client_api/test/test_graph_data_response.py +0 -82
  96. hindsight_client_api/test/test_http_validation_error.py +0 -58
  97. hindsight_client_api/test/test_include_options.py +0 -54
  98. hindsight_client_api/test/test_list_documents_response.py +0 -66
  99. hindsight_client_api/test/test_list_memory_units_response.py +0 -66
  100. hindsight_client_api/test/test_memory_item.py +0 -58
  101. hindsight_client_api/test/test_monitoring_api.py +0 -45
  102. hindsight_client_api/test/test_recall_request.py +0 -64
  103. hindsight_client_api/test/test_recall_response.py +0 -76
  104. hindsight_client_api/test/test_recall_result.py +0 -67
  105. hindsight_client_api/test/test_reflect_fact.py +0 -57
  106. hindsight_client_api/test/test_reflect_include_options.py +0 -51
  107. hindsight_client_api/test/test_reflect_request.py +0 -56
  108. hindsight_client_api/test/test_reflect_response.py +0 -55
  109. hindsight_client_api/test/test_retain_request.py +0 -57
  110. hindsight_client_api/test/test_retain_response.py +0 -58
  111. hindsight_client_api/test/test_update_disposition_request.py +0 -52
  112. hindsight_client_api/test/test_validation_error.py +0 -60
  113. hindsight_client_api/test/test_validation_error_loc_inner.py +0 -50
  114. {hindsight_client-0.1.14.dist-info → hindsight_client-0.1.16.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1901 @@
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
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from pydantic import Field, StrictInt, StrictStr
20
+ from typing import Optional
21
+ from typing_extensions import Annotated
22
+ from hindsight_client_api.models.delete_response import DeleteResponse
23
+ from hindsight_client_api.models.graph_data_response import GraphDataResponse
24
+ from hindsight_client_api.models.list_memory_units_response import ListMemoryUnitsResponse
25
+ from hindsight_client_api.models.recall_request import RecallRequest
26
+ from hindsight_client_api.models.recall_response import RecallResponse
27
+ from hindsight_client_api.models.reflect_request import ReflectRequest
28
+ from hindsight_client_api.models.reflect_response import ReflectResponse
29
+ from hindsight_client_api.models.retain_request import RetainRequest
30
+ from hindsight_client_api.models.retain_response import RetainResponse
31
+
32
+ from hindsight_client_api.api_client import ApiClient, RequestSerialized
33
+ from hindsight_client_api.api_response import ApiResponse
34
+ from hindsight_client_api.rest import RESTResponseType
35
+
36
+
37
+ class MemoryApi:
38
+ """NOTE: This class is auto generated by OpenAPI Generator
39
+ Ref: https://openapi-generator.tech
40
+
41
+ Do not edit the class manually.
42
+ """
43
+
44
+ def __init__(self, api_client=None) -> None:
45
+ if api_client is None:
46
+ api_client = ApiClient.get_default()
47
+ self.api_client = api_client
48
+
49
+
50
+ @validate_call
51
+ async def clear_bank_memories(
52
+ self,
53
+ bank_id: StrictStr,
54
+ type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, experience, opinion)")] = None,
55
+ authorization: Optional[StrictStr] = None,
56
+ _request_timeout: Union[
57
+ None,
58
+ Annotated[StrictFloat, Field(gt=0)],
59
+ Tuple[
60
+ Annotated[StrictFloat, Field(gt=0)],
61
+ Annotated[StrictFloat, Field(gt=0)]
62
+ ]
63
+ ] = None,
64
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
65
+ _content_type: Optional[StrictStr] = None,
66
+ _headers: Optional[Dict[StrictStr, Any]] = None,
67
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
68
+ ) -> DeleteResponse:
69
+ """Clear memory bank memories
70
+
71
+ Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved.
72
+
73
+ :param bank_id: (required)
74
+ :type bank_id: str
75
+ :param type: Optional fact type filter (world, experience, opinion)
76
+ :type type: str
77
+ :param authorization:
78
+ :type authorization: str
79
+ :param _request_timeout: timeout setting for this request. If one
80
+ number provided, it will be total request
81
+ timeout. It can also be a pair (tuple) of
82
+ (connection, read) timeouts.
83
+ :type _request_timeout: int, tuple(int, int), optional
84
+ :param _request_auth: set to override the auth_settings for an a single
85
+ request; this effectively ignores the
86
+ authentication in the spec for a single request.
87
+ :type _request_auth: dict, optional
88
+ :param _content_type: force content-type for the request.
89
+ :type _content_type: str, Optional
90
+ :param _headers: set to override the headers for a single
91
+ request; this effectively ignores the headers
92
+ in the spec for a single request.
93
+ :type _headers: dict, optional
94
+ :param _host_index: set to override the host_index for a single
95
+ request; this effectively ignores the host_index
96
+ in the spec for a single request.
97
+ :type _host_index: int, optional
98
+ :return: Returns the result object.
99
+ """ # noqa: E501
100
+
101
+ _param = self._clear_bank_memories_serialize(
102
+ bank_id=bank_id,
103
+ type=type,
104
+ authorization=authorization,
105
+ _request_auth=_request_auth,
106
+ _content_type=_content_type,
107
+ _headers=_headers,
108
+ _host_index=_host_index
109
+ )
110
+
111
+ _response_types_map: Dict[str, Optional[str]] = {
112
+ '200': "DeleteResponse",
113
+ '422': "HTTPValidationError",
114
+ }
115
+ response_data = await self.api_client.call_api(
116
+ *_param,
117
+ _request_timeout=_request_timeout
118
+ )
119
+ await response_data.read()
120
+ return self.api_client.response_deserialize(
121
+ response_data=response_data,
122
+ response_types_map=_response_types_map,
123
+ ).data
124
+
125
+
126
+ @validate_call
127
+ async def clear_bank_memories_with_http_info(
128
+ self,
129
+ bank_id: StrictStr,
130
+ type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, experience, opinion)")] = None,
131
+ authorization: Optional[StrictStr] = None,
132
+ _request_timeout: Union[
133
+ None,
134
+ Annotated[StrictFloat, Field(gt=0)],
135
+ Tuple[
136
+ Annotated[StrictFloat, Field(gt=0)],
137
+ Annotated[StrictFloat, Field(gt=0)]
138
+ ]
139
+ ] = None,
140
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
141
+ _content_type: Optional[StrictStr] = None,
142
+ _headers: Optional[Dict[StrictStr, Any]] = None,
143
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
144
+ ) -> ApiResponse[DeleteResponse]:
145
+ """Clear memory bank memories
146
+
147
+ Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved.
148
+
149
+ :param bank_id: (required)
150
+ :type bank_id: str
151
+ :param type: Optional fact type filter (world, experience, opinion)
152
+ :type type: str
153
+ :param authorization:
154
+ :type authorization: str
155
+ :param _request_timeout: timeout setting for this request. If one
156
+ number provided, it will be total request
157
+ timeout. It can also be a pair (tuple) of
158
+ (connection, read) timeouts.
159
+ :type _request_timeout: int, tuple(int, int), optional
160
+ :param _request_auth: set to override the auth_settings for an a single
161
+ request; this effectively ignores the
162
+ authentication in the spec for a single request.
163
+ :type _request_auth: dict, optional
164
+ :param _content_type: force content-type for the request.
165
+ :type _content_type: str, Optional
166
+ :param _headers: set to override the headers for a single
167
+ request; this effectively ignores the headers
168
+ in the spec for a single request.
169
+ :type _headers: dict, optional
170
+ :param _host_index: set to override the host_index for a single
171
+ request; this effectively ignores the host_index
172
+ in the spec for a single request.
173
+ :type _host_index: int, optional
174
+ :return: Returns the result object.
175
+ """ # noqa: E501
176
+
177
+ _param = self._clear_bank_memories_serialize(
178
+ bank_id=bank_id,
179
+ type=type,
180
+ authorization=authorization,
181
+ _request_auth=_request_auth,
182
+ _content_type=_content_type,
183
+ _headers=_headers,
184
+ _host_index=_host_index
185
+ )
186
+
187
+ _response_types_map: Dict[str, Optional[str]] = {
188
+ '200': "DeleteResponse",
189
+ '422': "HTTPValidationError",
190
+ }
191
+ response_data = await self.api_client.call_api(
192
+ *_param,
193
+ _request_timeout=_request_timeout
194
+ )
195
+ await response_data.read()
196
+ return self.api_client.response_deserialize(
197
+ response_data=response_data,
198
+ response_types_map=_response_types_map,
199
+ )
200
+
201
+
202
+ @validate_call
203
+ async def clear_bank_memories_without_preload_content(
204
+ self,
205
+ bank_id: StrictStr,
206
+ type: Annotated[Optional[StrictStr], Field(description="Optional fact type filter (world, experience, opinion)")] = None,
207
+ authorization: Optional[StrictStr] = None,
208
+ _request_timeout: Union[
209
+ None,
210
+ Annotated[StrictFloat, Field(gt=0)],
211
+ Tuple[
212
+ Annotated[StrictFloat, Field(gt=0)],
213
+ Annotated[StrictFloat, Field(gt=0)]
214
+ ]
215
+ ] = None,
216
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
217
+ _content_type: Optional[StrictStr] = None,
218
+ _headers: Optional[Dict[StrictStr, Any]] = None,
219
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
220
+ ) -> RESTResponseType:
221
+ """Clear memory bank memories
222
+
223
+ Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved.
224
+
225
+ :param bank_id: (required)
226
+ :type bank_id: str
227
+ :param type: Optional fact type filter (world, experience, opinion)
228
+ :type type: str
229
+ :param authorization:
230
+ :type authorization: str
231
+ :param _request_timeout: timeout setting for this request. If one
232
+ number provided, it will be total request
233
+ timeout. It can also be a pair (tuple) of
234
+ (connection, read) timeouts.
235
+ :type _request_timeout: int, tuple(int, int), optional
236
+ :param _request_auth: set to override the auth_settings for an a single
237
+ request; this effectively ignores the
238
+ authentication in the spec for a single request.
239
+ :type _request_auth: dict, optional
240
+ :param _content_type: force content-type for the request.
241
+ :type _content_type: str, Optional
242
+ :param _headers: set to override the headers for a single
243
+ request; this effectively ignores the headers
244
+ in the spec for a single request.
245
+ :type _headers: dict, optional
246
+ :param _host_index: set to override the host_index for a single
247
+ request; this effectively ignores the host_index
248
+ in the spec for a single request.
249
+ :type _host_index: int, optional
250
+ :return: Returns the result object.
251
+ """ # noqa: E501
252
+
253
+ _param = self._clear_bank_memories_serialize(
254
+ bank_id=bank_id,
255
+ type=type,
256
+ authorization=authorization,
257
+ _request_auth=_request_auth,
258
+ _content_type=_content_type,
259
+ _headers=_headers,
260
+ _host_index=_host_index
261
+ )
262
+
263
+ _response_types_map: Dict[str, Optional[str]] = {
264
+ '200': "DeleteResponse",
265
+ '422': "HTTPValidationError",
266
+ }
267
+ response_data = await self.api_client.call_api(
268
+ *_param,
269
+ _request_timeout=_request_timeout
270
+ )
271
+ return response_data.response
272
+
273
+
274
+ def _clear_bank_memories_serialize(
275
+ self,
276
+ bank_id,
277
+ type,
278
+ authorization,
279
+ _request_auth,
280
+ _content_type,
281
+ _headers,
282
+ _host_index,
283
+ ) -> RequestSerialized:
284
+
285
+ _host = None
286
+
287
+ _collection_formats: Dict[str, str] = {
288
+ }
289
+
290
+ _path_params: Dict[str, str] = {}
291
+ _query_params: List[Tuple[str, str]] = []
292
+ _header_params: Dict[str, Optional[str]] = _headers or {}
293
+ _form_params: List[Tuple[str, str]] = []
294
+ _files: Dict[
295
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
296
+ ] = {}
297
+ _body_params: Optional[bytes] = None
298
+
299
+ # process the path parameters
300
+ if bank_id is not None:
301
+ _path_params['bank_id'] = bank_id
302
+ # process the query parameters
303
+ if type is not None:
304
+
305
+ _query_params.append(('type', type))
306
+
307
+ # process the header parameters
308
+ if authorization is not None:
309
+ _header_params['authorization'] = authorization
310
+ # process the form parameters
311
+ # process the body parameter
312
+
313
+
314
+ # set the HTTP header `Accept`
315
+ if 'Accept' not in _header_params:
316
+ _header_params['Accept'] = self.api_client.select_header_accept(
317
+ [
318
+ 'application/json'
319
+ ]
320
+ )
321
+
322
+
323
+ # authentication setting
324
+ _auth_settings: List[str] = [
325
+ ]
326
+
327
+ return self.api_client.param_serialize(
328
+ method='DELETE',
329
+ resource_path='/v1/default/banks/{bank_id}/memories',
330
+ path_params=_path_params,
331
+ query_params=_query_params,
332
+ header_params=_header_params,
333
+ body=_body_params,
334
+ post_params=_form_params,
335
+ files=_files,
336
+ auth_settings=_auth_settings,
337
+ collection_formats=_collection_formats,
338
+ _host=_host,
339
+ _request_auth=_request_auth
340
+ )
341
+
342
+
343
+
344
+
345
+ @validate_call
346
+ async def get_graph(
347
+ self,
348
+ bank_id: StrictStr,
349
+ type: Optional[StrictStr] = None,
350
+ authorization: Optional[StrictStr] = None,
351
+ _request_timeout: Union[
352
+ None,
353
+ Annotated[StrictFloat, Field(gt=0)],
354
+ Tuple[
355
+ Annotated[StrictFloat, Field(gt=0)],
356
+ Annotated[StrictFloat, Field(gt=0)]
357
+ ]
358
+ ] = None,
359
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
360
+ _content_type: Optional[StrictStr] = None,
361
+ _headers: Optional[Dict[StrictStr, Any]] = None,
362
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
363
+ ) -> GraphDataResponse:
364
+ """Get memory graph data
365
+
366
+ Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items.
367
+
368
+ :param bank_id: (required)
369
+ :type bank_id: str
370
+ :param type:
371
+ :type type: str
372
+ :param authorization:
373
+ :type authorization: str
374
+ :param _request_timeout: timeout setting for this request. If one
375
+ number provided, it will be total request
376
+ timeout. It can also be a pair (tuple) of
377
+ (connection, read) timeouts.
378
+ :type _request_timeout: int, tuple(int, int), optional
379
+ :param _request_auth: set to override the auth_settings for an a single
380
+ request; this effectively ignores the
381
+ authentication in the spec for a single request.
382
+ :type _request_auth: dict, optional
383
+ :param _content_type: force content-type for the request.
384
+ :type _content_type: str, Optional
385
+ :param _headers: set to override the headers for a single
386
+ request; this effectively ignores the headers
387
+ in the spec for a single request.
388
+ :type _headers: dict, optional
389
+ :param _host_index: set to override the host_index for a single
390
+ request; this effectively ignores the host_index
391
+ in the spec for a single request.
392
+ :type _host_index: int, optional
393
+ :return: Returns the result object.
394
+ """ # noqa: E501
395
+
396
+ _param = self._get_graph_serialize(
397
+ bank_id=bank_id,
398
+ type=type,
399
+ authorization=authorization,
400
+ _request_auth=_request_auth,
401
+ _content_type=_content_type,
402
+ _headers=_headers,
403
+ _host_index=_host_index
404
+ )
405
+
406
+ _response_types_map: Dict[str, Optional[str]] = {
407
+ '200': "GraphDataResponse",
408
+ '422': "HTTPValidationError",
409
+ }
410
+ response_data = await self.api_client.call_api(
411
+ *_param,
412
+ _request_timeout=_request_timeout
413
+ )
414
+ await response_data.read()
415
+ return self.api_client.response_deserialize(
416
+ response_data=response_data,
417
+ response_types_map=_response_types_map,
418
+ ).data
419
+
420
+
421
+ @validate_call
422
+ async def get_graph_with_http_info(
423
+ self,
424
+ bank_id: StrictStr,
425
+ type: Optional[StrictStr] = None,
426
+ authorization: Optional[StrictStr] = None,
427
+ _request_timeout: Union[
428
+ None,
429
+ Annotated[StrictFloat, Field(gt=0)],
430
+ Tuple[
431
+ Annotated[StrictFloat, Field(gt=0)],
432
+ Annotated[StrictFloat, Field(gt=0)]
433
+ ]
434
+ ] = None,
435
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
436
+ _content_type: Optional[StrictStr] = None,
437
+ _headers: Optional[Dict[StrictStr, Any]] = None,
438
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
439
+ ) -> ApiResponse[GraphDataResponse]:
440
+ """Get memory graph data
441
+
442
+ Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items.
443
+
444
+ :param bank_id: (required)
445
+ :type bank_id: str
446
+ :param type:
447
+ :type type: str
448
+ :param authorization:
449
+ :type authorization: str
450
+ :param _request_timeout: timeout setting for this request. If one
451
+ number provided, it will be total request
452
+ timeout. It can also be a pair (tuple) of
453
+ (connection, read) timeouts.
454
+ :type _request_timeout: int, tuple(int, int), optional
455
+ :param _request_auth: set to override the auth_settings for an a single
456
+ request; this effectively ignores the
457
+ authentication in the spec for a single request.
458
+ :type _request_auth: dict, optional
459
+ :param _content_type: force content-type for the request.
460
+ :type _content_type: str, Optional
461
+ :param _headers: set to override the headers for a single
462
+ request; this effectively ignores the headers
463
+ in the spec for a single request.
464
+ :type _headers: dict, optional
465
+ :param _host_index: set to override the host_index for a single
466
+ request; this effectively ignores the host_index
467
+ in the spec for a single request.
468
+ :type _host_index: int, optional
469
+ :return: Returns the result object.
470
+ """ # noqa: E501
471
+
472
+ _param = self._get_graph_serialize(
473
+ bank_id=bank_id,
474
+ type=type,
475
+ authorization=authorization,
476
+ _request_auth=_request_auth,
477
+ _content_type=_content_type,
478
+ _headers=_headers,
479
+ _host_index=_host_index
480
+ )
481
+
482
+ _response_types_map: Dict[str, Optional[str]] = {
483
+ '200': "GraphDataResponse",
484
+ '422': "HTTPValidationError",
485
+ }
486
+ response_data = await self.api_client.call_api(
487
+ *_param,
488
+ _request_timeout=_request_timeout
489
+ )
490
+ await response_data.read()
491
+ return self.api_client.response_deserialize(
492
+ response_data=response_data,
493
+ response_types_map=_response_types_map,
494
+ )
495
+
496
+
497
+ @validate_call
498
+ async def get_graph_without_preload_content(
499
+ self,
500
+ bank_id: StrictStr,
501
+ type: Optional[StrictStr] = None,
502
+ authorization: Optional[StrictStr] = None,
503
+ _request_timeout: Union[
504
+ None,
505
+ Annotated[StrictFloat, Field(gt=0)],
506
+ Tuple[
507
+ Annotated[StrictFloat, Field(gt=0)],
508
+ Annotated[StrictFloat, Field(gt=0)]
509
+ ]
510
+ ] = None,
511
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
512
+ _content_type: Optional[StrictStr] = None,
513
+ _headers: Optional[Dict[StrictStr, Any]] = None,
514
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
515
+ ) -> RESTResponseType:
516
+ """Get memory graph data
517
+
518
+ Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). Limited to 1000 most recent items.
519
+
520
+ :param bank_id: (required)
521
+ :type bank_id: str
522
+ :param type:
523
+ :type type: str
524
+ :param authorization:
525
+ :type authorization: str
526
+ :param _request_timeout: timeout setting for this request. If one
527
+ number provided, it will be total request
528
+ timeout. It can also be a pair (tuple) of
529
+ (connection, read) timeouts.
530
+ :type _request_timeout: int, tuple(int, int), optional
531
+ :param _request_auth: set to override the auth_settings for an a single
532
+ request; this effectively ignores the
533
+ authentication in the spec for a single request.
534
+ :type _request_auth: dict, optional
535
+ :param _content_type: force content-type for the request.
536
+ :type _content_type: str, Optional
537
+ :param _headers: set to override the headers for a single
538
+ request; this effectively ignores the headers
539
+ in the spec for a single request.
540
+ :type _headers: dict, optional
541
+ :param _host_index: set to override the host_index for a single
542
+ request; this effectively ignores the host_index
543
+ in the spec for a single request.
544
+ :type _host_index: int, optional
545
+ :return: Returns the result object.
546
+ """ # noqa: E501
547
+
548
+ _param = self._get_graph_serialize(
549
+ bank_id=bank_id,
550
+ type=type,
551
+ authorization=authorization,
552
+ _request_auth=_request_auth,
553
+ _content_type=_content_type,
554
+ _headers=_headers,
555
+ _host_index=_host_index
556
+ )
557
+
558
+ _response_types_map: Dict[str, Optional[str]] = {
559
+ '200': "GraphDataResponse",
560
+ '422': "HTTPValidationError",
561
+ }
562
+ response_data = await self.api_client.call_api(
563
+ *_param,
564
+ _request_timeout=_request_timeout
565
+ )
566
+ return response_data.response
567
+
568
+
569
+ def _get_graph_serialize(
570
+ self,
571
+ bank_id,
572
+ type,
573
+ authorization,
574
+ _request_auth,
575
+ _content_type,
576
+ _headers,
577
+ _host_index,
578
+ ) -> RequestSerialized:
579
+
580
+ _host = None
581
+
582
+ _collection_formats: Dict[str, str] = {
583
+ }
584
+
585
+ _path_params: Dict[str, str] = {}
586
+ _query_params: List[Tuple[str, str]] = []
587
+ _header_params: Dict[str, Optional[str]] = _headers or {}
588
+ _form_params: List[Tuple[str, str]] = []
589
+ _files: Dict[
590
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
591
+ ] = {}
592
+ _body_params: Optional[bytes] = None
593
+
594
+ # process the path parameters
595
+ if bank_id is not None:
596
+ _path_params['bank_id'] = bank_id
597
+ # process the query parameters
598
+ if type is not None:
599
+
600
+ _query_params.append(('type', type))
601
+
602
+ # process the header parameters
603
+ if authorization is not None:
604
+ _header_params['authorization'] = authorization
605
+ # process the form parameters
606
+ # process the body parameter
607
+
608
+
609
+ # set the HTTP header `Accept`
610
+ if 'Accept' not in _header_params:
611
+ _header_params['Accept'] = self.api_client.select_header_accept(
612
+ [
613
+ 'application/json'
614
+ ]
615
+ )
616
+
617
+
618
+ # authentication setting
619
+ _auth_settings: List[str] = [
620
+ ]
621
+
622
+ return self.api_client.param_serialize(
623
+ method='GET',
624
+ resource_path='/v1/default/banks/{bank_id}/graph',
625
+ path_params=_path_params,
626
+ query_params=_query_params,
627
+ header_params=_header_params,
628
+ body=_body_params,
629
+ post_params=_form_params,
630
+ files=_files,
631
+ auth_settings=_auth_settings,
632
+ collection_formats=_collection_formats,
633
+ _host=_host,
634
+ _request_auth=_request_auth
635
+ )
636
+
637
+
638
+
639
+
640
+ @validate_call
641
+ async def list_memories(
642
+ self,
643
+ bank_id: StrictStr,
644
+ type: Optional[StrictStr] = None,
645
+ q: Optional[StrictStr] = None,
646
+ limit: Optional[StrictInt] = None,
647
+ offset: Optional[StrictInt] = None,
648
+ authorization: Optional[StrictStr] = None,
649
+ _request_timeout: Union[
650
+ None,
651
+ Annotated[StrictFloat, Field(gt=0)],
652
+ Tuple[
653
+ Annotated[StrictFloat, Field(gt=0)],
654
+ Annotated[StrictFloat, Field(gt=0)]
655
+ ]
656
+ ] = None,
657
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
658
+ _content_type: Optional[StrictStr] = None,
659
+ _headers: Optional[Dict[StrictStr, Any]] = None,
660
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
661
+ ) -> ListMemoryUnitsResponse:
662
+ """List memory units
663
+
664
+ List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC).
665
+
666
+ :param bank_id: (required)
667
+ :type bank_id: str
668
+ :param type:
669
+ :type type: str
670
+ :param q:
671
+ :type q: str
672
+ :param limit:
673
+ :type limit: int
674
+ :param offset:
675
+ :type offset: int
676
+ :param authorization:
677
+ :type authorization: str
678
+ :param _request_timeout: timeout setting for this request. If one
679
+ number provided, it will be total request
680
+ timeout. It can also be a pair (tuple) of
681
+ (connection, read) timeouts.
682
+ :type _request_timeout: int, tuple(int, int), optional
683
+ :param _request_auth: set to override the auth_settings for an a single
684
+ request; this effectively ignores the
685
+ authentication in the spec for a single request.
686
+ :type _request_auth: dict, optional
687
+ :param _content_type: force content-type for the request.
688
+ :type _content_type: str, Optional
689
+ :param _headers: set to override the headers for a single
690
+ request; this effectively ignores the headers
691
+ in the spec for a single request.
692
+ :type _headers: dict, optional
693
+ :param _host_index: set to override the host_index for a single
694
+ request; this effectively ignores the host_index
695
+ in the spec for a single request.
696
+ :type _host_index: int, optional
697
+ :return: Returns the result object.
698
+ """ # noqa: E501
699
+
700
+ _param = self._list_memories_serialize(
701
+ bank_id=bank_id,
702
+ type=type,
703
+ q=q,
704
+ limit=limit,
705
+ offset=offset,
706
+ authorization=authorization,
707
+ _request_auth=_request_auth,
708
+ _content_type=_content_type,
709
+ _headers=_headers,
710
+ _host_index=_host_index
711
+ )
712
+
713
+ _response_types_map: Dict[str, Optional[str]] = {
714
+ '200': "ListMemoryUnitsResponse",
715
+ '422': "HTTPValidationError",
716
+ }
717
+ response_data = await self.api_client.call_api(
718
+ *_param,
719
+ _request_timeout=_request_timeout
720
+ )
721
+ await response_data.read()
722
+ return self.api_client.response_deserialize(
723
+ response_data=response_data,
724
+ response_types_map=_response_types_map,
725
+ ).data
726
+
727
+
728
+ @validate_call
729
+ async def list_memories_with_http_info(
730
+ self,
731
+ bank_id: StrictStr,
732
+ type: Optional[StrictStr] = None,
733
+ q: Optional[StrictStr] = None,
734
+ limit: Optional[StrictInt] = None,
735
+ offset: Optional[StrictInt] = None,
736
+ authorization: Optional[StrictStr] = None,
737
+ _request_timeout: Union[
738
+ None,
739
+ Annotated[StrictFloat, Field(gt=0)],
740
+ Tuple[
741
+ Annotated[StrictFloat, Field(gt=0)],
742
+ Annotated[StrictFloat, Field(gt=0)]
743
+ ]
744
+ ] = None,
745
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
746
+ _content_type: Optional[StrictStr] = None,
747
+ _headers: Optional[Dict[StrictStr, Any]] = None,
748
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
749
+ ) -> ApiResponse[ListMemoryUnitsResponse]:
750
+ """List memory units
751
+
752
+ List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC).
753
+
754
+ :param bank_id: (required)
755
+ :type bank_id: str
756
+ :param type:
757
+ :type type: str
758
+ :param q:
759
+ :type q: str
760
+ :param limit:
761
+ :type limit: int
762
+ :param offset:
763
+ :type offset: int
764
+ :param authorization:
765
+ :type authorization: str
766
+ :param _request_timeout: timeout setting for this request. If one
767
+ number provided, it will be total request
768
+ timeout. It can also be a pair (tuple) of
769
+ (connection, read) timeouts.
770
+ :type _request_timeout: int, tuple(int, int), optional
771
+ :param _request_auth: set to override the auth_settings for an a single
772
+ request; this effectively ignores the
773
+ authentication in the spec for a single request.
774
+ :type _request_auth: dict, optional
775
+ :param _content_type: force content-type for the request.
776
+ :type _content_type: str, Optional
777
+ :param _headers: set to override the headers for a single
778
+ request; this effectively ignores the headers
779
+ in the spec for a single request.
780
+ :type _headers: dict, optional
781
+ :param _host_index: set to override the host_index for a single
782
+ request; this effectively ignores the host_index
783
+ in the spec for a single request.
784
+ :type _host_index: int, optional
785
+ :return: Returns the result object.
786
+ """ # noqa: E501
787
+
788
+ _param = self._list_memories_serialize(
789
+ bank_id=bank_id,
790
+ type=type,
791
+ q=q,
792
+ limit=limit,
793
+ offset=offset,
794
+ authorization=authorization,
795
+ _request_auth=_request_auth,
796
+ _content_type=_content_type,
797
+ _headers=_headers,
798
+ _host_index=_host_index
799
+ )
800
+
801
+ _response_types_map: Dict[str, Optional[str]] = {
802
+ '200': "ListMemoryUnitsResponse",
803
+ '422': "HTTPValidationError",
804
+ }
805
+ response_data = await self.api_client.call_api(
806
+ *_param,
807
+ _request_timeout=_request_timeout
808
+ )
809
+ await response_data.read()
810
+ return self.api_client.response_deserialize(
811
+ response_data=response_data,
812
+ response_types_map=_response_types_map,
813
+ )
814
+
815
+
816
+ @validate_call
817
+ async def list_memories_without_preload_content(
818
+ self,
819
+ bank_id: StrictStr,
820
+ type: Optional[StrictStr] = None,
821
+ q: Optional[StrictStr] = None,
822
+ limit: Optional[StrictInt] = None,
823
+ offset: Optional[StrictInt] = None,
824
+ authorization: Optional[StrictStr] = None,
825
+ _request_timeout: Union[
826
+ None,
827
+ Annotated[StrictFloat, Field(gt=0)],
828
+ Tuple[
829
+ Annotated[StrictFloat, Field(gt=0)],
830
+ Annotated[StrictFloat, Field(gt=0)]
831
+ ]
832
+ ] = None,
833
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
834
+ _content_type: Optional[StrictStr] = None,
835
+ _headers: Optional[Dict[StrictStr, Any]] = None,
836
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
837
+ ) -> RESTResponseType:
838
+ """List memory units
839
+
840
+ List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC).
841
+
842
+ :param bank_id: (required)
843
+ :type bank_id: str
844
+ :param type:
845
+ :type type: str
846
+ :param q:
847
+ :type q: str
848
+ :param limit:
849
+ :type limit: int
850
+ :param offset:
851
+ :type offset: int
852
+ :param authorization:
853
+ :type authorization: str
854
+ :param _request_timeout: timeout setting for this request. If one
855
+ number provided, it will be total request
856
+ timeout. It can also be a pair (tuple) of
857
+ (connection, read) timeouts.
858
+ :type _request_timeout: int, tuple(int, int), optional
859
+ :param _request_auth: set to override the auth_settings for an a single
860
+ request; this effectively ignores the
861
+ authentication in the spec for a single request.
862
+ :type _request_auth: dict, optional
863
+ :param _content_type: force content-type for the request.
864
+ :type _content_type: str, Optional
865
+ :param _headers: set to override the headers for a single
866
+ request; this effectively ignores the headers
867
+ in the spec for a single request.
868
+ :type _headers: dict, optional
869
+ :param _host_index: set to override the host_index for a single
870
+ request; this effectively ignores the host_index
871
+ in the spec for a single request.
872
+ :type _host_index: int, optional
873
+ :return: Returns the result object.
874
+ """ # noqa: E501
875
+
876
+ _param = self._list_memories_serialize(
877
+ bank_id=bank_id,
878
+ type=type,
879
+ q=q,
880
+ limit=limit,
881
+ offset=offset,
882
+ authorization=authorization,
883
+ _request_auth=_request_auth,
884
+ _content_type=_content_type,
885
+ _headers=_headers,
886
+ _host_index=_host_index
887
+ )
888
+
889
+ _response_types_map: Dict[str, Optional[str]] = {
890
+ '200': "ListMemoryUnitsResponse",
891
+ '422': "HTTPValidationError",
892
+ }
893
+ response_data = await self.api_client.call_api(
894
+ *_param,
895
+ _request_timeout=_request_timeout
896
+ )
897
+ return response_data.response
898
+
899
+
900
+ def _list_memories_serialize(
901
+ self,
902
+ bank_id,
903
+ type,
904
+ q,
905
+ limit,
906
+ offset,
907
+ authorization,
908
+ _request_auth,
909
+ _content_type,
910
+ _headers,
911
+ _host_index,
912
+ ) -> RequestSerialized:
913
+
914
+ _host = None
915
+
916
+ _collection_formats: Dict[str, str] = {
917
+ }
918
+
919
+ _path_params: Dict[str, str] = {}
920
+ _query_params: List[Tuple[str, str]] = []
921
+ _header_params: Dict[str, Optional[str]] = _headers or {}
922
+ _form_params: List[Tuple[str, str]] = []
923
+ _files: Dict[
924
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
925
+ ] = {}
926
+ _body_params: Optional[bytes] = None
927
+
928
+ # process the path parameters
929
+ if bank_id is not None:
930
+ _path_params['bank_id'] = bank_id
931
+ # process the query parameters
932
+ if type is not None:
933
+
934
+ _query_params.append(('type', type))
935
+
936
+ if q is not None:
937
+
938
+ _query_params.append(('q', q))
939
+
940
+ if limit is not None:
941
+
942
+ _query_params.append(('limit', limit))
943
+
944
+ if offset is not None:
945
+
946
+ _query_params.append(('offset', offset))
947
+
948
+ # process the header parameters
949
+ if authorization is not None:
950
+ _header_params['authorization'] = authorization
951
+ # process the form parameters
952
+ # process the body parameter
953
+
954
+
955
+ # set the HTTP header `Accept`
956
+ if 'Accept' not in _header_params:
957
+ _header_params['Accept'] = self.api_client.select_header_accept(
958
+ [
959
+ 'application/json'
960
+ ]
961
+ )
962
+
963
+
964
+ # authentication setting
965
+ _auth_settings: List[str] = [
966
+ ]
967
+
968
+ return self.api_client.param_serialize(
969
+ method='GET',
970
+ resource_path='/v1/default/banks/{bank_id}/memories/list',
971
+ path_params=_path_params,
972
+ query_params=_query_params,
973
+ header_params=_header_params,
974
+ body=_body_params,
975
+ post_params=_form_params,
976
+ files=_files,
977
+ auth_settings=_auth_settings,
978
+ collection_formats=_collection_formats,
979
+ _host=_host,
980
+ _request_auth=_request_auth
981
+ )
982
+
983
+
984
+
985
+
986
+ @validate_call
987
+ async def recall_memories(
988
+ self,
989
+ bank_id: StrictStr,
990
+ recall_request: RecallRequest,
991
+ authorization: Optional[StrictStr] = None,
992
+ _request_timeout: Union[
993
+ None,
994
+ Annotated[StrictFloat, Field(gt=0)],
995
+ Tuple[
996
+ Annotated[StrictFloat, Field(gt=0)],
997
+ Annotated[StrictFloat, Field(gt=0)]
998
+ ]
999
+ ] = None,
1000
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1001
+ _content_type: Optional[StrictStr] = None,
1002
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1003
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1004
+ ) -> RecallResponse:
1005
+ """Recall memory
1006
+
1007
+ Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - `world`: General knowledge about people, places, events, and things that happen - `experience`: Memories about experience, conversations, actions taken, and tasks performed - `opinion`: The bank's formed beliefs, perspectives, and viewpoints Set `include_entities=true` to get entity observations alongside recall results.
1008
+
1009
+ :param bank_id: (required)
1010
+ :type bank_id: str
1011
+ :param recall_request: (required)
1012
+ :type recall_request: RecallRequest
1013
+ :param authorization:
1014
+ :type authorization: str
1015
+ :param _request_timeout: timeout setting for this request. If one
1016
+ number provided, it will be total request
1017
+ timeout. It can also be a pair (tuple) of
1018
+ (connection, read) timeouts.
1019
+ :type _request_timeout: int, tuple(int, int), optional
1020
+ :param _request_auth: set to override the auth_settings for an a single
1021
+ request; this effectively ignores the
1022
+ authentication in the spec for a single request.
1023
+ :type _request_auth: dict, optional
1024
+ :param _content_type: force content-type for the request.
1025
+ :type _content_type: str, Optional
1026
+ :param _headers: set to override the headers for a single
1027
+ request; this effectively ignores the headers
1028
+ in the spec for a single request.
1029
+ :type _headers: dict, optional
1030
+ :param _host_index: set to override the host_index for a single
1031
+ request; this effectively ignores the host_index
1032
+ in the spec for a single request.
1033
+ :type _host_index: int, optional
1034
+ :return: Returns the result object.
1035
+ """ # noqa: E501
1036
+
1037
+ _param = self._recall_memories_serialize(
1038
+ bank_id=bank_id,
1039
+ recall_request=recall_request,
1040
+ authorization=authorization,
1041
+ _request_auth=_request_auth,
1042
+ _content_type=_content_type,
1043
+ _headers=_headers,
1044
+ _host_index=_host_index
1045
+ )
1046
+
1047
+ _response_types_map: Dict[str, Optional[str]] = {
1048
+ '200': "RecallResponse",
1049
+ '422': "HTTPValidationError",
1050
+ }
1051
+ response_data = await self.api_client.call_api(
1052
+ *_param,
1053
+ _request_timeout=_request_timeout
1054
+ )
1055
+ await response_data.read()
1056
+ return self.api_client.response_deserialize(
1057
+ response_data=response_data,
1058
+ response_types_map=_response_types_map,
1059
+ ).data
1060
+
1061
+
1062
+ @validate_call
1063
+ async def recall_memories_with_http_info(
1064
+ self,
1065
+ bank_id: StrictStr,
1066
+ recall_request: RecallRequest,
1067
+ authorization: Optional[StrictStr] = None,
1068
+ _request_timeout: Union[
1069
+ None,
1070
+ Annotated[StrictFloat, Field(gt=0)],
1071
+ Tuple[
1072
+ Annotated[StrictFloat, Field(gt=0)],
1073
+ Annotated[StrictFloat, Field(gt=0)]
1074
+ ]
1075
+ ] = None,
1076
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1077
+ _content_type: Optional[StrictStr] = None,
1078
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1079
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1080
+ ) -> ApiResponse[RecallResponse]:
1081
+ """Recall memory
1082
+
1083
+ Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - `world`: General knowledge about people, places, events, and things that happen - `experience`: Memories about experience, conversations, actions taken, and tasks performed - `opinion`: The bank's formed beliefs, perspectives, and viewpoints Set `include_entities=true` to get entity observations alongside recall results.
1084
+
1085
+ :param bank_id: (required)
1086
+ :type bank_id: str
1087
+ :param recall_request: (required)
1088
+ :type recall_request: RecallRequest
1089
+ :param authorization:
1090
+ :type authorization: str
1091
+ :param _request_timeout: timeout setting for this request. If one
1092
+ number provided, it will be total request
1093
+ timeout. It can also be a pair (tuple) of
1094
+ (connection, read) timeouts.
1095
+ :type _request_timeout: int, tuple(int, int), optional
1096
+ :param _request_auth: set to override the auth_settings for an a single
1097
+ request; this effectively ignores the
1098
+ authentication in the spec for a single request.
1099
+ :type _request_auth: dict, optional
1100
+ :param _content_type: force content-type for the request.
1101
+ :type _content_type: str, Optional
1102
+ :param _headers: set to override the headers for a single
1103
+ request; this effectively ignores the headers
1104
+ in the spec for a single request.
1105
+ :type _headers: dict, optional
1106
+ :param _host_index: set to override the host_index for a single
1107
+ request; this effectively ignores the host_index
1108
+ in the spec for a single request.
1109
+ :type _host_index: int, optional
1110
+ :return: Returns the result object.
1111
+ """ # noqa: E501
1112
+
1113
+ _param = self._recall_memories_serialize(
1114
+ bank_id=bank_id,
1115
+ recall_request=recall_request,
1116
+ authorization=authorization,
1117
+ _request_auth=_request_auth,
1118
+ _content_type=_content_type,
1119
+ _headers=_headers,
1120
+ _host_index=_host_index
1121
+ )
1122
+
1123
+ _response_types_map: Dict[str, Optional[str]] = {
1124
+ '200': "RecallResponse",
1125
+ '422': "HTTPValidationError",
1126
+ }
1127
+ response_data = await self.api_client.call_api(
1128
+ *_param,
1129
+ _request_timeout=_request_timeout
1130
+ )
1131
+ await response_data.read()
1132
+ return self.api_client.response_deserialize(
1133
+ response_data=response_data,
1134
+ response_types_map=_response_types_map,
1135
+ )
1136
+
1137
+
1138
+ @validate_call
1139
+ async def recall_memories_without_preload_content(
1140
+ self,
1141
+ bank_id: StrictStr,
1142
+ recall_request: RecallRequest,
1143
+ authorization: Optional[StrictStr] = None,
1144
+ _request_timeout: Union[
1145
+ None,
1146
+ Annotated[StrictFloat, Field(gt=0)],
1147
+ Tuple[
1148
+ Annotated[StrictFloat, Field(gt=0)],
1149
+ Annotated[StrictFloat, Field(gt=0)]
1150
+ ]
1151
+ ] = None,
1152
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1153
+ _content_type: Optional[StrictStr] = None,
1154
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1155
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1156
+ ) -> RESTResponseType:
1157
+ """Recall memory
1158
+
1159
+ Recall memory using semantic similarity and spreading activation. The type parameter is optional and must be one of: - `world`: General knowledge about people, places, events, and things that happen - `experience`: Memories about experience, conversations, actions taken, and tasks performed - `opinion`: The bank's formed beliefs, perspectives, and viewpoints Set `include_entities=true` to get entity observations alongside recall results.
1160
+
1161
+ :param bank_id: (required)
1162
+ :type bank_id: str
1163
+ :param recall_request: (required)
1164
+ :type recall_request: RecallRequest
1165
+ :param authorization:
1166
+ :type authorization: str
1167
+ :param _request_timeout: timeout setting for this request. If one
1168
+ number provided, it will be total request
1169
+ timeout. It can also be a pair (tuple) of
1170
+ (connection, read) timeouts.
1171
+ :type _request_timeout: int, tuple(int, int), optional
1172
+ :param _request_auth: set to override the auth_settings for an a single
1173
+ request; this effectively ignores the
1174
+ authentication in the spec for a single request.
1175
+ :type _request_auth: dict, optional
1176
+ :param _content_type: force content-type for the request.
1177
+ :type _content_type: str, Optional
1178
+ :param _headers: set to override the headers for a single
1179
+ request; this effectively ignores the headers
1180
+ in the spec for a single request.
1181
+ :type _headers: dict, optional
1182
+ :param _host_index: set to override the host_index for a single
1183
+ request; this effectively ignores the host_index
1184
+ in the spec for a single request.
1185
+ :type _host_index: int, optional
1186
+ :return: Returns the result object.
1187
+ """ # noqa: E501
1188
+
1189
+ _param = self._recall_memories_serialize(
1190
+ bank_id=bank_id,
1191
+ recall_request=recall_request,
1192
+ authorization=authorization,
1193
+ _request_auth=_request_auth,
1194
+ _content_type=_content_type,
1195
+ _headers=_headers,
1196
+ _host_index=_host_index
1197
+ )
1198
+
1199
+ _response_types_map: Dict[str, Optional[str]] = {
1200
+ '200': "RecallResponse",
1201
+ '422': "HTTPValidationError",
1202
+ }
1203
+ response_data = await self.api_client.call_api(
1204
+ *_param,
1205
+ _request_timeout=_request_timeout
1206
+ )
1207
+ return response_data.response
1208
+
1209
+
1210
+ def _recall_memories_serialize(
1211
+ self,
1212
+ bank_id,
1213
+ recall_request,
1214
+ authorization,
1215
+ _request_auth,
1216
+ _content_type,
1217
+ _headers,
1218
+ _host_index,
1219
+ ) -> RequestSerialized:
1220
+
1221
+ _host = None
1222
+
1223
+ _collection_formats: Dict[str, str] = {
1224
+ }
1225
+
1226
+ _path_params: Dict[str, str] = {}
1227
+ _query_params: List[Tuple[str, str]] = []
1228
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1229
+ _form_params: List[Tuple[str, str]] = []
1230
+ _files: Dict[
1231
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1232
+ ] = {}
1233
+ _body_params: Optional[bytes] = None
1234
+
1235
+ # process the path parameters
1236
+ if bank_id is not None:
1237
+ _path_params['bank_id'] = bank_id
1238
+ # process the query parameters
1239
+ # process the header parameters
1240
+ if authorization is not None:
1241
+ _header_params['authorization'] = authorization
1242
+ # process the form parameters
1243
+ # process the body parameter
1244
+ if recall_request is not None:
1245
+ _body_params = recall_request
1246
+
1247
+
1248
+ # set the HTTP header `Accept`
1249
+ if 'Accept' not in _header_params:
1250
+ _header_params['Accept'] = self.api_client.select_header_accept(
1251
+ [
1252
+ 'application/json'
1253
+ ]
1254
+ )
1255
+
1256
+ # set the HTTP header `Content-Type`
1257
+ if _content_type:
1258
+ _header_params['Content-Type'] = _content_type
1259
+ else:
1260
+ _default_content_type = (
1261
+ self.api_client.select_header_content_type(
1262
+ [
1263
+ 'application/json'
1264
+ ]
1265
+ )
1266
+ )
1267
+ if _default_content_type is not None:
1268
+ _header_params['Content-Type'] = _default_content_type
1269
+
1270
+ # authentication setting
1271
+ _auth_settings: List[str] = [
1272
+ ]
1273
+
1274
+ return self.api_client.param_serialize(
1275
+ method='POST',
1276
+ resource_path='/v1/default/banks/{bank_id}/memories/recall',
1277
+ path_params=_path_params,
1278
+ query_params=_query_params,
1279
+ header_params=_header_params,
1280
+ body=_body_params,
1281
+ post_params=_form_params,
1282
+ files=_files,
1283
+ auth_settings=_auth_settings,
1284
+ collection_formats=_collection_formats,
1285
+ _host=_host,
1286
+ _request_auth=_request_auth
1287
+ )
1288
+
1289
+
1290
+
1291
+
1292
+ @validate_call
1293
+ async def reflect(
1294
+ self,
1295
+ bank_id: StrictStr,
1296
+ reflect_request: ReflectRequest,
1297
+ authorization: Optional[StrictStr] = None,
1298
+ _request_timeout: Union[
1299
+ None,
1300
+ Annotated[StrictFloat, Field(gt=0)],
1301
+ Tuple[
1302
+ Annotated[StrictFloat, Field(gt=0)],
1303
+ Annotated[StrictFloat, Field(gt=0)]
1304
+ ]
1305
+ ] = None,
1306
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1307
+ _content_type: Optional[StrictStr] = None,
1308
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1309
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1310
+ ) -> ReflectResponse:
1311
+ """Reflect and generate answer
1312
+
1313
+ Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves experience (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions
1314
+
1315
+ :param bank_id: (required)
1316
+ :type bank_id: str
1317
+ :param reflect_request: (required)
1318
+ :type reflect_request: ReflectRequest
1319
+ :param authorization:
1320
+ :type authorization: str
1321
+ :param _request_timeout: timeout setting for this request. If one
1322
+ number provided, it will be total request
1323
+ timeout. It can also be a pair (tuple) of
1324
+ (connection, read) timeouts.
1325
+ :type _request_timeout: int, tuple(int, int), optional
1326
+ :param _request_auth: set to override the auth_settings for an a single
1327
+ request; this effectively ignores the
1328
+ authentication in the spec for a single request.
1329
+ :type _request_auth: dict, optional
1330
+ :param _content_type: force content-type for the request.
1331
+ :type _content_type: str, Optional
1332
+ :param _headers: set to override the headers for a single
1333
+ request; this effectively ignores the headers
1334
+ in the spec for a single request.
1335
+ :type _headers: dict, optional
1336
+ :param _host_index: set to override the host_index for a single
1337
+ request; this effectively ignores the host_index
1338
+ in the spec for a single request.
1339
+ :type _host_index: int, optional
1340
+ :return: Returns the result object.
1341
+ """ # noqa: E501
1342
+
1343
+ _param = self._reflect_serialize(
1344
+ bank_id=bank_id,
1345
+ reflect_request=reflect_request,
1346
+ authorization=authorization,
1347
+ _request_auth=_request_auth,
1348
+ _content_type=_content_type,
1349
+ _headers=_headers,
1350
+ _host_index=_host_index
1351
+ )
1352
+
1353
+ _response_types_map: Dict[str, Optional[str]] = {
1354
+ '200': "ReflectResponse",
1355
+ '422': "HTTPValidationError",
1356
+ }
1357
+ response_data = await self.api_client.call_api(
1358
+ *_param,
1359
+ _request_timeout=_request_timeout
1360
+ )
1361
+ await response_data.read()
1362
+ return self.api_client.response_deserialize(
1363
+ response_data=response_data,
1364
+ response_types_map=_response_types_map,
1365
+ ).data
1366
+
1367
+
1368
+ @validate_call
1369
+ async def reflect_with_http_info(
1370
+ self,
1371
+ bank_id: StrictStr,
1372
+ reflect_request: ReflectRequest,
1373
+ authorization: Optional[StrictStr] = None,
1374
+ _request_timeout: Union[
1375
+ None,
1376
+ Annotated[StrictFloat, Field(gt=0)],
1377
+ Tuple[
1378
+ Annotated[StrictFloat, Field(gt=0)],
1379
+ Annotated[StrictFloat, Field(gt=0)]
1380
+ ]
1381
+ ] = None,
1382
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1383
+ _content_type: Optional[StrictStr] = None,
1384
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1385
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1386
+ ) -> ApiResponse[ReflectResponse]:
1387
+ """Reflect and generate answer
1388
+
1389
+ Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves experience (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions
1390
+
1391
+ :param bank_id: (required)
1392
+ :type bank_id: str
1393
+ :param reflect_request: (required)
1394
+ :type reflect_request: ReflectRequest
1395
+ :param authorization:
1396
+ :type authorization: str
1397
+ :param _request_timeout: timeout setting for this request. If one
1398
+ number provided, it will be total request
1399
+ timeout. It can also be a pair (tuple) of
1400
+ (connection, read) timeouts.
1401
+ :type _request_timeout: int, tuple(int, int), optional
1402
+ :param _request_auth: set to override the auth_settings for an a single
1403
+ request; this effectively ignores the
1404
+ authentication in the spec for a single request.
1405
+ :type _request_auth: dict, optional
1406
+ :param _content_type: force content-type for the request.
1407
+ :type _content_type: str, Optional
1408
+ :param _headers: set to override the headers for a single
1409
+ request; this effectively ignores the headers
1410
+ in the spec for a single request.
1411
+ :type _headers: dict, optional
1412
+ :param _host_index: set to override the host_index for a single
1413
+ request; this effectively ignores the host_index
1414
+ in the spec for a single request.
1415
+ :type _host_index: int, optional
1416
+ :return: Returns the result object.
1417
+ """ # noqa: E501
1418
+
1419
+ _param = self._reflect_serialize(
1420
+ bank_id=bank_id,
1421
+ reflect_request=reflect_request,
1422
+ authorization=authorization,
1423
+ _request_auth=_request_auth,
1424
+ _content_type=_content_type,
1425
+ _headers=_headers,
1426
+ _host_index=_host_index
1427
+ )
1428
+
1429
+ _response_types_map: Dict[str, Optional[str]] = {
1430
+ '200': "ReflectResponse",
1431
+ '422': "HTTPValidationError",
1432
+ }
1433
+ response_data = await self.api_client.call_api(
1434
+ *_param,
1435
+ _request_timeout=_request_timeout
1436
+ )
1437
+ await response_data.read()
1438
+ return self.api_client.response_deserialize(
1439
+ response_data=response_data,
1440
+ response_types_map=_response_types_map,
1441
+ )
1442
+
1443
+
1444
+ @validate_call
1445
+ async def reflect_without_preload_content(
1446
+ self,
1447
+ bank_id: StrictStr,
1448
+ reflect_request: ReflectRequest,
1449
+ authorization: Optional[StrictStr] = None,
1450
+ _request_timeout: Union[
1451
+ None,
1452
+ Annotated[StrictFloat, Field(gt=0)],
1453
+ Tuple[
1454
+ Annotated[StrictFloat, Field(gt=0)],
1455
+ Annotated[StrictFloat, Field(gt=0)]
1456
+ ]
1457
+ ] = None,
1458
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1459
+ _content_type: Optional[StrictStr] = None,
1460
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1461
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1462
+ ) -> RESTResponseType:
1463
+ """Reflect and generate answer
1464
+
1465
+ Reflect and formulate an answer using bank identity, world facts, and opinions. This endpoint: 1. Retrieves experience (conversations and events) 2. Retrieves world facts relevant to the query 3. Retrieves existing opinions (bank's perspectives) 4. Uses LLM to formulate a contextual answer 5. Extracts and stores any new opinions formed 6. Returns plain text answer, the facts used, and new opinions
1466
+
1467
+ :param bank_id: (required)
1468
+ :type bank_id: str
1469
+ :param reflect_request: (required)
1470
+ :type reflect_request: ReflectRequest
1471
+ :param authorization:
1472
+ :type authorization: str
1473
+ :param _request_timeout: timeout setting for this request. If one
1474
+ number provided, it will be total request
1475
+ timeout. It can also be a pair (tuple) of
1476
+ (connection, read) timeouts.
1477
+ :type _request_timeout: int, tuple(int, int), optional
1478
+ :param _request_auth: set to override the auth_settings for an a single
1479
+ request; this effectively ignores the
1480
+ authentication in the spec for a single request.
1481
+ :type _request_auth: dict, optional
1482
+ :param _content_type: force content-type for the request.
1483
+ :type _content_type: str, Optional
1484
+ :param _headers: set to override the headers for a single
1485
+ request; this effectively ignores the headers
1486
+ in the spec for a single request.
1487
+ :type _headers: dict, optional
1488
+ :param _host_index: set to override the host_index for a single
1489
+ request; this effectively ignores the host_index
1490
+ in the spec for a single request.
1491
+ :type _host_index: int, optional
1492
+ :return: Returns the result object.
1493
+ """ # noqa: E501
1494
+
1495
+ _param = self._reflect_serialize(
1496
+ bank_id=bank_id,
1497
+ reflect_request=reflect_request,
1498
+ authorization=authorization,
1499
+ _request_auth=_request_auth,
1500
+ _content_type=_content_type,
1501
+ _headers=_headers,
1502
+ _host_index=_host_index
1503
+ )
1504
+
1505
+ _response_types_map: Dict[str, Optional[str]] = {
1506
+ '200': "ReflectResponse",
1507
+ '422': "HTTPValidationError",
1508
+ }
1509
+ response_data = await self.api_client.call_api(
1510
+ *_param,
1511
+ _request_timeout=_request_timeout
1512
+ )
1513
+ return response_data.response
1514
+
1515
+
1516
+ def _reflect_serialize(
1517
+ self,
1518
+ bank_id,
1519
+ reflect_request,
1520
+ authorization,
1521
+ _request_auth,
1522
+ _content_type,
1523
+ _headers,
1524
+ _host_index,
1525
+ ) -> RequestSerialized:
1526
+
1527
+ _host = None
1528
+
1529
+ _collection_formats: Dict[str, str] = {
1530
+ }
1531
+
1532
+ _path_params: Dict[str, str] = {}
1533
+ _query_params: List[Tuple[str, str]] = []
1534
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1535
+ _form_params: List[Tuple[str, str]] = []
1536
+ _files: Dict[
1537
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1538
+ ] = {}
1539
+ _body_params: Optional[bytes] = None
1540
+
1541
+ # process the path parameters
1542
+ if bank_id is not None:
1543
+ _path_params['bank_id'] = bank_id
1544
+ # process the query parameters
1545
+ # process the header parameters
1546
+ if authorization is not None:
1547
+ _header_params['authorization'] = authorization
1548
+ # process the form parameters
1549
+ # process the body parameter
1550
+ if reflect_request is not None:
1551
+ _body_params = reflect_request
1552
+
1553
+
1554
+ # set the HTTP header `Accept`
1555
+ if 'Accept' not in _header_params:
1556
+ _header_params['Accept'] = self.api_client.select_header_accept(
1557
+ [
1558
+ 'application/json'
1559
+ ]
1560
+ )
1561
+
1562
+ # set the HTTP header `Content-Type`
1563
+ if _content_type:
1564
+ _header_params['Content-Type'] = _content_type
1565
+ else:
1566
+ _default_content_type = (
1567
+ self.api_client.select_header_content_type(
1568
+ [
1569
+ 'application/json'
1570
+ ]
1571
+ )
1572
+ )
1573
+ if _default_content_type is not None:
1574
+ _header_params['Content-Type'] = _default_content_type
1575
+
1576
+ # authentication setting
1577
+ _auth_settings: List[str] = [
1578
+ ]
1579
+
1580
+ return self.api_client.param_serialize(
1581
+ method='POST',
1582
+ resource_path='/v1/default/banks/{bank_id}/reflect',
1583
+ path_params=_path_params,
1584
+ query_params=_query_params,
1585
+ header_params=_header_params,
1586
+ body=_body_params,
1587
+ post_params=_form_params,
1588
+ files=_files,
1589
+ auth_settings=_auth_settings,
1590
+ collection_formats=_collection_formats,
1591
+ _host=_host,
1592
+ _request_auth=_request_auth
1593
+ )
1594
+
1595
+
1596
+
1597
+
1598
+ @validate_call
1599
+ async def retain_memories(
1600
+ self,
1601
+ bank_id: StrictStr,
1602
+ retain_request: RetainRequest,
1603
+ authorization: Optional[StrictStr] = None,
1604
+ _request_timeout: Union[
1605
+ None,
1606
+ Annotated[StrictFloat, Field(gt=0)],
1607
+ Tuple[
1608
+ Annotated[StrictFloat, Field(gt=0)],
1609
+ Annotated[StrictFloat, Field(gt=0)]
1610
+ ]
1611
+ ] = None,
1612
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1613
+ _content_type: Optional[StrictStr] = None,
1614
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1615
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1616
+ ) -> RetainResponse:
1617
+ """Retain memories
1618
+
1619
+ Retain memory items with automatic fact extraction. This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. **Features:** - Efficient batch processing - Automatic fact extraction from natural language - Entity recognition and linking - Document tracking with automatic upsert (when document_id is provided) - Temporal and semantic linking - Optional asynchronous processing **The system automatically:** 1. Extracts semantic facts from the content 2. Generates embeddings 3. Deduplicates similar facts 4. Creates temporal, semantic, and entity links 5. Tracks document metadata **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. **When `async=false` (default):** Waits for processing to complete. **Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior).
1620
+
1621
+ :param bank_id: (required)
1622
+ :type bank_id: str
1623
+ :param retain_request: (required)
1624
+ :type retain_request: RetainRequest
1625
+ :param authorization:
1626
+ :type authorization: str
1627
+ :param _request_timeout: timeout setting for this request. If one
1628
+ number provided, it will be total request
1629
+ timeout. It can also be a pair (tuple) of
1630
+ (connection, read) timeouts.
1631
+ :type _request_timeout: int, tuple(int, int), optional
1632
+ :param _request_auth: set to override the auth_settings for an a single
1633
+ request; this effectively ignores the
1634
+ authentication in the spec for a single request.
1635
+ :type _request_auth: dict, optional
1636
+ :param _content_type: force content-type for the request.
1637
+ :type _content_type: str, Optional
1638
+ :param _headers: set to override the headers for a single
1639
+ request; this effectively ignores the headers
1640
+ in the spec for a single request.
1641
+ :type _headers: dict, optional
1642
+ :param _host_index: set to override the host_index for a single
1643
+ request; this effectively ignores the host_index
1644
+ in the spec for a single request.
1645
+ :type _host_index: int, optional
1646
+ :return: Returns the result object.
1647
+ """ # noqa: E501
1648
+
1649
+ _param = self._retain_memories_serialize(
1650
+ bank_id=bank_id,
1651
+ retain_request=retain_request,
1652
+ authorization=authorization,
1653
+ _request_auth=_request_auth,
1654
+ _content_type=_content_type,
1655
+ _headers=_headers,
1656
+ _host_index=_host_index
1657
+ )
1658
+
1659
+ _response_types_map: Dict[str, Optional[str]] = {
1660
+ '200': "RetainResponse",
1661
+ '422': "HTTPValidationError",
1662
+ }
1663
+ response_data = await self.api_client.call_api(
1664
+ *_param,
1665
+ _request_timeout=_request_timeout
1666
+ )
1667
+ await response_data.read()
1668
+ return self.api_client.response_deserialize(
1669
+ response_data=response_data,
1670
+ response_types_map=_response_types_map,
1671
+ ).data
1672
+
1673
+
1674
+ @validate_call
1675
+ async def retain_memories_with_http_info(
1676
+ self,
1677
+ bank_id: StrictStr,
1678
+ retain_request: RetainRequest,
1679
+ authorization: Optional[StrictStr] = None,
1680
+ _request_timeout: Union[
1681
+ None,
1682
+ Annotated[StrictFloat, Field(gt=0)],
1683
+ Tuple[
1684
+ Annotated[StrictFloat, Field(gt=0)],
1685
+ Annotated[StrictFloat, Field(gt=0)]
1686
+ ]
1687
+ ] = None,
1688
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1689
+ _content_type: Optional[StrictStr] = None,
1690
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1691
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1692
+ ) -> ApiResponse[RetainResponse]:
1693
+ """Retain memories
1694
+
1695
+ Retain memory items with automatic fact extraction. This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. **Features:** - Efficient batch processing - Automatic fact extraction from natural language - Entity recognition and linking - Document tracking with automatic upsert (when document_id is provided) - Temporal and semantic linking - Optional asynchronous processing **The system automatically:** 1. Extracts semantic facts from the content 2. Generates embeddings 3. Deduplicates similar facts 4. Creates temporal, semantic, and entity links 5. Tracks document metadata **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. **When `async=false` (default):** Waits for processing to complete. **Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior).
1696
+
1697
+ :param bank_id: (required)
1698
+ :type bank_id: str
1699
+ :param retain_request: (required)
1700
+ :type retain_request: RetainRequest
1701
+ :param authorization:
1702
+ :type authorization: str
1703
+ :param _request_timeout: timeout setting for this request. If one
1704
+ number provided, it will be total request
1705
+ timeout. It can also be a pair (tuple) of
1706
+ (connection, read) timeouts.
1707
+ :type _request_timeout: int, tuple(int, int), optional
1708
+ :param _request_auth: set to override the auth_settings for an a single
1709
+ request; this effectively ignores the
1710
+ authentication in the spec for a single request.
1711
+ :type _request_auth: dict, optional
1712
+ :param _content_type: force content-type for the request.
1713
+ :type _content_type: str, Optional
1714
+ :param _headers: set to override the headers for a single
1715
+ request; this effectively ignores the headers
1716
+ in the spec for a single request.
1717
+ :type _headers: dict, optional
1718
+ :param _host_index: set to override the host_index for a single
1719
+ request; this effectively ignores the host_index
1720
+ in the spec for a single request.
1721
+ :type _host_index: int, optional
1722
+ :return: Returns the result object.
1723
+ """ # noqa: E501
1724
+
1725
+ _param = self._retain_memories_serialize(
1726
+ bank_id=bank_id,
1727
+ retain_request=retain_request,
1728
+ authorization=authorization,
1729
+ _request_auth=_request_auth,
1730
+ _content_type=_content_type,
1731
+ _headers=_headers,
1732
+ _host_index=_host_index
1733
+ )
1734
+
1735
+ _response_types_map: Dict[str, Optional[str]] = {
1736
+ '200': "RetainResponse",
1737
+ '422': "HTTPValidationError",
1738
+ }
1739
+ response_data = await self.api_client.call_api(
1740
+ *_param,
1741
+ _request_timeout=_request_timeout
1742
+ )
1743
+ await response_data.read()
1744
+ return self.api_client.response_deserialize(
1745
+ response_data=response_data,
1746
+ response_types_map=_response_types_map,
1747
+ )
1748
+
1749
+
1750
+ @validate_call
1751
+ async def retain_memories_without_preload_content(
1752
+ self,
1753
+ bank_id: StrictStr,
1754
+ retain_request: RetainRequest,
1755
+ authorization: Optional[StrictStr] = None,
1756
+ _request_timeout: Union[
1757
+ None,
1758
+ Annotated[StrictFloat, Field(gt=0)],
1759
+ Tuple[
1760
+ Annotated[StrictFloat, Field(gt=0)],
1761
+ Annotated[StrictFloat, Field(gt=0)]
1762
+ ]
1763
+ ] = None,
1764
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1765
+ _content_type: Optional[StrictStr] = None,
1766
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1767
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1768
+ ) -> RESTResponseType:
1769
+ """Retain memories
1770
+
1771
+ Retain memory items with automatic fact extraction. This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. **Features:** - Efficient batch processing - Automatic fact extraction from natural language - Entity recognition and linking - Document tracking with automatic upsert (when document_id is provided) - Temporal and semantic linking - Optional asynchronous processing **The system automatically:** 1. Extracts semantic facts from the content 2. Generates embeddings 3. Deduplicates similar facts 4. Creates temporal, semantic, and entity links 5. Tracks document metadata **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. **When `async=false` (default):** Waits for processing to complete. **Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior).
1772
+
1773
+ :param bank_id: (required)
1774
+ :type bank_id: str
1775
+ :param retain_request: (required)
1776
+ :type retain_request: RetainRequest
1777
+ :param authorization:
1778
+ :type authorization: str
1779
+ :param _request_timeout: timeout setting for this request. If one
1780
+ number provided, it will be total request
1781
+ timeout. It can also be a pair (tuple) of
1782
+ (connection, read) timeouts.
1783
+ :type _request_timeout: int, tuple(int, int), optional
1784
+ :param _request_auth: set to override the auth_settings for an a single
1785
+ request; this effectively ignores the
1786
+ authentication in the spec for a single request.
1787
+ :type _request_auth: dict, optional
1788
+ :param _content_type: force content-type for the request.
1789
+ :type _content_type: str, Optional
1790
+ :param _headers: set to override the headers for a single
1791
+ request; this effectively ignores the headers
1792
+ in the spec for a single request.
1793
+ :type _headers: dict, optional
1794
+ :param _host_index: set to override the host_index for a single
1795
+ request; this effectively ignores the host_index
1796
+ in the spec for a single request.
1797
+ :type _host_index: int, optional
1798
+ :return: Returns the result object.
1799
+ """ # noqa: E501
1800
+
1801
+ _param = self._retain_memories_serialize(
1802
+ bank_id=bank_id,
1803
+ retain_request=retain_request,
1804
+ authorization=authorization,
1805
+ _request_auth=_request_auth,
1806
+ _content_type=_content_type,
1807
+ _headers=_headers,
1808
+ _host_index=_host_index
1809
+ )
1810
+
1811
+ _response_types_map: Dict[str, Optional[str]] = {
1812
+ '200': "RetainResponse",
1813
+ '422': "HTTPValidationError",
1814
+ }
1815
+ response_data = await self.api_client.call_api(
1816
+ *_param,
1817
+ _request_timeout=_request_timeout
1818
+ )
1819
+ return response_data.response
1820
+
1821
+
1822
+ def _retain_memories_serialize(
1823
+ self,
1824
+ bank_id,
1825
+ retain_request,
1826
+ authorization,
1827
+ _request_auth,
1828
+ _content_type,
1829
+ _headers,
1830
+ _host_index,
1831
+ ) -> RequestSerialized:
1832
+
1833
+ _host = None
1834
+
1835
+ _collection_formats: Dict[str, str] = {
1836
+ }
1837
+
1838
+ _path_params: Dict[str, str] = {}
1839
+ _query_params: List[Tuple[str, str]] = []
1840
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1841
+ _form_params: List[Tuple[str, str]] = []
1842
+ _files: Dict[
1843
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1844
+ ] = {}
1845
+ _body_params: Optional[bytes] = None
1846
+
1847
+ # process the path parameters
1848
+ if bank_id is not None:
1849
+ _path_params['bank_id'] = bank_id
1850
+ # process the query parameters
1851
+ # process the header parameters
1852
+ if authorization is not None:
1853
+ _header_params['authorization'] = authorization
1854
+ # process the form parameters
1855
+ # process the body parameter
1856
+ if retain_request is not None:
1857
+ _body_params = retain_request
1858
+
1859
+
1860
+ # set the HTTP header `Accept`
1861
+ if 'Accept' not in _header_params:
1862
+ _header_params['Accept'] = self.api_client.select_header_accept(
1863
+ [
1864
+ 'application/json'
1865
+ ]
1866
+ )
1867
+
1868
+ # set the HTTP header `Content-Type`
1869
+ if _content_type:
1870
+ _header_params['Content-Type'] = _content_type
1871
+ else:
1872
+ _default_content_type = (
1873
+ self.api_client.select_header_content_type(
1874
+ [
1875
+ 'application/json'
1876
+ ]
1877
+ )
1878
+ )
1879
+ if _default_content_type is not None:
1880
+ _header_params['Content-Type'] = _default_content_type
1881
+
1882
+ # authentication setting
1883
+ _auth_settings: List[str] = [
1884
+ ]
1885
+
1886
+ return self.api_client.param_serialize(
1887
+ method='POST',
1888
+ resource_path='/v1/default/banks/{bank_id}/memories',
1889
+ path_params=_path_params,
1890
+ query_params=_query_params,
1891
+ header_params=_header_params,
1892
+ body=_body_params,
1893
+ post_params=_form_params,
1894
+ files=_files,
1895
+ auth_settings=_auth_settings,
1896
+ collection_formats=_collection_formats,
1897
+ _host=_host,
1898
+ _request_auth=_request_auth
1899
+ )
1900
+
1901
+