hindsight-client 0.1.15__py3-none-any.whl → 0.2.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.
@@ -112,6 +112,7 @@ class Hindsight:
112
112
  context: Optional[str] = None,
113
113
  document_id: Optional[str] = None,
114
114
  metadata: Optional[Dict[str, str]] = None,
115
+ entities: Optional[List[Dict[str, str]]] = None,
115
116
  ) -> RetainResponse:
116
117
  """
117
118
  Store a single memory (simplified interface).
@@ -123,13 +124,14 @@ class Hindsight:
123
124
  context: Optional context description
124
125
  document_id: Optional document ID for grouping
125
126
  metadata: Optional user-defined metadata
127
+ entities: Optional list of entities [{"text": "...", "type": "..."}]
126
128
 
127
129
  Returns:
128
130
  RetainResponse with success status
129
131
  """
130
132
  return self.retain_batch(
131
133
  bank_id=bank_id,
132
- items=[{"content": content, "timestamp": timestamp, "context": context, "metadata": metadata}],
134
+ items=[{"content": content, "timestamp": timestamp, "context": context, "metadata": metadata, "entities": entities}],
133
135
  document_id=document_id,
134
136
  )
135
137
 
@@ -145,24 +147,34 @@ class Hindsight:
145
147
 
146
148
  Args:
147
149
  bank_id: The memory bank ID
