UNPKG

@langchain/core

Version:
1 lines 4.12 kB
{"version":3,"file":"serializable.d.ts","names":["SerializedFields","BaseSerialized","T","Record","SerializedConstructor","SerializedSecret","SerializedNotImplemented","Serialized","get_lc_unique_name","Serializable","SerializableInterface"],"sources":["../../src/load/serializable.d.ts"],"sourcesContent":["import { type SerializedFields } from \"./map_keys.js\";\nexport interface BaseSerialized<T extends string> {\n lc: number;\n type: T;\n id: string[];\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n graph?: Record<string, any>;\n}\nexport interface SerializedConstructor extends BaseSerialized<\"constructor\"> {\n kwargs: SerializedFields;\n}\nexport interface SerializedSecret extends BaseSerialized<\"secret\"> {\n}\nexport interface SerializedNotImplemented extends BaseSerialized<\"not_implemented\"> {\n}\nexport type Serialized = SerializedConstructor | SerializedSecret | SerializedNotImplemented;\n/**\n * Get a unique name for the module, rather than parent class implementations.\n * Should not be subclassed, subclass lc_name above instead.\n */\nexport declare function get_lc_unique_name(serializableClass: typeof Serializable): string;\nexport interface SerializableInterface {\n get lc_id(): string[];\n}\nexport declare abstract class Serializable implements SerializableInterface {\n lc_serializable: boolean;\n lc_kwargs: SerializedFields;\n /**\n * A path to the module that contains the class, eg. [\"langchain\", \"llms\"]\n * Usually should be the same as the entrypoint the class is exported from.\n */\n abstract lc_namespace: string[];\n /**\n * The name of the serializable. Override to provide an alias or\n * to preserve the serialized module name in minified environments.\n *\n * Implemented as a static method to support loading logic.\n */\n static lc_name(): string;\n /**\n * The final serialized identifier for the module.\n */\n get lc_id(): string[];\n /**\n * A map of secrets, which will be omitted from serialization.\n * Keys are paths to the secret in constructor args, e.g. \"foo.bar.baz\".\n * Values are the secret ids, which will be used when deserializing.\n */\n get lc_secrets(): {\n [key: string]: string;\n } | undefined;\n /**\n * A map of additional attributes to merge with constructor args.\n * Keys are the attribute names, e.g. \"foo\".\n * Values are the attribute values, which will be serialized.\n * These attributes need to be accepted by the constructor as arguments.\n */\n get lc_attributes(): SerializedFields | undefined;\n /**\n * A map of aliases for constructor args.\n * Keys are the attribute names, e.g. \"foo\".\n * Values are the alias that will replace the key in serialization.\n * This is used to eg. make argument names match Python.\n */\n get lc_aliases(): {\n [key: string]: string;\n } | undefined;\n /**\n * A manual list of keys that should be serialized.\n * If not overridden, all fields passed into the constructor will be serialized.\n */\n get lc_serializable_keys(): string[] | undefined;\n constructor(kwargs?: SerializedFields, ..._args: never[]);\n toJSON(): Serialized;\n toJSONNotImplemented(): SerializedNotImplemented;\n}\n"],"mappings":";;;UACiBC;;EAAAA,IAAAA,EAEPC,CAFOD;EAAc,EAAA,EAAA,MAAA,EAAA;EAAA,IAErBC,CAAAA,EAAAA,MAAAA;EAAC;EAIO,KAAA,CAAA,EAANC,MAAM,CAAA,MAAA,EAAA,GAAA,CAAA;AAElB;AAAsC,UAArBC,qBAAAA,SAA8BH,cAAT,CAAA,aAAA,CAAA,CAAA;EAAA,MAC1BD,EAAAA,gBAAAA;;AADiD,UAG5CK,gBAAAA,SAAyBJ,cAHmB,CAAA,QAAA,CAAA,CAAA,CAG7D;AAEiBK,UAAAA,wBAAAA,SAAiCL,cAAc,CAAA,iBAAA,CAAA,CAAA,CAEhE;AAAsB,KAAVM,UAAAA,GAAaH,qBAAH,GAA2BC,gBAA3B,GAA8CC,wBAA9C;;;;AAAsE;AAKpEE,iBAAAA,kBAAAA,CAA6CC,iBAAY,EAAA,OAAZA,YAAY,CAAA,EAAA,MAAA;AAChEC,UAAAA,qBAAAA,CAAqB;EAGRD,IAAAA,KAAAA,EAAAA,EAAAA,MAAY,EAAA;;AAE3BT,uBAFeS,YAAAA,YAAwBC,qBAEvCV,CAAAA;EAAgB,eA+BNA,EAAAA,OAAAA;EAAgB,SAehBA,EA9CVA,gBA8CUA;EAAgB;;;AAhDkC;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAiClDA;;;;;;;;;;;;;;;uBAeAA;YACXO;0BACcD"}