@neuledge/graph-router
v0.3.1
Published
Router for pattern matching and resolution of queries against data source registries.
Maintainers
Readme
@neuledge/graph-router
Router implementation for @neuledge/graph
Overview
@neuledge/graph-router is a supporting package for @neuledge/graph that provides routing capabilities. It enables matching queries against a registry of data sources and resolving them to concrete values.
This is an internal utility package used to implement the core lookup functionality in @neuledge/graph. For general use with LLMs and AI agents, see the main package.
Related Packages
- @neuledge/graph-memory-registry - In-memory embedding-based registry implementation
💻 Installation
pnpm add @neuledge/graph-routernpm install @neuledge/graph-routeryarn add @neuledge/graph-router📖 Usage
The router handles pattern matching and resolution of queries:
import { NeuledgeGraphRouter } from "@neuledge/graph-router";
import { NeuledgeGraphMemoryRegistry } from "@neuledge/graph-memory-registry";
import Fastify from "fastify";
// See examples in @neuledge/graph-memory-registry for registering data sources
const registry = new NeuledgeGraphMemoryRegistry({
// ...registry config
});
const router = new NeuledgeGraphRouter({
registry,
});
const app = Fastify();
app.post("/lookup", async (request, reply) => {
try {
const result = await router.lookup(request.body);
return reply.send(result);
} catch (error) {
return reply.status(500).send(router.formatError(error));
}
});
app.listen({ port: 3000 });
🔧 API
NeuledgeGraphRouter- Main router class that handles query matching and resolutionNeuledgeGraphMatcher- Pattern matching utilities for query routingNeuledgeGraphRegistry- Registry interface for data source management
For detailed API documentation, see the main package.
📄 License
Apache-2.0 © Neuledge
See LICENSE for more information.
