|
NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
|
Singleton factory for creating graph nodes by type name. More...
#include <loader.h>
Public Member Functions | |
| std::unique_ptr< GraphNode > | create (const std::string &type, const std::string &name, const json &config, const NodeContext &ctx) const |
| Create a node by type name. | |
| json | export_schema () const |
| Export a machine-readable description of the topology JSON format this engine accepts. | |
| void | register_type (const std::string &type, NodeFactoryFn fn) |
| Register a custom node type. | |
| void | register_type (const std::string &type, NodeFactoryFn fn, json config_schema) |
| Register a custom node type with a declared config schema. | |
| std::vector< std::string > | registered_types () const |
| List all registered node type names, sorted. | |
Static Public Member Functions | |
| static NodeFactory & | instance () |
| Get the singleton instance. | |
Singleton factory for creating graph nodes by type name.
Maps node type names (used in JSON node definitions) to factory functions. Built-in types: "llm_call", "tool_dispatch", "intent_classifier", "subgraph".
| std::unique_ptr< GraphNode > neograph::graph::NodeFactory::create | ( | const std::string & | type, |
| const std::string & | name, | ||
| const json & | config, | ||
| const NodeContext & | ctx | ||
| ) | const |
Create a node by type name.
| type | Node type name. |
| name | Unique node name within the graph. |
| config | Node-specific configuration from JSON. |
| ctx | Node context with provider, tools, and model. |
| json neograph::graph::NodeFactory::export_schema | ( | ) | const |
Export a machine-readable description of the topology JSON format this engine accepts.
Intended for external tooling — notably a visual block-coding topology editor — so the editor's node palette and the engine cannot drift apart across NeoGraph versions. The returned document is JSON, shaped as:
neograph_version lets a tool detect when its cached schema is older than the engine and warn the user. The topology fragment is fixed (defined by the graph compiler); per-type config schemas come from register_type's 3-arg overload, or default to a permissive object for types registered without one.
|
static |
Get the singleton instance.
| void neograph::graph::NodeFactory::register_type | ( | const std::string & | type, |
| NodeFactoryFn | fn | ||
| ) |
Register a custom node type.
| type | Node type name (referenced in JSON node definitions). |
| fn | Factory function that creates the node. |
The node's config schema defaults to a permissive {"type":"object"} (any config object accepted). Existing callers keep working unchanged; external tooling that consumes export_schema() will simply render a free-form config for such a type. To declare a concrete config schema, use the 3-arg overload below.
| void neograph::graph::NodeFactory::register_type | ( | const std::string & | type, |
| NodeFactoryFn | fn, | ||
| json | config_schema | ||
| ) |
Register a custom node type with a declared config schema.
| type | Node type name (referenced in JSON node definitions). |
| fn | Factory function that creates the node. |
| config_schema | JSON Schema (Draft 2020-12) fragment describing this node type's accepted config fields. Used only by export_schema() for external tooling; the engine does not validate config against it at compile time. Additive: callers using the 2-arg overload are unaffected. |
| std::vector< std::string > neograph::graph::NodeFactory::registered_types | ( | ) | const |
List all registered node type names, sorted.