148
- items: List of memory items with 'content' and optional 'timestamp', 'context', 'metadata', 'document_id'
150
+ items: List of memory items with 'content' and optional 'timestamp', 'context', 'metadata', 'document_id', 'entities'
149
151
  document_id: Optional document ID for grouping memories (applied to items that don't have their own)
150
152
  retain_async: If True, process asynchronously in background (default: False)
151
153
 
152
154
  Returns:
153
155
  RetainResponse with success status and item count
154
156
  """
155
- memory_items = [
156
- memory_item.MemoryItem(
157
- content=item["content"],
158
- timestamp=item.get("timestamp"),
159
- context=item.get("context"),
160
- metadata=item.get("metadata"),
161
- # Use item's document_id if provided, otherwise fall back to batch-level document_id
162
- document_id=item.get("document_id") or document_id,
157
+ from hindsight_client_api.models.entity_input import EntityInput
158
+
159
+ memory_items = []
160
+ for item in items:
161
+ entities = None
162
+ if item.get("entities"):
163
+ entities = [
164
+ EntityInput(text=e["text"], type=e.get("type"))
165
+ for e in item["entities"]
166
+ ]
167
+ memory_items.append(
168
+ memory_item.MemoryItem(
169
+ content=item["content"],
170
+ timestamp=item.get("timestamp"),
171
+ context=item.get("context"),
172
+ metadata=item.get("metadata"),
173
+ # Use item's document_id if provided, otherwise fall back to batch-level document_id
174
+ document_id=item.get("document_id") or document_id,
175
+ entities=entities,
176
+ )
163
177
  )
164
- for item in items
165
- ]
166
178
 
167
179
  request_obj = retain_request.RetainRequest(
168
180
  items=memory_items,
@@ -229,6 +241,8 @@ class Hindsight:
229
241
  query: str,
230
242
  budget: str = "low",
231
243
  context: Optional[str] = None,
244
+ max_tokens: Optional[int] = None,
245
+ response_schema: Optional[Dict[str, Any]] = None,
232
246
  ) -> ReflectResponse:
233
247
  """
234
248
  Generate a contextual answer based on bank identity and memories.
@@ -238,14 +252,21 @@ class Hindsight:
238
252
  query: The question or prompt
239
253
  budget: Budget level for reflection - "low", "mid", or "high" (default: "low")
240
254
  context: Optional additional context
255
+ max_tokens: Maximum tokens for the response (server default: 4096)
256
+ response_schema: Optional JSON Schema for structured output. When provided,
257
+ the response will include a 'structured_output' field with the LLM
258
+ response parsed according to this schema.
241
259
 
242
260
  Returns:
243
- ReflectResponse with answer text and optionally facts used
261
+ ReflectResponse with answer text, optionally facts used, and optionally
262
+ structured_output if response_schema was provided
244
263
  """
245
264
  request_obj = reflect_request.ReflectRequest(
246
265
  query=query,
247
266
  budget=budget,
248
267
  context=context,
268
+ max_tokens=max_tokens,
269
+ response_schema=response_schema,
249
270
  )
250
271
 
251
272
  return _run_async(self._memory_api.reflect(bank_id, request_obj))
@@ -303,24 +324,34 @@ class Hindsight:
303
324
 
304
325
  Args:
305
326
  bank_id: The memory bank ID
306
- items: List of memory items with 'content' and optional 'timestamp', 'context', 'metadata', 'document_id'
327
+ items: List of memory items with 'content' and optional 'timestamp', 'context', 'metadata', 'document_id', 'entities'
307
328
  document_id: Optional document ID for grouping memories (applied to items that don't have their own)
308
329
  retain_async: If True, process asynchronously in background (default: False)
309
330
 
310
331
  Returns:
311
332
  RetainResponse with success status and item count
312
333
  """
313
- memory_items = [
314
- memory_item.MemoryItem(
315
- content=item["content"],
316
- timestamp=item.get("timestamp"),
317
- context=item.get("context"),
318
- metadata=item.get("metadata"),
319
- # Use item's document_id if provided, otherwise fall back to batch-level document_id
320
- document_id=item.get("document_id") or document_id,
334
+ from hindsight_client_api.models.entity_input import EntityInput
335
+
336
+ memory_items = []
337
+ for item in items:
338
+ entities = None
339
+ if item.get("entities"):
340
+ entities = [
341
+ EntityInput(text=e["text"], type=e.get("type"))
342
+ for e in item["entities"]
343
+ ]
344
+ memory_items.append(
345
+ memory_item.MemoryItem(
346
+ content=item["content"],
347
+ timestamp=item.get("timestamp"),
348
+ context=item.get("context"),
349
+ metadata=item.get("metadata"),
350
+ # Use item's document_id if provided, otherwise fall back to batch-level document_id
351
+ document_id=item.get("document_id") or document_id,
352
+ entities=entities,
353
+ )
321
354
  )
322
- for item in items
323
- ]
324
355
 
325
356
  request_obj = retain_request.RetainRequest(
326
357
  items=memory_items,
@@ -337,6 +368,7 @@ class Hindsight:
337
368
  context: Optional[str] = None,
338
369
  document_id: Optional[str] = None,
339
370
  metadata: Optional[Dict[str, str]] = None,
371
+ entities: Optional[List[Dict[str, str]]] = None,
340
372
  ) -> RetainResponse:
341
373
  """
342
374
  Store a single memory (async).
@@ -348,13 +380,14 @@ class Hindsight:
348
380
  context: Optional context description
349
381
  document_id: Optional document ID for grouping
350
382
  metadata: Optional user-defined metadata
383
+ entities: Optional list of entities [{"text": "...", "type": "..."}]
351
384
 
352
385
  Returns:
353
386
  RetainResponse with success status
354
387
  """
355
388
  return await self.aretain_batch(
356
389
  bank_id=bank_id,
357
- items=[{"content": content, "timestamp": timestamp, "context": context, "metadata": metadata}],
390
+ items=[{"content": content, "timestamp": timestamp, "context": context, "metadata": metadata, "entities": entities}],
358
391
  document_id=document_id,
359
392
  )
360
393
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hindsight-client
3
- Version: 0.1.15
3
+ Version: 0.2.0
4
4
  Summary: Python client for Hindsight - Semantic memory system with personality-driven thinking
5
5
  Author: Hindsight Team
6
6
  Requires-Python: >=3.10
@@ -1,5 +1,5 @@
1
1
  hindsight_client/__init__.py,sha256=PyDJ4UVKmtRN5OeBs0-rl-tUtqS8OoX53qvejKGC3JU,3114
2
- hindsight_client/hindsight_client.py,sha256=sOyI7okjIuq6U6Qf30dXsTR9ikDMC6FVtX71aZ_Ribw,14453
2
+ hindsight_client/hindsight_client.py,sha256=FzlKL3HsoOvyYRipe4sKnZUJ-FWHrNe86fkAavPPSZA,16172
3
3
  hindsight_client_api/__init__.py,sha256=5PKjxuRIBdYzBm_35NF_B583xiI5TAlbxmTTKkF60j0,7004
4
4
  hindsight_client_api/api_client.py,sha256=6Q0Hdx1h4U549-Bfk9ckwSlIdF27arfLMMQsGeoyR98,27860
5
5
  hindsight_client_api/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
@@ -54,14 +54,14 @@ hindsight_client_api/docs/RecallResponse.md,sha256=VbABZlZwMTaSuqaqAAOOAjkuqaDB4
54
54
  hindsight_client_api/docs/RecallResult.md,sha256=1QTIqPN86Gq--tw-LwFVBmO5QD4dj8DbzJqe0ywUrew,1297
55
55
  hindsight_client_api/docs/ReflectFact.md,sha256=f9wmQde692is1dF6sw6S5_zIDI9Z_AHSbCvD7ALluLY,1075
56
56
  hindsight_client_api/docs/ReflectIncludeOptions.md,sha256=tH-pQeSv0QH9hoLmQhsg0PO5R3jVolDK6JFUG5CHi50,1112
57
- hindsight_client_api/docs/ReflectRequest.md,sha256=QIkRNJJsZS47yy20ZsoDFQhOFx8kYmB2wd0az85OelY,1158
58
- hindsight_client_api/docs/ReflectResponse.md,sha256=ziZtjLkXfX7RieaBtL5XC1JxgyG5_1rda-pZHHrQAaA,1019
57
+ hindsight_client_api/docs/ReflectRequest.md,sha256=MxOgwBhzXZCbBWBhDDs89aWtOWZQ9bjQSGmsrirNkMo,1309
58
+ hindsight_client_api/docs/ReflectResponse.md,sha256=oA6GmB264k9N8_j7tQYU4Ubj_S-mWXe0_quJTJ57k6w,1082
59
59
  hindsight_client_api/docs/RetainRequest.md,sha256=u-IhxRJo2iFWtskDsRpBJJjOdm7mfLGE6j1W6iNTcKY,1090
60
60
  hindsight_client_api/docs/RetainResponse.md,sha256=2a3Wz7ilrnQ_BFf6YTqWDmA94gohs8kU9sCR3mJYrj8,1065
61
61
  hindsight_client_api/docs/UpdateDispositionRequest.md,sha256=C3Q9UcVts2wPjYQgy1JH2ch1jy0tP2xswGe8sUzkZ_8,1112
62
62
  hindsight_client_api/docs/ValidationError.md,sha256=moV1dyA1z8n2DSD18ri7x7GDJujHc6--fbwGr4u8cl4,1001
63
63
  hindsight_client_api/docs/ValidationErrorLocInner.md,sha256=WP7Zm2LNt2HZb6XHo0cLvLCrht-EGFKp0i4zD3jPMto,988
64
- hindsight_client_api/models/__init__.py,sha256=a-vD1DQG9S6RMncyRj29QJZnkzCNuF17VVAwWMYrH58,3537
64
+ hindsight_client_api/models/__init__.py,sha256=7d7fYdP_wGCEkXoXA3iA7aMZNJR1BZn49rUxiZeLt6I,3602
65
65
  hindsight_client_api/models/add_background_request.py,sha256=3rld3CjxNSPbxX9CoDSr5WEuhEoo-gRrCZ709Vvy9rI,2867
66
66
  hindsight_client_api/models/background_response.py,sha256=SUFt-k6ipl2SXAvHb3IU3IJ5LuXIGEoK8_pVbZO3Dgw,3144
67
67
  hindsight_client_api/models/bank_list_item.py,sha256=grJYCFBinjxEy1M8ZxPiy8asUVKj58b2KnScE2tmU-Q,4137
@@ -80,6 +80,7 @@ hindsight_client_api/models/disposition_traits.py,sha256=I61B7L3BkGQlAxBONDILwE-
80
80
  hindsight_client_api/models/document_response.py,sha256=hvtlBhm0EEGldM5Gh82cwnFYCL2ckwI2upDySdhbFZ0,3256
81
81
  hindsight_client_api/models/entity_detail_response.py,sha256=51Pv6lQEVGjUZ2KimRP0xFCowwOgt0ShcNITeHLF0Ro,4312
82
82
  hindsight_client_api/models/entity_include_options.py,sha256=j6o0SPWslW7y461xahbw4l1VXMIU1B5vxR3MX8cJ2FY,2635
83
+ hindsight_client_api/models/entity_input.py,sha256=-ZGF71tAznuuTOHK1gIL-wNAfiAD2zvsIRldtgOmrsU,2431
83
84
  hindsight_client_api/models/entity_list_item.py,sha256=ZtdnkJ-xz7djdls1RaYXl7BEF_q1YIcan61MrHH0x6g,3602
84
85
  hindsight_client_api/models/entity_list_response.py,sha256=J3EYrjHKJk8AjcUQH2uEI3s1Hw11mIyQDgKrvPRhd4w,2913
85
86
  hindsight_client_api/models/entity_observation_response.py,sha256=Sbz_m0MssD-gYyV4sAeD56HGrnmlWcdO0bBs73K65YU,2804
@@ -89,7 +90,7 @@ hindsight_client_api/models/http_validation_error.py,sha256=KKvY67lajAI7hAys0IZH
89
90
  hindsight_client_api/models/include_options.py,sha256=FlB8QT_bqA141_tSv51QvZRbqKZdcaR2estkHg6eBGc,3645
90
91
  hindsight_client_api/models/list_documents_response.py,sha256=8lXIfprjJHpWCgiKkw4-M8d2y4NOTcK76HoF1otMekI,2675
91
92
  hindsight_client_api/models/list_memory_units_response.py,sha256=gEC-opRav_3cWdKvoO7Hure3dnVyFiFC0gtDP0TE7H8,2684
92
- hindsight_client_api/models/memory_item.py,sha256=2DisYT6Hnfpi9IbVkQfkOhlQQk_E9AqAmGn4wo_WcIA,3741
93
+ hindsight_client_api/models/memory_item.py,sha256=xDMmKYS3ZixyiNATBX4E4_OLxYMfPxtXjs_Jhv792A0,4330
93
94
  hindsight_client_api/models/operation_response.py,sha256=ach9QI35J3FtPKLzZDqb54Xfov7ouiEhto4nztCKc8I,3467
94
95
  hindsight_client_api/models/operations_list_response.py,sha256=3XOfvTBBkv7VmYo-PZX0wVK_RtMCZkQdaPkXXhGIiRU,3088
95
96
  hindsight_client_api/models/recall_request.py,sha256=IPYeipQO7qxUepB01iCkz2ACNWQg5jXLIPzSAxsTQts,4053
@@ -97,13 +98,13 @@ hindsight_client_api/models/recall_response.py,sha256=t_qYAUMHXFBnXX7kCF8EeLfqey
97
98
  hindsight_client_api/models/recall_result.py,sha256=fI-TCBDFGuSIytFsI7FADtJkmvsTOX-G3bFFRxLJbMY,5402
98
99
  hindsight_client_api/models/reflect_fact.py,sha256=sYW00LmDpY7VptK0E4I0gUWHkCRaCTeypuHSdciknw8,3973
99
100
  hindsight_client_api/models/reflect_include_options.py,sha256=q3TqMu-zrJw8LIHOl5pb0baDEQlOlFkBI5gE9MEmKQQ,2584
100
- hindsight_client_api/models/reflect_request.py,sha256=_Rt9QSGz040309-WTN8YXWkfQ6KzGWWQAmGsaGgw0Iw,3407
101
- hindsight_client_api/models/reflect_response.py,sha256=z4rzUMGlFzk4DQKINQhaLHWmwe6kocgglSFePyaKLE0,3024
101
+ hindsight_client_api/models/reflect_request.py,sha256=OOfOiLh0pmrIVo5ZFBFL09H69v8UGzWWlyp5I-CPCpE,4007
102
+ hindsight_client_api/models/reflect_response.py,sha256=jqh3gJvqlz2MKbk4H9sgHe3EfprmpIoMZgxHMuxQlVw,3414
102
103
  hindsight_client_api/models/retain_request.py,sha256=LABq0vwi3ZYnb1RB6UCLw6PoFT4Q4qap8LNWLquh7jE,3178
103
104
  hindsight_client_api/models/retain_response.py,sha256=b3t5H7_ixi7jZw_kvb2XYh0Q6IDTfHvWRR2KaKqf7ls,2796
104
105
  hindsight_client_api/models/update_disposition_request.py,sha256=6D3qceEJByBWcZrfSbNXrdlrDtnj0_QXh2zosc49-5E,2817
105
106
  hindsight_client_api/models/validation_error.py,sha256=XnK71WeEUbZyXPbzv1uKaNAFEYxfsiS7G0cvjTgCxiM,3029
106
107
  hindsight_client_api/models/validation_error_loc_inner.py,sha256=q51Yi64xsxhsy3_AAD5DlcfI2-g_81hQoN6Olh3I8ag,4812
107
- hindsight_client-0.1.15.dist-info/METADATA,sha256=292P4UtcOi9P0ZYK_Alw_YJPlzLC_Jypo7fRawFu0n0,648
108
- hindsight_client-0.1.15.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
109
- hindsight_client-0.1.15.dist-info/RECORD,,
108
+ hindsight_client-0.2.0.dist-info/METADATA,sha256=cD7W3A8iLYPqI9llPg0kChvZda9gaWkJOh60pC10Zzs,647
109
+ hindsight_client-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
110
+ hindsight_client-0.2.0.dist-info/RECORD,,
@@ -9,7 +9,9 @@ Name | Type | Description | Notes
9
9
  **query** | **str** | |
10
10
  **budget** | [**Budget**](Budget.md) | | [optional]
11
11
  **context** | **str** | | [optional]
12
+ **max_tokens** | **int** | Maximum tokens for the response | [optional] [default to 4096]
12
13
  **include** | [**ReflectIncludeOptions**](ReflectIncludeOptions.md) | Options for including additional data (disabled by default) | [optional]
14
+ **response_schema** | **Dict[str, object]** | | [optional]
13
15
 
14
16
  ## Example
15
17
 
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
8
8
  ------------ | ------------- | ------------- | -------------
9
9
  **text** | **str** | |
10
10
  **based_on** | [**List[ReflectFact]**](ReflectFact.md) | | [optional] [default to []]
11
+ **structured_output** | **Dict[str, object]** | | [optional]
11
12
 
12
13
  ## Example
13
14
 
@@ -31,6 +31,7 @@ from hindsight_client_api.models.disposition_traits import DispositionTraits
31
31
  from hindsight_client_api.models.document_response import DocumentResponse
32
32
  from hindsight_client_api.models.entity_detail_response import EntityDetailResponse
33
33
  from hindsight_client_api.models.entity_include_options import EntityIncludeOptions
34
+ from hindsight_client_api.models.entity_input import EntityInput
34
35
  from hindsight_client_api.models.entity_list_item import EntityListItem
35
36
  from hindsight_client_api.models.entity_list_response import EntityListResponse
36
37
  from hindsight_client_api.models.entity_observation_response import EntityObservationResponse
@@ -0,0 +1,82 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hindsight HTTP API
5
+
6
+ HTTP API for Hindsight
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+
26
+ class EntityInput(BaseModel):
27
+ """
28
+ Entity to associate with retained content.
29
+ """ # noqa: E501
30
+
31
+ 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
+ )
35
+ __properties: ClassVar[List[str]] = ["text", "type"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
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
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of EntityInput from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias."""
58
+ excluded_fields: Set[str] = set([])
59
+
60
+ _dict = self.model_dump(
61
+ by_alias=True,
62
+ exclude=excluded_fields,
63
+ exclude_none=True,
64
+ )
65
+ # set to None if type (nullable) is None
66
+ # and model_fields_set contains the field
67
+ if self.type is None and "type" in self.model_fields_set:
68
+ _dict["type"] = None
69
+
70
+ return _dict
71
+
72
+ @classmethod
73
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
74
+ """Create an instance of EntityInput from a dict"""
75
+ if obj is None:
76
+ return None
77
+
78
+ if not isinstance(obj, dict):
79
+ return cls.model_validate(obj)
80
+
81
+ _obj = cls.model_validate({"text": obj.get("text"), "type": obj.get("type")})
82
+ return _obj
@@ -18,10 +18,11 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from datetime import datetime
21
- from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
+ from hindsight_client_api.models.entity_input import EntityInput
25
26
 
26
27
  class MemoryItem(BaseModel):
27
28
  """
@@ -32,7 +33,11 @@ class MemoryItem(BaseModel):
32
33
  context: Optional[StrictStr] = None
33
34
  metadata: Optional[Dict[str, StrictStr]] = None
34
35
  document_id: Optional[StrictStr] = None
35
- __properties: ClassVar[List[str]] = ["content", "timestamp", "context", "metadata", "document_id"]
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
41
 
37
42
  model_config = ConfigDict(
38
43
  populate_by_name=True,
@@ -93,6 +98,11 @@ class MemoryItem(BaseModel):
93
98
  if self.document_id is None and "document_id" in self.model_fields_set:
94
99
  _dict['document_id'] = None
95
100
 
101
+ # set to None if entities (nullable) is None
102
+ # and model_fields_set contains the field
103
+ if self.entities is None and "entities" in self.model_fields_set:
104
+ _dict['entities'] = None
105
+
96
106
  return _dict
97
107
 
98
108
  @classmethod
@@ -109,7 +119,8 @@ class MemoryItem(BaseModel):
109
119
  "timestamp": obj.get("timestamp"),
110
120
  "context": obj.get("context"),
111
121
  "metadata": obj.get("metadata"),
112
- "document_id": obj.get("document_id")
122
+ "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
113
124
  })
114
125
  return _obj
115
126
 
@@ -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, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
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
@@ -31,8 +31,10 @@ class ReflectRequest(BaseModel):
31
31
  query: StrictStr
32
32
  budget: Optional[Budget] = None
33
33
  context: Optional[StrictStr] = None
34
+ max_tokens: Optional[StrictInt] = Field(default=4096, description="Maximum tokens for the response")
34
35
  include: Optional[ReflectIncludeOptions] = Field(default=None, description="Options for including additional data (disabled by default)")
35
- __properties: ClassVar[List[str]] = ["query", "budget", "context", "include"]
36
+ response_schema: Optional[Dict[str, Any]] = None
37
+ __properties: ClassVar[List[str]] = ["query", "budget", "context", "max_tokens", "include", "response_schema"]
36
38
 
37
39
  model_config = ConfigDict(
38
40
  populate_by_name=True,
@@ -81,6 +83,11 @@ class ReflectRequest(BaseModel):
81
83
  if self.context is None and "context" in self.model_fields_set:
82
84
  _dict['context'] = None
83
85
 
86
+ # set to None if response_schema (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.response_schema is None and "response_schema" in self.model_fields_set:
89
+ _dict['response_schema'] = None
90
+
84
91
  return _dict
85
92
 
86
93
  @classmethod
@@ -96,7 +103,9 @@ class ReflectRequest(BaseModel):
96
103
  "query": obj.get("query"),
97
104
  "budget": obj.get("budget"),
98
105
  "context": obj.get("context"),
99
- "include": ReflectIncludeOptions.from_dict(obj["include"]) if obj.get("include") is not None else None
106
+ "max_tokens": obj.get("max_tokens") if obj.get("max_tokens") is not None else 4096,
107
+ "include": ReflectIncludeOptions.from_dict(obj["include"]) if obj.get("include") is not None else None,
108
+ "response_schema": obj.get("response_schema")
100
109
  })
