@langchain/core
Version:
Core LangChain.js abstractions and schemas
1 lines • 1.58 kB
Source Map (JSON)
{"version":3,"file":"modifier.cjs","names":["BaseMessage","fields: RemoveMessageFields<TStructure>","obj: unknown"],"sources":["../../src/messages/modifier.ts"],"sourcesContent":["import { BaseMessage, BaseMessageFields } from \"./base.js\";\nimport { MessageStructure } from \"./message.js\";\n\nexport interface RemoveMessageFields<\n TStructure extends MessageStructure = MessageStructure\n> extends Omit<BaseMessageFields<TStructure, \"remove\">, \"content\"> {\n /**\n * The ID of the message to remove.\n */\n id: string;\n}\n\n/**\n * Message responsible for deleting other messages.\n */\nexport class RemoveMessage<\n TStructure extends MessageStructure = MessageStructure\n> extends BaseMessage<TStructure, \"remove\"> {\n readonly type = \"remove\" as const;\n\n /**\n * The ID of the message to remove.\n */\n id: string;\n\n constructor(fields: RemoveMessageFields<TStructure>) {\n super({\n ...fields,\n content: [],\n });\n this.id = fields.id;\n }\n\n override get _printableFields(): Record<string, unknown> {\n return {\n ...super._printableFields,\n id: this.id,\n };\n }\n\n static isInstance(obj: unknown): obj is RemoveMessage {\n return super.isInstance(obj) && obj.type === \"remove\";\n }\n}\n"],"mappings":";;;;;;AAeA,IAAa,gBAAb,cAEUA,yBAAkC;CAC1C,AAAS,OAAO;;;;CAKhB;CAEA,YAAYC,QAAyC;EACnD,MAAM;GACJ,GAAG;GACH,SAAS,CAAE;EACZ,EAAC;EACF,KAAK,KAAK,OAAO;CAClB;CAED,IAAa,mBAA4C;AACvD,SAAO;GACL,GAAG,MAAM;GACT,IAAI,KAAK;EACV;CACF;CAED,OAAO,WAAWC,KAAoC;AACpD,SAAO,MAAM,WAAW,IAAI,IAAI,IAAI,SAAS;CAC9C;AACF"}