@langchain/community
Version:
Third-party integrations for LangChain.js
1 lines • 2.63 kB
Source Map (JSON)
{"version":3,"file":"document.cjs","names":["Serializable"],"sources":["../../src/graphs/document.ts"],"sourcesContent":["import { Serializable } from \"@langchain/core/load/serializable\";\nimport { Document } from \"@langchain/core/documents\";\n\nexport class Node extends Serializable {\n id: string | number;\n\n type: string;\n\n // oxlint-disable-next-line typescript/no-explicit-any\n properties: Record<string, any>;\n\n lc_namespace = [\"langchain\", \"graph\", \"document_node\"];\n\n constructor({\n id,\n type = \"Node\",\n properties = {},\n }: {\n id: string | number;\n type: string;\n // oxlint-disable-next-line typescript/no-explicit-any\n properties?: Record<string, any>;\n }) {\n super();\n this.id = id;\n this.type = type;\n this.properties = properties;\n }\n}\n\nexport class Relationship extends Serializable {\n source: Node;\n\n target: Node;\n\n type: string;\n\n // oxlint-disable-next-line typescript/no-explicit-any\n properties: Record<string, any>;\n\n lc_namespace = [\"langchain\", \"graph\", \"document_relationship\"];\n\n constructor({\n source,\n target,\n type,\n properties = {},\n }: {\n source: Node;\n target: Node;\n type: string;\n // oxlint-disable-next-line typescript/no-explicit-any\n properties?: Record<string, any>;\n }) {\n super();\n this.source = source;\n this.target = target;\n this.type = type;\n this.properties = properties;\n }\n}\n\nexport class GraphDocument extends Serializable {\n nodes: Node[];\n\n relationships: Relationship[];\n\n source: Document;\n\n lc_namespace = [\"langchain\", \"graph\", \"graph_document\"];\n\n constructor({\n nodes,\n relationships,\n source,\n }: {\n nodes: Node[];\n relationships: Relationship[];\n source: Document;\n }) {\n super({\n nodes,\n relationships,\n source,\n });\n this.nodes = nodes;\n this.relationships = relationships;\n this.source = source;\n }\n}\n"],"mappings":";;;;;;;;;AAGA,IAAa,OAAb,cAA0BA,kCAAAA,aAAa;CACrC;CAEA;CAGA;CAEA,eAAe;EAAC;EAAa;EAAS;EAAgB;CAEtD,YAAY,EACV,IACA,OAAO,QACP,aAAa,EAAE,IAMd;AACD,SAAO;AACP,OAAK,KAAK;AACV,OAAK,OAAO;AACZ,OAAK,aAAa;;;AAItB,IAAa,eAAb,cAAkCA,kCAAAA,aAAa;CAC7C;CAEA;CAEA;CAGA;CAEA,eAAe;EAAC;EAAa;EAAS;EAAwB;CAE9D,YAAY,EACV,QACA,QACA,MACA,aAAa,EAAE,IAOd;AACD,SAAO;AACP,OAAK,SAAS;AACd,OAAK,SAAS;AACd,OAAK,OAAO;AACZ,OAAK,aAAa;;;AAItB,IAAa,gBAAb,cAAmCA,kCAAAA,aAAa;CAC9C;CAEA;CAEA;CAEA,eAAe;EAAC;EAAa;EAAS;EAAiB;CAEvD,YAAY,EACV,OACA,eACA,UAKC;AACD,QAAM;GACJ;GACA;GACA;GACD,CAAC;AACF,OAAK,QAAQ;AACb,OAAK,gBAAgB;AACrB,OAAK,SAAS"}