Download the PHP package tivins/llm-memory without Composer
On this page you can find all versions of the php package tivins/llm-memory. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download tivins/llm-memory
More information about tivins/llm-memory
Files in tivins/llm-memory
Download tivins/llm-memory
More information about tivins/llm-memory
Files in tivins/llm-memory
Vendor tivins
Package llm-memory
Short Description Semantic memory store for LLM applications — embed, store, recall via pgvector.
License MIT
Package llm-memory
Short Description Semantic memory store for LLM applications — embed, store, recall via pgvector.
License MIT
Please rate this library. Is it a good library?
Informations about the package llm-memory
tivins/llm-memory
Semantic memory store for LLM applications — embed, store, and recall text fragments via pgvector.
Overview
A PHP library that provides a RAG-style retrieval pipeline:
- Store text fragments in PostgreSQL + pgvector with automatic embedding.
- Recall relevant fragments using a two-stage pipeline: vector ANN search → cross-encoder reranking.
- Deduplicate entries via SHA-256 content hashing per collection.
Requirements
- PHP 8.3+
- PostgreSQL with pgvector
- llama.cpp embedding server (port 8081, e.g.
bge-m3) - llama.cpp rerank server (port 8082, e.g.
Qwen3-Reranker) — optional
Installation
Quick start
Agent integration
Wire memory tools into an llm-lib agent:
Collections are typically namespaced (user:{id}, {app}:{scope}). See examples/agent.php for a full runnable demo.
API
| Method | Description |
|---|---|
ensureCollection(id, model, dim) |
Create a collection if it doesn't exist |
remember(collection, content, kind?, metadata?) |
Store a text fragment (embeds automatically, deduplicates) |
rememberMany(collection, items) |
Batch store — one embedding call for N fragments |
recall(collection, query, topN?, annTopK?, minRerankScore?) |
Retrieve relevant entries (ANN + optional rerank) |
recallAnnOnly(collection, query, topN?) |
ANN search only — skips rerank even when a reranker is configured |
listEntries(collection, limit?, offset?, idFrom?, idTo?) |
List entries (latest N or ID range) |
getById(id) |
Fetch a single entry by ID |
forget(id) |
Soft-delete a single entry (any collection) |
forgetInCollection(collection, id) |
Soft-delete within a collection; returns false if not found |
forgetCollection(id) |
Soft-delete all entries in a collection |
count(collection) |
Count active entries in a collection |
migrate() |
Run SQL migrations |
Testing
Integration tests require PostgreSQL with pgvector (see install.md). Unit tests for DTOs run without a database. Embedding/rerank calls use StubLLM from llm-lib — no llama.cpp server needed.
Dependencies
| Package | Role |
|---|---|
| tivins/llm-lib | Embedding & rerank HTTP clients |
| tivins/pdow | PDO database wrapper |
License
MIT.
All versions of llm-memory with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.3
tivins/pdow Version ^0.1
tivins/llm-lib Version ^0.5
ext-pdo Version *
ext-pgsql Version *
tivins/php-core Version ^2.0
tivins/pdow Version ^0.1
tivins/llm-lib Version ^0.5
ext-pdo Version *
ext-pgsql Version *
tivins/php-core Version ^2.0
The package tivins/llm-memory contains the following files
Loading the files please wait ...