101
110
  return _obj
102
111
 
@@ -29,7 +29,8 @@ class ReflectResponse(BaseModel):
29
29
  """ # noqa: E501
30
30
  text: StrictStr
31
31
  based_on: Optional[List[ReflectFact]] = None
32
- __properties: ClassVar[List[str]] = ["text", "based_on"]
32
+ structured_output: Optional[Dict[str, Any]] = None
33
+ __properties: ClassVar[List[str]] = ["text", "based_on", "structured_output"]
33
34
 
34
35
  model_config = ConfigDict(
35
36
  populate_by_name=True,
@@ -77,6 +78,11 @@ class ReflectResponse(BaseModel):
77
78
  if _item_based_on:
78
79
  _items.append(_item_based_on.to_dict())
79
80
  _dict['based_on'] = _items
81
+ # set to None if structured_output (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.structured_output is None and "structured_output" in self.model_fields_set:
84
+ _dict['structured_output'] = None
85
+
80
86
  return _dict
81
87
 
82
88
  @classmethod
@@ -90,7 +96,8 @@ class ReflectResponse(BaseModel):
90
96
 
91
97
  _obj = cls.model_validate({
92
98
  "text": obj.get("text"),
93
- "based_on": [ReflectFact.from_dict(_item) for _item in obj["based_on"]] if obj.get("based_on") is not None else None
99
+ "based_on": [ReflectFact.from_dict(_item) for _item in obj["based_on"]] if obj.get("based_on") is not None else None,
100
+ "structured_output": obj.get("structured_output")
94
101
  })
95
102
  return _obj
96
103