110 lines
3.3 KiB
JavaScript
110 lines
3.3 KiB
JavaScript
import { Serializable } from "@langchain/core/load/serializable";
|
|
export class Node extends Serializable {
|
|
constructor({ id, type = "Node", properties = {}, }) {
|
|
super();
|
|
Object.defineProperty(this, "id", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
Object.defineProperty(this, "type", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
Object.defineProperty(this, "properties", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
Object.defineProperty(this, "lc_namespace", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: ["langchain", "graph", "document_node"]
|
|
});
|
|
this.id = id;
|
|
this.type = type;
|
|
this.properties = properties;
|
|
}
|
|
}
|
|
export class Relationship extends Serializable {
|
|
constructor({ source, target, type, properties = {}, }) {
|
|
super();
|
|
Object.defineProperty(this, "source", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
Object.defineProperty(this, "target", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
Object.defineProperty(this, "type", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
Object.defineProperty(this, "properties", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
Object.defineProperty(this, "lc_namespace", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: ["langchain", "graph", "document_relationship"]
|
|
});
|
|
this.source = source;
|
|
this.target = target;
|
|
this.type = type;
|
|
this.properties = properties;
|
|
}
|
|
}
|
|
export class GraphDocument extends Serializable {
|
|
constructor({ nodes, relationships, source, }) {
|
|
super({
|
|
nodes,
|
|
relationships,
|
|
source,
|
|
});
|
|
Object.defineProperty(this, "nodes", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
Object.defineProperty(this, "relationships", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
Object.defineProperty(this, "source", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: void 0
|
|
});
|
|
Object.defineProperty(this, "lc_namespace", {
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true,
|
|
value: ["langchain", "graph", "graph_document"]
|
|
});
|
|
this.nodes = nodes;
|
|
this.relationships = relationships;
|
|
this.source = source;
|
|
}
|
|
}
|