hebbrix 2.0.3__tar.gz → 2.1.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hebbrix
3
- Version: 2.0.3
3
+ Version: 2.1.1
4
4
  Summary: Advanced Memory API for AI Agents with Reinforcement Learning - 3-line integration
5
5
  Home-page: https://github.com/hebbrix/hebbrix-python
6
6
  Author: Hebbrix Team
@@ -41,7 +41,7 @@ Features:
41
41
  - ✅ Type hints throughout
42
42
  """
43
43
 
44
- __version__ = "2.0.3"
44
+ __version__ = "2.1.1"
45
45
  __author__ = "Hebbrix Team"
46
46
  __license__ = "MIT"
47
47
 
@@ -196,35 +196,63 @@ class MemoriesResource(BaseResource):
196
196
  self,
197
197
  collection_id: str,
198
198
  content: str,
199
- importance: float = 0.5,
199
+ importance: Optional[float] = None,
200
200
  source_type: str = "text",
201
201
  source_reference: Optional[str] = None,
202
202
  metadata: Optional[Dict[str, Any]] = None,
203
+ infer: bool = False,
203
204
  ) -> Dict[str, Any]:
204
205
  """
205
- Create a new memory.
206
+ Create a memory.
207
+
208
+ By default (``infer=False``) the content is stored verbatim as a single
209
+ memory and the response's ``results[0].id`` is that memory's real,
210
+ immediately-resolvable id — so ``create()`` round-trips with ``get()``.
211
+
212
+ Behavior change (SDK 2.1.0): previously ``create()`` implicitly used the
213
+ server's LLM extract-and-resolve path (``infer=true``), which rewrote the
214
+ content, could emit zero or several fact rows, and — when the server ran
215
+ extraction asynchronously — returned a transient job id that ``get()``
216
+ could not resolve. That transient id is why a create/get round-trip
217
+ failed. Storing verbatim by default makes the returned id stable.
218
+
219
+ Pass ``infer=True`` to opt into fact extraction (``POST /v1/memories``
220
+ with server-side inference). In that mode ``results`` may contain several
221
+ extracted-fact ids, or the response may be ``{"job_id": ...}`` if the
222
+ server extracts asynchronously — poll that job rather than treating it as
223
+ a memory id.
206
224
 
207
225
  Args:
208
226
  collection_id: Collection ID
209
227
  content: Memory content
210
- importance: Importance score (0-1)
228
+ importance: Importance (0-1). When set, the direct-store path
229
+ (``infer=False``) uses this EXACT value. Leave as ``None`` to let
230
+ the server auto-score. Ignored when ``infer=True``.
211
231
  source_type: Type of source
212
232
  source_reference: Reference to source
213
233
  metadata: Optional metadata
234
+ infer: When True, extract facts via the LLM pipeline instead of
235
+ storing ``content`` verbatim. Default False (direct store).
214
236
 
215
237
  Returns:
216
- Created memory
217
- """
238
+ Created memory (MemoryAddResponse). With ``infer=False`` (default),
239
+ ``results[0].id`` is the real, get-able memory id.
240
+ """
241
+ payload: Dict[str, Any] = {
242
+ "collection_id": collection_id,
243
+ "content": content,
244
+ "source_type": source_type,
245
+ "source_reference": source_reference,
246
+ "metadata": metadata or {},
247
+ "infer": infer,
248
+ }
249
+ # Send importance ONLY when the caller set it, so an unspecified
250
+ # importance keeps the server's auto-scoring instead of pinning a value.
251
+ if importance is not None:
252
+ payload["importance"] = importance
218
253
  return await self.client.post(
219
254
  "/v1/memories",
220
- json={
221
- "collection_id": collection_id,
222
- "content": content,
223
- "importance": importance,
224
- "source_type": source_type,
225
- "source_reference": source_reference,
226
- "metadata": metadata or {},
227
- },
255
+ json=payload,
228
256
  )
229
257
 
230
258
  async def list_page(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hebbrix
3
- Version: 2.0.3
3
+ Version: 2.1.1
4
4
  Summary: Advanced Memory API for AI Agents with Reinforcement Learning - 3-line integration
5
5
  Home-page: https://github.com/hebbrix/hebbrix-python
6
6
  Author: Hebbrix Team
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hebbrix"
7
- version = "2.0.3"
7
+ version = "2.1.1"
8
8
  description = "Advanced Memory API for AI Agents with Reinforcement Learning - 3-line integration"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -9,7 +9,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
9
9
 
10
10
  setup(
11
11
  name="hebbrix",
12
- version="2.0.3",
12
+ version="2.1.1",
13
13
  author="Hebbrix Team",
14
14
  author_email="support@hebbrix.com",
15
15
  description="Advanced Memory API for AI Agents with Reinforcement Learning - 3-line integration",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes