@neuledge/graph-memory-registry
v0.3.1
Published
In-memory embedding registry for intelligent query routing with semantic similarity matching.
Downloads
17
Maintainers
Readme
@neuledge/graph-memory-registry
In-memory embedding registry for @neuledge/graph-router
Overview
@neuledge/graph-memory-registry provides an in-memory registry implementation that uses semantic similarity matching through embeddings. It's designed to work with @neuledge/graph-router to enable intelligent routing of queries to the appropriate data sources.
This package is part of the @neuledge/graph ecosystem. For general use with LLMs and AI agents, see the main package.
💻 Installation
pnpm add @neuledge/graph-memory-registrynpm install @neuledge/graph-memory-registryyarn add @neuledge/graph-memory-registry📖 Usage
Register data sources with embeddings and let the registry intelligently route queries:
import { NeuledgeGraphMemoryRegistry } from "@neuledge/graph-memory-registry";
import { openai } from "@ai-sdk/openai";
const registry = new NeuledgeGraphMemoryRegistry({
model: openai.embedding("text-embedding-3-small"),
// (optional) useful for persistence across restarts and serverless cold starts
// commit this file to your repo or store in a shared volume
cacheFile: "./embedding-cache.json",
});
// Register a data source
registry.register({
template: "weather.{city}",
resolver: async ({ city }) => {
// fetch weather for the matched city
return { temperature: "72°F", condition: "Sunny" };
},
});
// Match queries using semantic similarity
const match = await registry.match({ path: "weather.tokyo" });🔧 API
NeuledgeGraphMemoryRegistry- In-memory registry with embedding-based matchingregister()- Register a data source with matcher and resolvermatch()- Find matching data source for a query pathresolve()- Resolve a matched query to a concrete valuesuggestions()- Get suggestions for alternative matches
For detailed API documentation, see the @neuledge/graph-router and main package.
📄 License
Apache-2.0 © Neuledge
See LICENSE for more information.
