@pyxmate/memory 0.3.0-beta → 0.3.1-beta

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyxmate/memory",
3
- "version": "0.3.0-beta",
3
+ "version": "0.3.1-beta",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",
@@ -38,6 +38,15 @@ if (memory) {
38
38
  const file = new File([buffer], 'report.pdf', { type: 'application/pdf' });
39
39
  const result = await memory.ingestFile(file);
40
40
 
41
+ // Image ingestion with AI description
42
+ // pyx-memory saves the original image to {DATA_DIR}/files/ and indexes the
43
+ // description in vector + SQLite for semantic search. Without a description,
44
+ // images get a minimal placeholder ("[Image] filename (size KB)").
45
+ const image = new File([imgBuffer], 'photo.png', { type: 'image/png' });
46
+ const imgResult = await memory.ingestFile(image, {
47
+ description: 'A screenshot of the login page showing an error dialog',
48
+ });
49
+
41
50
  // Lifecycle
42
51
  await memory.consolidate();
43
52
  await memory.runDecay();
@@ -54,6 +54,58 @@ const client = new MemoryClient('http://localhost:7822', process.env.MEMORY_API_
54
54
  | GET | `/api/memory/query-as-of?asOf=...` | Bi-temporal point-in-time query (asOf, type, agentId, source, limit) |
55
55
  | GET | `/api/memory/query-by-event-time?startTime=...&endTime=...` | Bi-temporal event time range query (startTime, endTime, type, agentId, source, limit) |
56
56
 
57
+ ## File Ingestion (Images + Documents)
58
+
59
+ `POST /api/memory/ingest/file` accepts multipart/form-data with:
60
+
61
+ | Field | Type | Required | Description |
62
+ |-------|------|----------|-------------|
63
+ | `file` | File | Yes | The file to ingest (max 50MB) |
64
+ | `description` | string | No | Agent-provided description (e.g., from LLM vision). Used instead of parser output for images. |
65
+
66
+ **Supported formats**: `.txt`, `.md`, `.csv`, `.pdf`, `.docx`, `.json`, `.jsonl`, `.html`, `.htm`, `.log`, `.tsv`, `.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`, `.bmp`, `.tiff`, `.svg`
67
+
68
+ **What happens on upload**:
69
+ 1. Original file is saved to `{DATA_DIR}/files/{filename}` (persistent across restarts)
70
+ 2. Text is extracted (documents) or description is used (images)
71
+ 3. Content is chunked and stored in SQLite + vector for semantic search
72
+ 4. Source-aware dedup: re-uploading the same filename replaces the previous version
73
+
74
+ **Image ingestion**: Images cannot have text extracted. Pass a `description` field with a natural-language description (e.g., from an LLM with vision). Without a description, images get a minimal placeholder (`[Image] filename (size KB)`).
75
+
76
+ ### Example: ingest a document
77
+
78
+ ```bash
79
+ curl -X POST {{ENDPOINT}}/api/memory/ingest/file \
80
+ -H "Authorization: Bearer {{API_KEY}}" \
81
+ -F "file=@report.pdf"
82
+ ```
83
+
84
+ ### Example: ingest an image with description
85
+
86
+ ```bash
87
+ curl -X POST {{ENDPOINT}}/api/memory/ingest/file \
88
+ -H "Authorization: Bearer {{API_KEY}}" \
89
+ -F "file=@screenshot.png" \
90
+ -F "description=A screenshot of the dashboard showing memory usage at 85%"
91
+ ```
92
+
93
+ ### SDK usage
94
+
95
+ ```typescript
96
+ // Document
97
+ const doc = new File([buffer], 'report.pdf', { type: 'application/pdf' });
98
+ await memory.ingestFile(doc);
99
+
100
+ // Image with description
101
+ const img = new File([imgBuffer], 'photo.png', { type: 'image/png' });
102
+ await memory.ingestFile(img, {
103
+ description: 'A photo of the whiteboard from the architecture meeting',
104
+ });
105
+ ```
106
+
107
+ ---
108
+
57
109
  ## Entity Extraction (Knowledge Graph)
58
110
 
59
111
  When storing memories that mention named subjects, include `entities` and `relationships` in the ingest request to populate the knowledge graph. This enables graph-based RAG and dashboard visualization.
@@ -87,7 +87,8 @@ class MemoryClient implements ExtendedMemoryInterface {
87
87
  graphQuery(query: { nodeId: string; depth?: number }): Promise<GraphTraversalResult>;
88
88
 
89
89
  // File ingestion (multipart upload to server)
90
- ingestFile(file: File): Promise<IngestionResult>;
90
+ // For images: pass { description } from LLM vision to enable semantic search
91
+ ingestFile(file: File, options?: { description?: string }): Promise<IngestionResult>;
91
92
 
92
93
  // Bi-temporal queries
93
94
  queryAsOf(asOf: string, filters?: TemporalQueryFilters): Promise<MemoryEntry[]>;