feat: TS SDK v3 port, graph store removal, client v3 API migration
TypeScript SDK v3 pipeline (full parity with Python): - Single-pass additive extraction with ADDITIVE_EXTRACTION_PROMPT - Hybrid search (semantic + BM25 + entity boost) with additive scoring - 8-phase batch pipeline (batch embed, persist, entity linking) - New utils: scoring.ts, lemmatization.ts (natural), entity_extraction.ts (compromise) - keywordSearch() on 8 vector stores (3 full: PGVector, Memory, Azure AI Search) - Message persistence in SQLiteManager (rolling window of 10) - Entity store as second vector collection - MAX_BATCH=100 chunking guard on OpenAI/Azure embedBatch - Updated default LLM model to gpt-4.1-nano-2025-04-14 - compromise + natural added as peer dependencies Graph store removal (Python + TypeScript): - Removed Neo4j, Memgraph, Kuzu, Neptune, Apache AGE integrations - Deleted 18 graph-related files across both SDKs - Removed GraphStoreFactory, GraphStoreConfig, graph_store config field - Removed "relations" key from all API responses - Removed graph optional dependency group from pyproject.toml - Removed neo4j-driver from TS peerDependencies - Simplified add/search/delete/reset (no more parallel graph operations) Client SDK v3 API migration: - add() endpoint: /v1/memories/ -> /v3/memories/ (async response) - search() endpoint: /v2/memories/search/ -> /v3/memories/search/ - Removed output_format injection and v1.1 unwrapping logic - Applied to both Python (sync + async) and TypeScript clients Review feedback fixes: - Removed deprecated custom_update_memory_prompt from MemoryConfig - Added MAX_BATCH=100 chunking to Python + TS embed_batch - Moved all inline imports to top level in main.py - Cleaned up GraphStoreError dead code from exceptions.py Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
3402c67805
commit
59880a6f8f
@@ -292,86 +292,6 @@ async function demoRedis() {
|
||||
await runTests(memory);
|
||||
}
|
||||
|
||||
async function demoGraphMemory() {
|
||||
console.log("\n=== Testing Graph Memory Store ===\n");
|
||||
|
||||
const memory = new Memory({
|
||||
version: "v1.1",
|
||||
embedder: {
|
||||
provider: "openai",
|
||||
config: {
|
||||
apiKey: process.env.OPENAI_API_KEY || "",
|
||||
model: "text-embedding-3-small",
|
||||
},
|
||||
},
|
||||
vectorStore: {
|
||||
provider: "memory",
|
||||
config: {
|
||||
collectionName: "memories",
|
||||
dimension: 1536,
|
||||
},
|
||||
},
|
||||
llm: {
|
||||
provider: "openai",
|
||||
config: {
|
||||
apiKey: process.env.OPENAI_API_KEY || "",
|
||||
model: "gpt-4-turbo-preview",
|
||||
},
|
||||
},
|
||||
graphStore: {
|
||||
provider: "neo4j",
|
||||
config: {
|
||||
url: process.env.NEO4J_URL || "neo4j://localhost:7687",
|
||||
username: process.env.NEO4J_USERNAME || "neo4j",
|
||||
password: process.env.NEO4J_PASSWORD || "password",
|
||||
},
|
||||
llm: {
|
||||
provider: "openai",
|
||||
config: {
|
||||
model: "gpt-4-turbo-preview",
|
||||
},
|
||||
},
|
||||
},
|
||||
historyDbPath: "memory.db",
|
||||
});
|
||||
|
||||
try {
|
||||
// Reset all memories
|
||||
await memory.reset();
|
||||
|
||||
// Add memories with relationships
|
||||
const result = await memory.add(
|
||||
[
|
||||
{
|
||||
role: "user",
|
||||
content: "Alice is Bob's sister and works as a doctor.",
|
||||
},
|
||||
{
|
||||
role: "assistant",
|
||||
content:
|
||||
"I understand that Alice and Bob are siblings and Alice is a medical professional.",
|
||||
},
|
||||
{ role: "user", content: "Bob is married to Carol who is a teacher." },
|
||||
],
|
||||
{
|
||||
userId: "john",
|
||||
},
|
||||
);
|
||||
console.log("Added memories with relationships:", result);
|
||||
|
||||
// Search for connected information
|
||||
const searchResult = await memory.search(
|
||||
"Tell me about Bob's family connections",
|
||||
{
|
||||
userId: "john",
|
||||
},
|
||||
);
|
||||
console.log("Search results with graph relationships:", searchResult);
|
||||
} catch (error) {
|
||||
console.error("Error in graph memory demo:", error);
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
// Test in-memory store
|
||||
await demoMemoryStore();
|
||||
@@ -379,19 +299,6 @@ async function main() {
|
||||
// Test in-memory store with Ollama
|
||||
await demoLocalMemory();
|
||||
|
||||
// Test graph memory if Neo4j environment variables are set
|
||||
if (
|
||||
process.env.NEO4J_URL &&
|
||||
process.env.NEO4J_USERNAME &&
|
||||
process.env.NEO4J_PASSWORD
|
||||
) {
|
||||
await demoGraphMemory();
|
||||
} else {
|
||||
console.log(
|
||||
"\nSkipping Graph Memory test - Neo4j environment variables not set",
|
||||
);
|
||||
}
|
||||
|
||||
// Test PGVector store if environment variables are set
|
||||
if (process.env.PGVECTOR_DB) {
|
||||
await demoPGVector();
|
||||
|
||||
Reference in New Issue
Block a user