Skip to content

Commit f11e3c7

Browse files
committed
Update python bindings
1 parent b6ad100 commit f11e3c7

7 files changed

Lines changed: 505 additions & 2 deletions

File tree

docs/PYTHON_API.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ PomaiDB is exposed to Python via the **C API** and **ctypes**. The official pack
3535
| `stop_edge_gateway(db)` | Stop embedded edge listeners. |
3636
| `search_zero_copy(db, query, topk=10)` | Run single query with zero-copy semantic pointers and return NumPy views/dequantized arrays. |
3737
| `release_zero_copy_session(session_id)` | Release pinned zero-copy session returned by search results. |
38+
| `delete(db, int)` | Delete a vector from the index by global ID. |
39+
| `exists(db, int)` | Return a boolean indicating if a vector with the global ID exists. |
40+
| `get(db, int)` | Return the `id`, `dim`, `vector`, `metadata`, and `is_deleted` values for a given global ID. |
3841

3942
Gateway endpoints/protocols:
4043
- HTTP: `GET /health`, `GET /healthz`, `GET /metrics`, `POST /ingest/meta/<membrane>/<gid>`, `POST /ingest/vector/<membrane>/<id>`
@@ -63,6 +66,23 @@ Gateway endpoints/protocols:
6366
| `create_rag_membrane(db, name, dim, shard_count=1)` | Create and open a RAG membrane for chunk storage and hybrid search. |
6467
| `put_chunk(db, membrane_name, chunk_id, doc_id, token_ids, vector=None)` | Insert a chunk: token IDs (required) and optional embedding vector. |
6568
| `search_rag(db, membrane_name, token_ids=None, vector=None, topk=10, ...)` | RAG search by token overlap and/or vector. Returns list of `(chunk_id, doc_id, score, token_matches)`. |
69+
| **Typed Membranes (Other)** | |
70+
| `ts_put(db, membrane_name, series_id, ts, value)` | Put a timeseries data point. |
71+
| `kv_put(db, membrane_name, key, value)` | Store a KV pair in KEYVALUE membrane. |
72+
| `kv_get(db, membrane_name, key)` | Get the string value for a given key. |
73+
| `kv_delete(db, membrane_name, key)` | Delete a KV pair from a KEYVALUE membrane. |
74+
| `sketch_add(db, membrane_name, key, increment)` | Add value to a SKETCH membrane counter. |
75+
| `blob_put(db, membrane_name, blob_id, data)` | Store a binary blob (`bytes`) in a BLOB membrane. |
76+
| **Agent Memory** | |
77+
| `agent_memory_open(path, dim, metric="l2", max_messages_per_agent, max_device_bytes)` | Open or create an AgentMemory backend at the given path. |
78+
| `agent_memory_close(mem)` | Close an AgentMemory backend. |
79+
| `agent_memory_append(mem, agent_id, session_id, kind, logical_ts, text, embedding=None)` | Append a single agent memory record. |
80+
| `agent_memory_append_batch(mem, records)` | Append multiple agent memory records as a list of dicts. |
81+
| `agent_memory_get_recent(mem, agent_id, session_id=None, limit=10)` | Fetch recent agent memory records. |
82+
| `agent_memory_search(mem, agent_id, session_id=None, kind=None, min_ts=0, max_ts=0, embedding=None, topk=10)` | Semantic search over AgentMemory. |
83+
| `agent_memory_prune_old(mem, agent_id, keep_last_n, min_ts_to_keep)` | Prune old records for an agent. |
84+
| `agent_memory_prune_device(mem, target_total_bytes)` | Prune global device wide records. |
85+
| `agent_memory_freeze_if_needed(mem)` | Flush memory indexes to disk if pending. |
6686

6787
Exceptions: `pomaidb.PomaiDBError` on any failing call.
6888

gdb_out.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
This GDB supports auto-downloading debuginfo from the following URLs:
3+
<https://debuginfod.ubuntu.com>
4+
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
5+
Debuginfod has been disabled.
6+
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
7+
[Thread debugging using libthread_db enabled]
8+
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
9+
[New Thread 0x7ffff71cd6c0 (LWP 44427)]
10+
[Thread 0x7ffff71cd6c0 (LWP 44427) exited]
11+
12+
Thread 1 "python3" received signal SIGINT, Interrupt.
13+
futex_wait (private=0, expected=2, futex_word=0xd0ea20) at ../sysdeps/nptl/futex-internal.h:146
14+
#0 futex_wait (private=0, expected=2, futex_word=0xd0ea20) at ../sysdeps/nptl/futex-internal.h:146
15+
#1 __GI___lll_lock_wait (futex=futex@entry=0xd0ea20, private=0) at ./nptl/lowlevellock.c:49
16+
#2 0x00007ffff7ca0101 in lll_mutex_lock_optimized (mutex=0xd0ea20) at ./nptl/pthread_mutex_lock.c:48
17+
#3 ___pthread_mutex_lock (mutex=0xd0ea20) at ./nptl/pthread_mutex_lock.c:93
18+
#4 0x00007ffff669563a in pomai::AgentMemory::PruneOld(std::basic_string_view<char, std::char_traits<char> >, unsigned long, long) () from /home/autocookie/pomaieco/pomaidb/build/libpomai_c.so
19+
#5 0x00007ffff66a163e in pomai::AgentMemory::AppendMessage(pomai::AgentMemoryRecord const&, unsigned long*) () from /home/autocookie/pomaieco/pomaidb/build/libpomai_c.so
20+
#6 0x00007ffff6675f90 in pomai_agent_memory_append () from /home/autocookie/pomaieco/pomaidb/build/libpomai_c.so
21+
#7 0x00007ffff7bc4b16 in ?? () from /lib/x86_64-linux-gnu/libffi.so.8
22+
#8 0x00007ffff7bc13ef in ?? () from /lib/x86_64-linux-gnu/libffi.so.8
23+
#9 0x00007ffff7bc40be in ffi_call () from /lib/x86_64-linux-gnu/libffi.so.8
24+
#10 0x00007ffff7beb11c in ?? () from /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-x86_64-linux-gnu.so
25+
#11 0x00007ffff7be62af in ?? () from /usr/lib/python3.12/lib-dynload/_ctypes.cpython-312-x86_64-linux-gnu.so
26+
#12 0x0000000000548f75 in _PyObject_MakeTpCall ()
27+
#13 0x00000000005d6f09 in _PyEval_EvalFrameDefault ()
28+
#14 0x00000000005d543b in PyEval_EvalCode ()
29+
#15 0x00000000006084b3 in PyRun_StringFlags ()
30+
#16 0x00000000006b3d0e in PyRun_SimpleStringFlags ()
31+
#17 0x00000000006bc9d1 in Py_RunMain ()
32+
#18 0x00000000006bc3ed in Py_BytesMain ()
33+
#19 0x00007ffff7c2a1ca in __libc_start_call_main (main=main@entry=0x518930, argc=argc@entry=3, argv=argv@entry=0x7fffffffd818) at ../sysdeps/nptl/libc_start_call_main.h:58
34+
#20 0x00007ffff7c2a28b in __libc_start_main_impl (main=0x518930, argc=3, argv=0x7fffffffd818, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd808) at ../csu/libc-start.c:360
35+
#21 0x00000000006576c5 in _start ()

0 commit comments

Comments
 (0)