@langchain/core 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","names":["___messages_ai_js0","___messages_chat_js0","___messages_function_js0","___messages_human_js0","___messages_system_js0","___messages_tool_js0","HashKeyEncoder","Generation","StoredGeneration","defaultHashKeyEncoder","deserializeStoredGeneration","___messages_message_js1","MessageStructure","AIMessage","ChatMessage","FunctionMessage","HumanMessage","SystemMessage","ToolMessage","serializeGeneration","BaseCache","T","Promise","InMemoryCache","Map"],"sources":["../../src/caches/base.d.ts"],"sourcesContent":["import { type HashKeyEncoder } from \"../utils/hash.js\";\nimport type { Generation } from \"../outputs.js\";\nimport { type StoredGeneration } from \"../messages/base.js\";\nexport declare const defaultHashKeyEncoder: HashKeyEncoder;\nexport declare function deserializeStoredGeneration(storedGeneration: StoredGeneration): {\n text: string;\n message: import(\"../messages/ai.js\").AIMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/chat.js\").ChatMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/function.js\").FunctionMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/human.js\").HumanMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/system.js\").SystemMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/tool.js\").ToolMessage<import(\"../messages/message.js\").MessageStructure>;\n} | {\n message?: undefined;\n text: string;\n};\nexport declare function serializeGeneration(generation: Generation): StoredGeneration;\n/**\n * Base class for all caches. All caches should extend this class.\n */\nexport declare abstract class BaseCache<T = Generation[]> {\n protected keyEncoder: HashKeyEncoder;\n /**\n * Sets a custom key encoder function for the cache.\n * This function should take a prompt and an LLM key and return a string\n * that will be used as the cache key.\n * @param keyEncoderFn The custom key encoder function.\n */\n makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void;\n abstract lookup(prompt: string, llmKey: string): Promise<T | null>;\n abstract update(prompt: string, llmKey: string, value: T): Promise<void>;\n}\n/**\n * A cache for storing LLM generations that stores data in memory.\n */\nexport declare class InMemoryCache<T = Generation[]> extends BaseCache<T> {\n private cache;\n constructor(map?: Map<string, T>);\n /**\n * Retrieves data from the cache using a prompt and an LLM key. If the\n * data is not found, it returns null.\n * @param prompt The prompt used to find the data.\n * @param llmKey The LLM key used to find the data.\n * @returns The data corresponding to the prompt and LLM key, or null if not found.\n */\n lookup(prompt: string, llmKey: string): Promise<T | null>;\n /**\n * Updates the cache with new data using a prompt and an LLM key.\n * @param prompt The prompt used to store the data.\n * @param llmKey The LLM key used to store the data.\n * @param value The data to be stored.\n */\n update(prompt: string, llmKey: string, value: T): Promise<void>;\n /**\n * Returns a global instance of InMemoryCache using a predefined global\n * map as the initial cache.\n * @returns A global instance of InMemoryCache.\n */\n static global(): InMemoryCache;\n}\n"],"mappings":";;;;;;;;;;;;cAGqBS,uBAAuBH;iBACpBI,2BAAAA,mBAA8CF;;WAE8B,UAFd,gBAAA,IAE6G,YAAjJ,gBAAA,IAAwP,gBAAzJ,gBAAA,IAA0P,aAAnJ,gBAAA,IAAsP,cAArJ,gBAAA,IAAoP,YAAjJ,gBAAA;;;;;iBAKpaW,mBAAAA,aAAgCZ,aAAaC;AARrE;AACA;;AAAsEA,uBAWxCY,SAXwCZ,CAAAA,IAW1BD,UAX0BC,EAAAA,CAAAA,CAAAA;EAAgB,UAAA,UAAA,EAY5DF,cAZ4D;EAEc;;;;;;EAAuS,qBAAA,CAAA,YAAA,EAiBnWA,cAjBmW,CAAA,EAAA,IAAA;EAAlD,SAAA,MAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EAkBpSgB,OAlBoS,CAkB5RD,CAlB4R,GAAA,IAAA,CAAA;EAAqJ,SAAA,MAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAmBnbA,CAnBmb,CAAA,EAmB/aC,OAnB+a,CAAA,IAAA,CAAA;;;AAA6C;AAK3hB;AAA2C,cAmBtBC,aAnBsB,CAAA,IAmBJhB,UAnBI,EAAA,CAAA,SAmBkBa,SAnBlB,CAmB4BC,CAnB5B,CAAA,CAAA;EAAA,QAAad,KAAAA;EAAU,WAAGC,CAAAA,GAAAA,CAAAA,EAqB/CgB,GArB+ChB,CAAAA,MAAAA,EAqBnCa,CArBmCb,CAAAA;EAAgB;AAIrF;;;;;;EAS8D,MAATc,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,CAAAA,EAgBTA,OAhBSA,CAgBDD,CAhBCC,GAAAA,IAAAA,CAAAA;EAAO;;AACU;AAKtE;;;EAAiD,MAAsBD,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,KAAAA,EAiBrBA,CAjBqBA,CAAAA,EAiBjBC,OAjBiBD,CAAAA,IAAAA,CAAAA;EAAC;;;;;EAiBrB,OAAGC,MAAAA,CAAAA,CAAAA,EAMjCC,aANiCD"}
1
+ {"version":3,"file":"base.d.ts","names":["___messages_ai_js0","___messages_chat_js0","___messages_function_js0","___messages_human_js0","___messages_system_js0","___messages_tool_js0","HashKeyEncoder","Generation","StoredGeneration","defaultHashKeyEncoder","deserializeStoredGeneration","___messages_message_js0","MessageStructure","AIMessage","ChatMessage","FunctionMessage","HumanMessage","SystemMessage","ToolMessage","serializeGeneration","BaseCache","T","Promise","InMemoryCache","Map"],"sources":["../../src/caches/base.d.ts"],"sourcesContent":["import { type HashKeyEncoder } from \"../utils/hash.js\";\nimport type { Generation } from \"../outputs.js\";\nimport { type StoredGeneration } from \"../messages/base.js\";\nexport declare const defaultHashKeyEncoder: HashKeyEncoder;\nexport declare function deserializeStoredGeneration(storedGeneration: StoredGeneration): {\n text: string;\n message: import(\"../messages/ai.js\").AIMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/chat.js\").ChatMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/function.js\").FunctionMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/human.js\").HumanMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/system.js\").SystemMessage<import(\"../messages/message.js\").MessageStructure> | import(\"../messages/tool.js\").ToolMessage<import(\"../messages/message.js\").MessageStructure>;\n} | {\n message?: undefined;\n text: string;\n};\nexport declare function serializeGeneration(generation: Generation): StoredGeneration;\n/**\n * Base class for all caches. All caches should extend this class.\n */\nexport declare abstract class BaseCache<T = Generation[]> {\n protected keyEncoder: HashKeyEncoder;\n /**\n * Sets a custom key encoder function for the cache.\n * This function should take a prompt and an LLM key and return a string\n * that will be used as the cache key.\n * @param keyEncoderFn The custom key encoder function.\n */\n makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void;\n abstract lookup(prompt: string, llmKey: string): Promise<T | null>;\n abstract update(prompt: string, llmKey: string, value: T): Promise<void>;\n}\n/**\n * A cache for storing LLM generations that stores data in memory.\n */\nexport declare class InMemoryCache<T = Generation[]> extends BaseCache<T> {\n private cache;\n constructor(map?: Map<string, T>);\n /**\n * Retrieves data from the cache using a prompt and an LLM key. If the\n * data is not found, it returns null.\n * @param prompt The prompt used to find the data.\n * @param llmKey The LLM key used to find the data.\n * @returns The data corresponding to the prompt and LLM key, or null if not found.\n */\n lookup(prompt: string, llmKey: string): Promise<T | null>;\n /**\n * Updates the cache with new data using a prompt and an LLM key.\n * @param prompt The prompt used to store the data.\n * @param llmKey The LLM key used to store the data.\n * @param value The data to be stored.\n */\n update(prompt: string, llmKey: string, value: T): Promise<void>;\n /**\n * Returns a global instance of InMemoryCache using a predefined global\n * map as the initial cache.\n * @returns A global instance of InMemoryCache.\n */\n static global(): InMemoryCache;\n}\n"],"mappings":";;;;;;;;;;;;cAGqBS,uBAAuBH;iBACpBI,2BAAAA,mBAA8CF;;WAE8B,UAFd,gBAAA,IAE6G,YAAjJ,gBAAA,IAAwP,gBAAzJ,gBAAA,IAA0P,aAAnJ,gBAAA,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ainValues","BaseMessage","AgentAction","AgentFinish","ChatGenerationChunk","GenerationChunk","LLMResult","Serializable","Serialized","SerializedNotImplemented","SerializedFields","DocumentInterface","Error","BaseCallbackHandlerInput","NewTokenIndices","HandleLLMNewTokenCallbackFields","BaseCallbackHandlerMethodsClass","Record","Promise","CallbackHandlerMethods","CallbackHandlerPrefersStreaming","callbackHandlerPrefersStreaming","BaseCallbackHandler","___messages_message_js0","MessageStructure","MessageType","isBaseCallbackHandler"],"sources":["../../src/callbacks/base.d.ts"],"sourcesContent":["import type { ChainValues } from \"../utils/types/index.js\";\nimport type { BaseMessage } from \"../messages/base.js\";\nimport type { AgentAction, AgentFinish } from \"../agents.js\";\nimport type { ChatGenerationChunk, GenerationChunk, LLMResult } from \"../outputs.js\";\nimport { Serializable, Serialized, SerializedNotImplemented } from \"../load/serializable.js\";\nimport type { SerializedFields } from \"../load/map_keys.js\";\nimport type { DocumentInterface } from \"../documents/document.js\";\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Error = any;\n/**\n * Interface for the input parameters of the BaseCallbackHandler class. It\n * allows to specify which types of events should be ignored by the\n * callback handler.\n */\nexport interface BaseCallbackHandlerInput {\n ignoreLLM?: boolean;\n ignoreChain?: boolean;\n ignoreAgent?: boolean;\n ignoreRetriever?: boolean;\n ignoreCustomEvent?: boolean;\n _awaitHandler?: boolean;\n raiseError?: boolean;\n}\n/**\n * Interface for the indices of a new token produced by an LLM or Chat\n * Model in streaming mode.\n */\nexport interface NewTokenIndices {\n prompt: number;\n completion: number;\n}\n// TODO: Add all additional callback fields here\nexport type HandleLLMNewTokenCallbackFields = {\n chunk?: GenerationChunk | ChatGenerationChunk;\n};\n/**\n * Abstract class that provides a set of optional methods that can be\n * overridden in derived classes to handle various events during the\n * execution of a LangChain application.\n */\ndeclare abstract class BaseCallbackHandlerMethodsClass {\n /**\n * Called at the start of an LLM or Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called when an LLM/ChatModel in `streaming` mode produces a new token\n */\n handleLLMNewToken?(token: string, \n /**\n * idx.prompt is the index of the prompt that produced the token\n * (if there are multiple prompts)\n * idx.completion is the index of the completion that produced the token\n * (if multiple completions per prompt are requested)\n */\n idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called if an LLM/ChatModel run encounters an error\n */\n handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the end of an LLM/ChatModel run, with the output and the run ID.\n */\n handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the start of a Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the start of a Chain run, with the chain name and inputs\n * and the run ID.\n */\n handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runType?: string, runName?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called if a Chain run encounters an error\n */\n handleChainError?(err: Error, runId: string, parentRunId?: string, tags?: string[], kwargs?: {\n inputs?: Record<string, unknown>;\n }): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the end of a Chain run, with the outputs and the run ID.\n */\n handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], kwargs?: {\n inputs?: Record<string, unknown>;\n }): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the start of a Tool run, with the tool name and input\n * and the run ID.\n */\n handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called if a Tool run encounters an error\n */\n handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the end of a Tool run, with the tool output and the run ID.\n */\n handleToolEnd?(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n output: any, runId: string, parentRunId?: string, tags?: string[]): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n handleText?(text: string, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;\n /**\n * Called when an agent is about to execute an action,\n * with the action and the run ID.\n */\n handleAgentAction?(action: AgentAction, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;\n /**\n * Called when an agent finishes execution, before it exits.\n * with the final output and the run ID.\n */\n handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;\n handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n handleCustomEvent?(eventName: string, \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any, runId: string, tags?: string[], \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n metadata?: Record<string, any>): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n}\n/**\n * Base interface for callbacks. All methods are optional. If a method is not\n * implemented, it will be ignored. If a method is implemented, it will be\n * called at the appropriate time. All methods are called with the run ID of\n * the LLM/ChatModel/Chain that is running, which is generated by the\n * CallbackManager.\n *\n * @interface\n */\nexport type CallbackHandlerMethods = BaseCallbackHandlerMethodsClass;\n/**\n * Interface for handlers that can indicate a preference for streaming responses.\n * When implemented, this allows the handler to signal whether it prefers to receive\n * streaming responses from language models rather than complete responses.\n */\nexport interface CallbackHandlerPrefersStreaming {\n readonly lc_prefer_streaming: boolean;\n}\nexport declare function callbackHandlerPrefersStreaming(x: BaseCallbackHandler): unknown;\n/**\n * Abstract base class for creating callback handlers in the LangChain\n * framework. It provides a set of optional methods that can be overridden\n * in derived classes to handle various events during the execution of a\n * LangChain application.\n */\nexport declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsClass implements BaseCallbackHandlerInput, Serializable {\n lc_serializable: boolean;\n get lc_namespace(): [\"langchain_core\", \"callbacks\", string];\n get lc_secrets(): {\n [key: string]: string;\n } | undefined;\n get lc_attributes(): {\n [key: string]: string;\n } | undefined;\n get lc_aliases(): {\n [key: string]: string;\n } | undefined;\n get lc_serializable_keys(): string[] | undefined;\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 lc_kwargs: SerializedFields;\n abstract name: string;\n ignoreLLM: boolean;\n ignoreChain: boolean;\n ignoreAgent: boolean;\n ignoreRetriever: boolean;\n ignoreCustomEvent: boolean;\n raiseError: boolean;\n awaitHandlers: boolean;\n constructor(input?: BaseCallbackHandlerInput);\n copy(): BaseCallbackHandler;\n toJSON(): Serialized;\n toJSONNotImplemented(): SerializedNotImplemented;\n static fromMethods(methods: CallbackHandlerMethods): {\n /**\n * Called at the start of an LLM or Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string | undefined, extraParams?: Record<string, unknown> | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;\n /**\n * Called when an LLM/ChatModel in `streaming` mode produces a new token\n */\n handleLLMNewToken?(token: string, idx: NewTokenIndices, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, fields?: HandleLLMNewTokenCallbackFields | undefined): any;\n /**\n * Called if an LLM/ChatModel run encounters an error\n */\n handleLLMError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, extraParams?: Record<string, unknown> | undefined): any;\n /**\n * Called at the end of an LLM/ChatModel run, with the output and the run ID.\n */\n handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, extraParams?: Record<string, unknown> | undefined): any;\n /**\n * Called at the start of a Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleChatModelStart?(llm: Serialized, messages: BaseMessage<import(\"../messages/message.js\").MessageStructure, import(\"../messages/message.js\").MessageType>[][], runId: string, parentRunId?: string | undefined, extraParams?: Record<string, unknown> | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;\n /**\n * Called at the start of a Chain run, with the chain name and inputs\n * and the run ID.\n */\n handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runType?: string | undefined, runName?: string | undefined): any;\n /**\n * Called if a Chain run encounters an error\n */\n handleChainError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, kwargs?: {\n inputs?: Record<string, unknown> | undefined;\n } | undefined): any;\n /**\n * Called at the end of a Chain run, with the outputs and the run ID.\n */\n handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, kwargs?: {\n inputs?: Record<string, unknown> | undefined;\n } | undefined): any;\n /**\n * Called at the start of a Tool run, with the tool name and input\n * and the run ID.\n */\n handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;\n /**\n * Called if a Tool run encounters an error\n */\n handleToolError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;\n /**\n * Called at the end of a Tool run, with the tool output and the run ID.\n */\n handleToolEnd?(output: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;\n handleText?(text: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;\n /**\n * Called when an agent is about to execute an action,\n * with the action and the run ID.\n */\n handleAgentAction?(action: AgentAction, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;\n /**\n * Called when an agent finishes execution, before it exits.\n * with the final output and the run ID.\n */\n handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;\n handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, name?: string | undefined): any;\n handleRetrieverEnd?(documents: DocumentInterface<Record<string, any>>[], runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;\n handleRetrieverError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;\n handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[] | undefined, metadata?: Record<string, any> | undefined): any;\n lc_serializable: boolean;\n readonly lc_namespace: [\"langchain_core\", \"callbacks\", string];\n readonly lc_secrets: {\n [key: string]: string;\n } | undefined;\n readonly lc_attributes: {\n [key: string]: string;\n } | undefined;\n readonly lc_aliases: {\n [key: string]: string;\n } | undefined;\n readonly lc_serializable_keys: string[] | undefined;\n /**\n * The final serialized identifier for the module.\n */\n readonly lc_id: string[];\n lc_kwargs: SerializedFields;\n ignoreLLM: boolean;\n ignoreChain: boolean;\n ignoreAgent: boolean;\n ignoreRetriever: boolean;\n ignoreCustomEvent: boolean;\n raiseError: boolean;\n awaitHandlers: boolean;\n copy(): BaseCallbackHandler;\n toJSON(): Serialized;\n toJSONNotImplemented(): SerializedNotImplemented;\n name: string;\n };\n}\nexport declare const isBaseCallbackHandler: (x: unknown) => boolean;\nexport {};\n"],"mappings":";;;;;;;;;;;KAQKY,KAAAA;;AAF6D;AAQlE;AAaA;AAKA;AAA2C,UAlB1BC,wBAAAA,CAkB0B;EAAA,SAC/BR,CAAAA,EAAAA,OAAAA;EAAe,WAAGD,CAAAA,EAAAA,OAAAA;EAAmB,WAAA,CAAA,EAAA,OAAA;EAO1BY,eAAAA,CAAAA,EAAAA,OAAAA;EAA+B,iBAAA,CAAA,EAAA,OAAA;EAAA,aAK7BR,CAAAA,EAAAA,OAAAA;EAAU,UAAwES,CAAAA,EAAAA,OAAAA;;;;;;AAiBlFL,UAnCRE,eAAAA,CAmCQF;EAAK,MAAsEK,EAAAA,MAAAA;EAAM,UACtGC,EAAAA,MAAAA;;;AAKAA,KApCQH,+BAAAA,GAoCRG;EAAO,KAKoBV,CAAAA,EAxCnBH,eAwCmBG,GAxCDJ,mBAwCCI;CAAU;;;;;;uBAjClBQ,+BAAAA,CAuCwGC;EAAM;;;;EAQ1H,cAIkBjB,CAAAA,CAAAA,GAAAA,EA9CJQ,UA8CIR,EAAAA,OAAAA,EAAAA,MAAAA,EAAAA,EAAAA,KAAAA,EAAAA,MAAAA,EAAAA,WAAAA,CAAAA,EAAAA,MAAAA,EAAAA,WAAAA,CAAAA,EA9C8EiB,MA8C9EjB,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA,CAAAA,EAAAA,MAAAA,EAAAA,EAAAA,QAAAA,CAAAA,EA9CmIiB,MA8CnIjB,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAA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rEI,CAAAA,IAAAA,CAAAA,GAAAA,IAAAA;EAAmB;;;;EAjI0F,iBAAEf,CAAAA,CAAAA,MAAAA,EA5ChGL,WA4CgGK,EAAAA,KAAAA,EAAAA,MAAAA,EAAAA,WAAAA,CAAAA,EAAAA,MAAAA,EAAAA,IAAAA,CAAAA,EAAAA,MAAAA,EAAAA,CAAAA,EA5C5BW,OA4C4BX,CAAAA,IAAAA,CAAAA,GAAAA,IAAAA;EAAY;AAuI3I;;;0BA9K4BJ,oEAAoEe;mCAC3DV,4FAA4FS;;EAC7HC;iCAC+BP;;EAC/BO;6BAC2BN;;EAC3BM;;;;;aAKWD;;EACXC;;;;;;;;;;;KAWQC,sBAAAA,GAAyBH;;;;;;UAMpBI,+BAAAA;;;iBAGOC,+BAAAA,IAAmCC;;;;;;;uBAO7BA,mBAAAA,SAA4BN,+BAAAA,YAA2CH,0BAA0BN;;;;;;;;;;;;;;;;;;;;;;;;aAwBhHG;;;;;;;;;sBASSG;UACZS;YACEd;0BACcC;8BACIU;;;;;yBAKHX,8FAA8FS,6EAA6EA;;;;2CAIzJH,wGAAwGC;;;;0HAIzBE;;;;0BAIhGX,uGAAuGW;;;;;+BAKlGT,sBAAsBP,YAAZ,gBAAA,EAAyE,WAAA,sEAAoHgB,6EAA6EA;;;;;6BAKtRT,oBAAoBR,sGAAsGiB;;;;;eAKtIA;;;;;6BAKYjB;eACZiB;;;;;;2BAMUT,oHAAoHS;;;;;;;;;oHAS3BC;;;;;+BAKrFhB,mGAAmGgB;;;;;4BAKtGf,mGAAmGe;qCAC1FV,oHAAoHS;mCACtHN,kBAAkBM;;4GAEuDA;;;;;;;;;;;;;;;;;eAiB7FP;;;;;;;;YAQHY;cACEd;4BACcC;;;;cAIXiB"}
1
+ {"version":3,"file":"base.d.ts","names":["ChainValues","BaseMessage","AgentAction","AgentFinish","ChatGenerationChunk","GenerationChunk","LLMResult","Serializable","Serialized","SerializedNotImplemented","SerializedFields","DocumentInterface","Error","BaseCallbackHandlerInput","NewTokenIndices","HandleLLMNewTokenCallbackFields","BaseCallbackHandlerMethodsClass","Record","Promise","CallbackHandlerMethods","CallbackHandlerPrefersStreaming","callbackHandlerPrefersStreaming","BaseCallbackHandler","___messages_message_js5","MessageStructure","MessageType","isBaseCallbackHandler"],"sources":["../../src/callbacks/base.d.ts"],"sourcesContent":["import type { ChainValues } from \"../utils/types/index.js\";\nimport type { BaseMessage } from \"../messages/base.js\";\nimport type { AgentAction, AgentFinish } from \"../agents.js\";\nimport type { ChatGenerationChunk, GenerationChunk, LLMResult } from \"../outputs.js\";\nimport { Serializable, Serialized, SerializedNotImplemented } from \"../load/serializable.js\";\nimport type { SerializedFields } from \"../load/map_keys.js\";\nimport type { DocumentInterface } from \"../documents/document.js\";\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Error = any;\n/**\n * Interface for the input parameters of the BaseCallbackHandler class. It\n * allows to specify which types of events should be ignored by the\n * callback handler.\n */\nexport interface BaseCallbackHandlerInput {\n ignoreLLM?: boolean;\n ignoreChain?: boolean;\n ignoreAgent?: boolean;\n ignoreRetriever?: boolean;\n ignoreCustomEvent?: boolean;\n _awaitHandler?: boolean;\n raiseError?: boolean;\n}\n/**\n * Interface for the indices of a new token produced by an LLM or Chat\n * Model in streaming mode.\n */\nexport interface NewTokenIndices {\n prompt: number;\n completion: number;\n}\n// TODO: Add all additional callback fields here\nexport type HandleLLMNewTokenCallbackFields = {\n chunk?: GenerationChunk | ChatGenerationChunk;\n};\n/**\n * Abstract class that provides a set of optional methods that can be\n * overridden in derived classes to handle various events during the\n * execution of a LangChain application.\n */\ndeclare abstract class BaseCallbackHandlerMethodsClass {\n /**\n * Called at the start of an LLM or Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called when an LLM/ChatModel in `streaming` mode produces a new token\n */\n handleLLMNewToken?(token: string, \n /**\n * idx.prompt is the index of the prompt that produced the token\n * (if there are multiple prompts)\n * idx.completion is the index of the completion that produced the token\n * (if multiple completions per prompt are requested)\n */\n idx: NewTokenIndices, runId: string, parentRunId?: string, tags?: string[], fields?: HandleLLMNewTokenCallbackFields): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called if an LLM/ChatModel run encounters an error\n */\n handleLLMError?(err: Error, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the end of an LLM/ChatModel run, with the output and the run ID.\n */\n handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string, tags?: string[], extraParams?: Record<string, unknown>): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the start of a Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleChatModelStart?(llm: Serialized, messages: BaseMessage[][], runId: string, parentRunId?: string, extraParams?: Record<string, unknown>, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the start of a Chain run, with the chain name and inputs\n * and the run ID.\n */\n handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runType?: string, runName?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called if a Chain run encounters an error\n */\n handleChainError?(err: Error, runId: string, parentRunId?: string, tags?: string[], kwargs?: {\n inputs?: Record<string, unknown>;\n }): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the end of a Chain run, with the outputs and the run ID.\n */\n handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string, tags?: string[], kwargs?: {\n inputs?: Record<string, unknown>;\n }): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the start of a Tool run, with the tool name and input\n * and the run ID.\n */\n handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, runName?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called if a Tool run encounters an error\n */\n handleToolError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n /**\n * Called at the end of a Tool run, with the tool output and the run ID.\n */\n handleToolEnd?(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n output: any, runId: string, parentRunId?: string, tags?: string[]): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n handleText?(text: string, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;\n /**\n * Called when an agent is about to execute an action,\n * with the action and the run ID.\n */\n handleAgentAction?(action: AgentAction, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;\n /**\n * Called when an agent finishes execution, before it exits.\n * with the final output and the run ID.\n */\n handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string, tags?: string[]): Promise<void> | void;\n handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string, tags?: string[], metadata?: Record<string, unknown>, name?: string): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n handleRetrieverEnd?(documents: DocumentInterface[], runId: string, parentRunId?: string, tags?: string[]): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n handleRetrieverError?(err: Error, runId: string, parentRunId?: string, tags?: string[]): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n handleCustomEvent?(eventName: string, \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any, runId: string, tags?: string[], \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n metadata?: Record<string, any>): // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Promise<any> | any;\n}\n/**\n * Base interface for callbacks. All methods are optional. If a method is not\n * implemented, it will be ignored. If a method is implemented, it will be\n * called at the appropriate time. All methods are called with the run ID of\n * the LLM/ChatModel/Chain that is running, which is generated by the\n * CallbackManager.\n *\n * @interface\n */\nexport type CallbackHandlerMethods = BaseCallbackHandlerMethodsClass;\n/**\n * Interface for handlers that can indicate a preference for streaming responses.\n * When implemented, this allows the handler to signal whether it prefers to receive\n * streaming responses from language models rather than complete responses.\n */\nexport interface CallbackHandlerPrefersStreaming {\n readonly lc_prefer_streaming: boolean;\n}\nexport declare function callbackHandlerPrefersStreaming(x: BaseCallbackHandler): unknown;\n/**\n * Abstract base class for creating callback handlers in the LangChain\n * framework. It provides a set of optional methods that can be overridden\n * in derived classes to handle various events during the execution of a\n * LangChain application.\n */\nexport declare abstract class BaseCallbackHandler extends BaseCallbackHandlerMethodsClass implements BaseCallbackHandlerInput, Serializable {\n lc_serializable: boolean;\n get lc_namespace(): [\"langchain_core\", \"callbacks\", string];\n get lc_secrets(): {\n [key: string]: string;\n } | undefined;\n get lc_attributes(): {\n [key: string]: string;\n } | undefined;\n get lc_aliases(): {\n [key: string]: string;\n } | undefined;\n get lc_serializable_keys(): string[] | undefined;\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 lc_kwargs: SerializedFields;\n abstract name: string;\n ignoreLLM: boolean;\n ignoreChain: boolean;\n ignoreAgent: boolean;\n ignoreRetriever: boolean;\n ignoreCustomEvent: boolean;\n raiseError: boolean;\n awaitHandlers: boolean;\n constructor(input?: BaseCallbackHandlerInput);\n copy(): BaseCallbackHandler;\n toJSON(): Serialized;\n toJSONNotImplemented(): SerializedNotImplemented;\n static fromMethods(methods: CallbackHandlerMethods): {\n /**\n * Called at the start of an LLM or Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleLLMStart?(llm: Serialized, prompts: string[], runId: string, parentRunId?: string | undefined, extraParams?: Record<string, unknown> | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;\n /**\n * Called when an LLM/ChatModel in `streaming` mode produces a new token\n */\n handleLLMNewToken?(token: string, idx: NewTokenIndices, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, fields?: HandleLLMNewTokenCallbackFields | undefined): any;\n /**\n * Called if an LLM/ChatModel run encounters an error\n */\n handleLLMError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, extraParams?: Record<string, unknown> | undefined): any;\n /**\n * Called at the end of an LLM/ChatModel run, with the output and the run ID.\n */\n handleLLMEnd?(output: LLMResult, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, extraParams?: Record<string, unknown> | undefined): any;\n /**\n * Called at the start of a Chat Model run, with the prompt(s)\n * and the run ID.\n */\n handleChatModelStart?(llm: Serialized, messages: BaseMessage<import(\"../messages/message.js\").MessageStructure, import(\"../messages/message.js\").MessageType>[][], runId: string, parentRunId?: string | undefined, extraParams?: Record<string, unknown> | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;\n /**\n * Called at the start of a Chain run, with the chain name and inputs\n * and the run ID.\n */\n handleChainStart?(chain: Serialized, inputs: ChainValues, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runType?: string | undefined, runName?: string | undefined): any;\n /**\n * Called if a Chain run encounters an error\n */\n handleChainError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, kwargs?: {\n inputs?: Record<string, unknown> | undefined;\n } | undefined): any;\n /**\n * Called at the end of a Chain run, with the outputs and the run ID.\n */\n handleChainEnd?(outputs: ChainValues, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, kwargs?: {\n inputs?: Record<string, unknown> | undefined;\n } | undefined): any;\n /**\n * Called at the start of a Tool run, with the tool name and input\n * and the run ID.\n */\n handleToolStart?(tool: Serialized, input: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, runName?: string | undefined): any;\n /**\n * Called if a Tool run encounters an error\n */\n handleToolError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;\n /**\n * Called at the end of a Tool run, with the tool output and the run ID.\n */\n handleToolEnd?(output: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;\n handleText?(text: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;\n /**\n * Called when an agent is about to execute an action,\n * with the action and the run ID.\n */\n handleAgentAction?(action: AgentAction, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;\n /**\n * Called when an agent finishes execution, before it exits.\n * with the final output and the run ID.\n */\n handleAgentEnd?(action: AgentFinish, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): void | Promise<void>;\n handleRetrieverStart?(retriever: Serialized, query: string, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined, metadata?: Record<string, unknown> | undefined, name?: string | undefined): any;\n handleRetrieverEnd?(documents: DocumentInterface<Record<string, any>>[], runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;\n handleRetrieverError?(err: any, runId: string, parentRunId?: string | undefined, tags?: string[] | undefined): any;\n handleCustomEvent?(eventName: string, data: any, runId: string, tags?: string[] | undefined, metadata?: Record<string, any> | undefined): any;\n lc_serializable: boolean;\n readonly lc_namespace: [\"langchain_core\", \"callbacks\", string];\n readonly lc_secrets: {\n [key: string]: string;\n } | undefined;\n readonly lc_attributes: {\n [key: string]: string;\n } | undefined;\n readonly lc_aliases: {\n [key: string]: string;\n } | undefined;\n readonly lc_serializable_keys: string[] | undefined;\n /**\n * The final serialized identifier for the module.\n */\n readonly lc_id: string[];\n lc_kwargs: SerializedFields;\n ignoreLLM: boolean;\n ignoreChain: boolean;\n ignoreAgent: boolean;\n ignoreRetriever: boolean;\n ignoreCustomEvent: boolean;\n raiseError: boolean;\n awaitHandlers: boolean;\n copy(): BaseCallbackHandler;\n toJSON(): Serialized;\n toJSONNotImplemented(): SerializedNotImplemented;\n name: string;\n };\n}\nexport declare const isBaseCallbackHandler: (x: unknown) => boolean;\nexport {};\n"],"mappings":";;;;;;;;;;;KAQKY,KAAAA;;AAF6D;AAQlE;AAaA;AAKA;AAA2C,UAlB1BC,wBAAAA,CAkB0B;EAAA,SAC/BR,CAAAA,EAAAA,OAAAA;EAAe,WAAGD,CAAAA,EAAAA,OAAAA;EAAmB,WAAA,CAAA,EAAA,OAAA;EAO1BY,eAAAA,CAAAA,EAAAA,OAAAA;EAA+B,iBAAA,CAAA,EAAA,OAAA;EAAA,aAK7BR,CAAAA,EAAAA,OAAAA;EAAU,UAAwES,CAAAA,EAAAA,OAAAA;;;;;;AAiBlFL,UAnCRE,eAAAA,CAmCQF;EAAK,MAAsEK,EAAAA,MAAAA;EAAM,UACtGC,EAAAA,MAAAA;;;AAKAA,KApCQH,+BAAAA,GAoCRG;EAAO,KAKoBV,CAAAA,EAxCnBH,eAwCmBG,GAxCDJ,mBAwCCI;CAAU;;;;;;uBAjClBQ,+BAAAA,CAuCwGC;EAAM;;;;EAQ1H,cAIkBjB,CAAAA,CAAAA,GAAAA,EA9CJQ,UA8CIR,EAAAA,OAAAA,EAAAA,MAAAA,EAAAA,EAAAA,KAAAA,EAAAA,MAAAA,EAAAA,WAAAA,CAAAA,EAAAA,MAAAA,EAAAA,WAAAA,CAAAA,EA9C8EiB,MA8C9EjB,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA,CAAAA,EAAAA,MAAAA,EAAAA,EAAAA,QAAAA,CAAAA,EA9CmIiB,MA8CnIjB,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,CAAAA,EAAAA,MAAAA,CAAAA;EAAAA;EA7CzBkB,OA8CaD,CAAAA,GAAAA,CAAAA,GAAAA,GAAAA;EAAM;;;EAOsG,iBAC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AA,EAAAA,MAAAA,EAAAA,WAAAA,CAAAA,EAAAA,MAAAA,EAAAA,IAAAA,CAAAA,EAAAA,MAAAA,EAAAA,CAAAA,EA5C5BW,OA4C4BX,CAAAA,IAAAA,CAAAA,GAAAA,IAAAA;EAAY;AAuI3I;;;0BA9K4BJ,oEAAoEe;mCAC3DV,4FAA4FS;;EAC7HC;iCAC+BP;;EAC/BO;6BAC2BN;;EAC3BM;;;;;aAKWD;;EACXC;;;;;;;;;;;KAWQC,sBAAAA,GAAyBH;;;;;;UAMpBI,+BAAAA;;;iBAGOC,+BAAAA,IAAmCC;;;;;;;uBAO7BA,mBAAAA,SAA4BN,+BAAAA,YAA2CH,0BAA0BN;;;;;;;;;;;;;;;;;;;;;;;;aAwBhHG;;;;;;;;;sBASSG;UACZS;YACEd;0BACcC;8BACIU;;;;;yBAKHX,8FAA8FS,6EAA6EA;;;;2CAIzJH,wGAAwGC;;;;0HAIzBE;;;;0BAIhGX,uGAAuGW;;;;;+BAKlGT,sBAAsBP,YAAZ,gBAAA,EAAyE,WAAA,sEAAoHgB,6EAA6EA;;;;;6BAKtRT,oBAAoBR,sGAAsGiB;;;;;eAKtIA;;;;;6BAKYjB;eACZiB;;;;;;2BAMUT,oHAAoHS;;;;;;;;;oHAS3BC;;;;;+BAKrFhB,mGAAmGgB;;;;;4BAKtGf,mGAAmGe;qCAC1FV,oHAAoHS;mCACtHN,kBAAkBM;;4GAEuDA;;;;;;;;;;;;;;;;;eAiB7FP;;;;;;;;YAQHY;cACEd;4BACcC;;;;cAIXiB"}
@@ -6,8 +6,6 @@ const require_callbacks_dispatch_web = require('./web.cjs');
6
6
  const node_async_hooks = require_rolldown_runtime.__toESM(require("node:async_hooks"));
7
7
 
8
8
  //#region src/callbacks/dispatch/index.ts
9
- var dispatch_exports = {};
10
- require_rolldown_runtime.__export(dispatch_exports, { dispatchCustomEvent: () => dispatchCustomEvent$1 });
11
9
  require_index.AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new node_async_hooks.AsyncLocalStorage());
12
10
  /**
13
11
  * Dispatch a custom event.
@@ -49,10 +47,4 @@ async function dispatchCustomEvent$1(eventName, payload, config) {
49
47
 
50
48
  //#endregion
51
49
  exports.dispatchCustomEvent = dispatchCustomEvent$1;
52
- Object.defineProperty(exports, 'dispatch_exports', {
53
- enumerable: true,
54
- get: function () {
55
- return dispatch_exports;
56
- }
57
- });
58
50
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["AsyncLocalStorageProviderSingleton","AsyncLocalStorage","dispatchCustomEvent","eventName: string","payload: any","config?: RunnableConfig","ensureConfig","dispatchCustomEventWeb"],"sources":["../../../src/callbacks/dispatch/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { dispatchCustomEvent as dispatchCustomEventWeb } from \"./web.js\";\nimport { type RunnableConfig, ensureConfig } from \"../../runnables/config.js\";\nimport { AsyncLocalStorageProviderSingleton } from \"../../singletons/index.js\";\n\nAsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n);\n\n/**\n * Dispatch a custom event.\n *\n * Note: this method is only supported in non-web environments\n * due to usage of async_hooks to infer config.\n *\n * If you are using this method in the browser, please import and use\n * from \"@langchain/core/callbacks/dispatch/web\".\n *\n * @param name The name of the custom event.\n * @param payload The data for the custom event.\n * Ideally should be JSON serializable to avoid serialization issues downstream, but not enforced.\n * @param config Optional config object.\n *\n * @example\n * ```typescript\n * import { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\n *\n * const foo = RunnableLambda.from(async (input: string) => {\n * await dispatchCustomEvent(\"my_custom_event\", { arbitraryField: \"someval\" });\n * return input;\n * });\n *\n * const callbacks = [{\n * handleCustomEvent: (eventName: string, payload: any) => {\n * // Logs \"my_custom_event\" and { arbitraryField: \"someval\" }\n * console.log(eventName, payload);\n * }\n * }];\n *\n * await foo.invoke(\"hi\", { callbacks })\n * ```\n */\nexport async function dispatchCustomEvent(\n eventName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload: any,\n config?: RunnableConfig\n) {\n const ensuredConfig = ensureConfig(config);\n await dispatchCustomEventWeb(eventName, payload, ensuredConfig);\n}\n"],"mappings":";;;;;;;;;;AAOAA,iDAAmC,yBACjC,IAAIC,qCACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,eAAsBC,sBACpBC,WAEAC,SACAC,QACA;CACA,MAAM,gBAAgBC,4BAAa,OAAO;CAC1C,MAAMC,mDAAuB,WAAW,SAAS,cAAc;AAChE"}
1
+ {"version":3,"file":"index.cjs","names":["AsyncLocalStorageProviderSingleton","AsyncLocalStorage","dispatchCustomEvent","eventName: string","payload: any","config?: RunnableConfig","ensureConfig","dispatchCustomEventWeb"],"sources":["../../../src/callbacks/dispatch/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { dispatchCustomEvent as dispatchCustomEventWeb } from \"./web.js\";\nimport { type RunnableConfig, ensureConfig } from \"../../runnables/config.js\";\nimport { AsyncLocalStorageProviderSingleton } from \"../../singletons/index.js\";\n\nAsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n);\n\n/**\n * Dispatch a custom event.\n *\n * Note: this method is only supported in non-web environments\n * due to usage of async_hooks to infer config.\n *\n * If you are using this method in the browser, please import and use\n * from \"@langchain/core/callbacks/dispatch/web\".\n *\n * @param name The name of the custom event.\n * @param payload The data for the custom event.\n * Ideally should be JSON serializable to avoid serialization issues downstream, but not enforced.\n * @param config Optional config object.\n *\n * @example\n * ```typescript\n * import { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\n *\n * const foo = RunnableLambda.from(async (input: string) => {\n * await dispatchCustomEvent(\"my_custom_event\", { arbitraryField: \"someval\" });\n * return input;\n * });\n *\n * const callbacks = [{\n * handleCustomEvent: (eventName: string, payload: any) => {\n * // Logs \"my_custom_event\" and { arbitraryField: \"someval\" }\n * console.log(eventName, payload);\n * }\n * }];\n *\n * await foo.invoke(\"hi\", { callbacks })\n * ```\n */\nexport async function dispatchCustomEvent(\n eventName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload: any,\n config?: RunnableConfig\n) {\n const ensuredConfig = ensureConfig(config);\n await dispatchCustomEventWeb(eventName, payload, ensuredConfig);\n}\n"],"mappings":";;;;;;;;AAOAA,iDAAmC,yBACjC,IAAIC,qCACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,eAAsBC,sBACpBC,WAEAC,SACAC,QACA;CACA,MAAM,gBAAgBC,4BAAa,OAAO;CAC1C,MAAMC,mDAAuB,WAAW,SAAS,cAAc;AAChE"}
@@ -1,4 +1,3 @@
1
- import { __export } from "../../_virtual/rolldown_runtime.js";
2
1
  import { AsyncLocalStorageProviderSingleton } from "../../singletons/async_local_storage/index.js";
3
2
  import "../../singletons/index.js";
4
3
  import { ensureConfig } from "../../runnables/config.js";
@@ -6,8 +5,6 @@ import { dispatchCustomEvent } from "./web.js";
6
5
  import { AsyncLocalStorage } from "node:async_hooks";
7
6
 
8
7
  //#region src/callbacks/dispatch/index.ts
9
- var dispatch_exports = {};
10
- __export(dispatch_exports, { dispatchCustomEvent: () => dispatchCustomEvent$1 });
11
8
  AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new AsyncLocalStorage());
12
9
  /**
13
10
  * Dispatch a custom event.
@@ -48,5 +45,5 @@ async function dispatchCustomEvent$1(eventName, payload, config) {
48
45
  }
49
46
 
50
47
  //#endregion
51
- export { dispatchCustomEvent$1 as dispatchCustomEvent, dispatch_exports };
48
+ export { dispatchCustomEvent$1 as dispatchCustomEvent };
52
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["dispatchCustomEvent","eventName: string","payload: any","config?: RunnableConfig","dispatchCustomEventWeb"],"sources":["../../../src/callbacks/dispatch/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { dispatchCustomEvent as dispatchCustomEventWeb } from \"./web.js\";\nimport { type RunnableConfig, ensureConfig } from \"../../runnables/config.js\";\nimport { AsyncLocalStorageProviderSingleton } from \"../../singletons/index.js\";\n\nAsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n);\n\n/**\n * Dispatch a custom event.\n *\n * Note: this method is only supported in non-web environments\n * due to usage of async_hooks to infer config.\n *\n * If you are using this method in the browser, please import and use\n * from \"@langchain/core/callbacks/dispatch/web\".\n *\n * @param name The name of the custom event.\n * @param payload The data for the custom event.\n * Ideally should be JSON serializable to avoid serialization issues downstream, but not enforced.\n * @param config Optional config object.\n *\n * @example\n * ```typescript\n * import { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\n *\n * const foo = RunnableLambda.from(async (input: string) => {\n * await dispatchCustomEvent(\"my_custom_event\", { arbitraryField: \"someval\" });\n * return input;\n * });\n *\n * const callbacks = [{\n * handleCustomEvent: (eventName: string, payload: any) => {\n * // Logs \"my_custom_event\" and { arbitraryField: \"someval\" }\n * console.log(eventName, payload);\n * }\n * }];\n *\n * await foo.invoke(\"hi\", { callbacks })\n * ```\n */\nexport async function dispatchCustomEvent(\n eventName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload: any,\n config?: RunnableConfig\n) {\n const ensuredConfig = ensureConfig(config);\n await dispatchCustomEventWeb(eventName, payload, ensuredConfig);\n}\n"],"mappings":";;;;;;;;;;AAOA,mCAAmC,yBACjC,IAAI,oBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,eAAsBA,sBACpBC,WAEAC,SACAC,QACA;CACA,MAAM,gBAAgB,aAAa,OAAO;CAC1C,MAAMC,oBAAuB,WAAW,SAAS,cAAc;AAChE"}
1
+ {"version":3,"file":"index.js","names":["dispatchCustomEvent","eventName: string","payload: any","config?: RunnableConfig","dispatchCustomEventWeb"],"sources":["../../../src/callbacks/dispatch/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { dispatchCustomEvent as dispatchCustomEventWeb } from \"./web.js\";\nimport { type RunnableConfig, ensureConfig } from \"../../runnables/config.js\";\nimport { AsyncLocalStorageProviderSingleton } from \"../../singletons/index.js\";\n\nAsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n);\n\n/**\n * Dispatch a custom event.\n *\n * Note: this method is only supported in non-web environments\n * due to usage of async_hooks to infer config.\n *\n * If you are using this method in the browser, please import and use\n * from \"@langchain/core/callbacks/dispatch/web\".\n *\n * @param name The name of the custom event.\n * @param payload The data for the custom event.\n * Ideally should be JSON serializable to avoid serialization issues downstream, but not enforced.\n * @param config Optional config object.\n *\n * @example\n * ```typescript\n * import { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\n *\n * const foo = RunnableLambda.from(async (input: string) => {\n * await dispatchCustomEvent(\"my_custom_event\", { arbitraryField: \"someval\" });\n * return input;\n * });\n *\n * const callbacks = [{\n * handleCustomEvent: (eventName: string, payload: any) => {\n * // Logs \"my_custom_event\" and { arbitraryField: \"someval\" }\n * console.log(eventName, payload);\n * }\n * }];\n *\n * await foo.invoke(\"hi\", { callbacks })\n * ```\n */\nexport async function dispatchCustomEvent(\n eventName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload: any,\n config?: RunnableConfig\n) {\n const ensuredConfig = ensureConfig(config);\n await dispatchCustomEventWeb(eventName, payload, ensuredConfig);\n}\n"],"mappings":";;;;;;;AAOA,mCAAmC,yBACjC,IAAI,oBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,eAAsBA,sBACpBC,WAEAC,SACAC,QACA;CACA,MAAM,gBAAgB,aAAa,OAAO;CAC1C,MAAMC,oBAAuB,WAAW,SAAS,cAAc;AAChE"}
@@ -1,9 +1,6 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
1
  const require_config = require('../../runnables/config.cjs');
3
2
 
4
3
  //#region src/callbacks/dispatch/web.ts
5
- var web_exports = {};
6
- require_rolldown_runtime.__export(web_exports, { dispatchCustomEvent: () => dispatchCustomEvent });
7
4
  /**
8
5
  * Dispatch a custom event. Requires an explicit config object.
9
6
  * @param name The name of the custom event.
@@ -53,10 +50,4 @@ async function dispatchCustomEvent(name, payload, config) {
53
50
 
54
51
  //#endregion
55
52
  exports.dispatchCustomEvent = dispatchCustomEvent;
56
- Object.defineProperty(exports, 'web_exports', {
57
- enumerable: true,
58
- get: function () {
59
- return web_exports;
60
- }
61
- });
62
53
  //# sourceMappingURL=web.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.cjs","names":["name: string","payload: any","config?: RunnableConfig","getCallbackManagerForConfig"],"sources":["../../../src/callbacks/dispatch/web.ts"],"sourcesContent":["import {\n type RunnableConfig,\n getCallbackManagerForConfig,\n} from \"../../runnables/config.js\";\n\n/**\n * Dispatch a custom event. Requires an explicit config object.\n * @param name The name of the custom event.\n * @param payload The data for the custom event.\n * Ideally should be JSON serializable to avoid serialization issues downstream, but not enforced.\n * @param config Config object.\n *\n * @example\n * ```typescript\n * import { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\n *\n * const foo = RunnableLambda.from(async (input: string, config?: RunnableConfig) => {\n * await dispatchCustomEvent(\n * \"my_custom_event\",\n * { arbitraryField: \"someval\" },\n * config\n * );\n * return input;\n * });\n *\n * const callbacks = [{\n * handleCustomEvent: (eventName: string, payload: any) => {\n * // Logs \"my_custom_event\" and { arbitraryField: \"someval\" }\n * console.log(eventName, payload);\n * }\n * }];\n *\n * await foo.invoke(\"hi\", { callbacks })\n * ```\n */\nexport async function dispatchCustomEvent(\n name: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload: any,\n config?: RunnableConfig\n) {\n if (config === undefined) {\n throw new Error(\n [\n \"Unable to dispatch a custom event without a parent run id.\",\n `\"dispatchCustomEvent\" can only be called from within an existing run (e.g.,`,\n \"inside a tool or a RunnableLambda).\",\n `\\n\\nIf you continue to see this error, please import from \"@langchain/core/callbacks/dispatch/web\"`,\n \"and explicitly pass in a config parameter.\",\n `\\n\\nOr, if you are calling this from a custom tool, ensure you're using the \"tool\" helper constructor as documented here:`,\n \"\\n |\",\n \"\\n └-> https://js.langchain.com/docs/how_to/custom_tools#tool-function\",\n \"\\n\",\n ].join(\" \")\n );\n }\n const callbackManager = await getCallbackManagerForConfig(config);\n const parentRunId = callbackManager?.getParentRunId();\n // We pass parent id as the current run id here intentionally since events dispatch\n // from within things like RunnableLambda\n if (callbackManager !== undefined && parentRunId !== undefined) {\n await callbackManager.handleCustomEvent?.(name, payload, parentRunId);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,eAAsB,oBACpBA,MAEAC,SACAC,QACA;AACA,KAAI,WAAW,OACb,OAAM,IAAI,MACR;EACE;EACA,CAAC,2EAA2E,CAAC;EAC7E;EACA,CAAC,kGAAkG,CAAC;EACpG;EACA,CAAC,yHAAyH,CAAC;EAC3H;EACA;EACA;CACD,EAAC,KAAK,IAAI;CAGf,MAAM,kBAAkB,MAAMC,2CAA4B,OAAO;CACjE,MAAM,cAAc,iBAAiB,gBAAgB;AAGrD,KAAI,oBAAoB,UAAa,gBAAgB,QACnD,MAAM,gBAAgB,oBAAoB,MAAM,SAAS,YAAY;AAExE"}
1
+ {"version":3,"file":"web.cjs","names":["name: string","payload: any","config?: RunnableConfig","getCallbackManagerForConfig"],"sources":["../../../src/callbacks/dispatch/web.ts"],"sourcesContent":["import {\n type RunnableConfig,\n getCallbackManagerForConfig,\n} from \"../../runnables/config.js\";\n\n/**\n * Dispatch a custom event. Requires an explicit config object.\n * @param name The name of the custom event.\n * @param payload The data for the custom event.\n * Ideally should be JSON serializable to avoid serialization issues downstream, but not enforced.\n * @param config Config object.\n *\n * @example\n * ```typescript\n * import { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\n *\n * const foo = RunnableLambda.from(async (input: string, config?: RunnableConfig) => {\n * await dispatchCustomEvent(\n * \"my_custom_event\",\n * { arbitraryField: \"someval\" },\n * config\n * );\n * return input;\n * });\n *\n * const callbacks = [{\n * handleCustomEvent: (eventName: string, payload: any) => {\n * // Logs \"my_custom_event\" and { arbitraryField: \"someval\" }\n * console.log(eventName, payload);\n * }\n * }];\n *\n * await foo.invoke(\"hi\", { callbacks })\n * ```\n */\nexport async function dispatchCustomEvent(\n name: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload: any,\n config?: RunnableConfig\n) {\n if (config === undefined) {\n throw new Error(\n [\n \"Unable to dispatch a custom event without a parent run id.\",\n `\"dispatchCustomEvent\" can only be called from within an existing run (e.g.,`,\n \"inside a tool or a RunnableLambda).\",\n `\\n\\nIf you continue to see this error, please import from \"@langchain/core/callbacks/dispatch/web\"`,\n \"and explicitly pass in a config parameter.\",\n `\\n\\nOr, if you are calling this from a custom tool, ensure you're using the \"tool\" helper constructor as documented here:`,\n \"\\n |\",\n \"\\n └-> https://js.langchain.com/docs/how_to/custom_tools#tool-function\",\n \"\\n\",\n ].join(\" \")\n );\n }\n const callbackManager = await getCallbackManagerForConfig(config);\n const parentRunId = callbackManager?.getParentRunId();\n // We pass parent id as the current run id here intentionally since events dispatch\n // from within things like RunnableLambda\n if (callbackManager !== undefined && parentRunId !== undefined) {\n await callbackManager.handleCustomEvent?.(name, payload, parentRunId);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,eAAsB,oBACpBA,MAEAC,SACAC,QACA;AACA,KAAI,WAAW,OACb,OAAM,IAAI,MACR;EACE;EACA,CAAC,2EAA2E,CAAC;EAC7E;EACA,CAAC,kGAAkG,CAAC;EACpG;EACA,CAAC,yHAAyH,CAAC;EAC3H;EACA;EACA;CACD,EAAC,KAAK,IAAI;CAGf,MAAM,kBAAkB,MAAMC,2CAA4B,OAAO;CACjE,MAAM,cAAc,iBAAiB,gBAAgB;AAGrD,KAAI,oBAAoB,UAAa,gBAAgB,QACnD,MAAM,gBAAgB,oBAAoB,MAAM,SAAS,YAAY;AAExE"}
@@ -1,9 +1,6 @@
1
- import { __export } from "../../_virtual/rolldown_runtime.js";
2
1
  import { getCallbackManagerForConfig } from "../../runnables/config.js";
3
2
 
4
3
  //#region src/callbacks/dispatch/web.ts
5
- var web_exports = {};
6
- __export(web_exports, { dispatchCustomEvent: () => dispatchCustomEvent });
7
4
  /**
8
5
  * Dispatch a custom event. Requires an explicit config object.
9
6
  * @param name The name of the custom event.
@@ -52,5 +49,5 @@ async function dispatchCustomEvent(name, payload, config) {
52
49
  }
53
50
 
54
51
  //#endregion
55
- export { dispatchCustomEvent, web_exports };
52
+ export { dispatchCustomEvent };
56
53
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","names":["name: string","payload: any","config?: RunnableConfig"],"sources":["../../../src/callbacks/dispatch/web.ts"],"sourcesContent":["import {\n type RunnableConfig,\n getCallbackManagerForConfig,\n} from \"../../runnables/config.js\";\n\n/**\n * Dispatch a custom event. Requires an explicit config object.\n * @param name The name of the custom event.\n * @param payload The data for the custom event.\n * Ideally should be JSON serializable to avoid serialization issues downstream, but not enforced.\n * @param config Config object.\n *\n * @example\n * ```typescript\n * import { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\n *\n * const foo = RunnableLambda.from(async (input: string, config?: RunnableConfig) => {\n * await dispatchCustomEvent(\n * \"my_custom_event\",\n * { arbitraryField: \"someval\" },\n * config\n * );\n * return input;\n * });\n *\n * const callbacks = [{\n * handleCustomEvent: (eventName: string, payload: any) => {\n * // Logs \"my_custom_event\" and { arbitraryField: \"someval\" }\n * console.log(eventName, payload);\n * }\n * }];\n *\n * await foo.invoke(\"hi\", { callbacks })\n * ```\n */\nexport async function dispatchCustomEvent(\n name: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload: any,\n config?: RunnableConfig\n) {\n if (config === undefined) {\n throw new Error(\n [\n \"Unable to dispatch a custom event without a parent run id.\",\n `\"dispatchCustomEvent\" can only be called from within an existing run (e.g.,`,\n \"inside a tool or a RunnableLambda).\",\n `\\n\\nIf you continue to see this error, please import from \"@langchain/core/callbacks/dispatch/web\"`,\n \"and explicitly pass in a config parameter.\",\n `\\n\\nOr, if you are calling this from a custom tool, ensure you're using the \"tool\" helper constructor as documented here:`,\n \"\\n |\",\n \"\\n └-> https://js.langchain.com/docs/how_to/custom_tools#tool-function\",\n \"\\n\",\n ].join(\" \")\n );\n }\n const callbackManager = await getCallbackManagerForConfig(config);\n const parentRunId = callbackManager?.getParentRunId();\n // We pass parent id as the current run id here intentionally since events dispatch\n // from within things like RunnableLambda\n if (callbackManager !== undefined && parentRunId !== undefined) {\n await callbackManager.handleCustomEvent?.(name, payload, parentRunId);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,eAAsB,oBACpBA,MAEAC,SACAC,QACA;AACA,KAAI,WAAW,OACb,OAAM,IAAI,MACR;EACE;EACA,CAAC,2EAA2E,CAAC;EAC7E;EACA,CAAC,kGAAkG,CAAC;EACpG;EACA,CAAC,yHAAyH,CAAC;EAC3H;EACA;EACA;CACD,EAAC,KAAK,IAAI;CAGf,MAAM,kBAAkB,MAAM,4BAA4B,OAAO;CACjE,MAAM,cAAc,iBAAiB,gBAAgB;AAGrD,KAAI,oBAAoB,UAAa,gBAAgB,QACnD,MAAM,gBAAgB,oBAAoB,MAAM,SAAS,YAAY;AAExE"}
1
+ {"version":3,"file":"web.js","names":["name: string","payload: any","config?: RunnableConfig"],"sources":["../../../src/callbacks/dispatch/web.ts"],"sourcesContent":["import {\n type RunnableConfig,\n getCallbackManagerForConfig,\n} from \"../../runnables/config.js\";\n\n/**\n * Dispatch a custom event. Requires an explicit config object.\n * @param name The name of the custom event.\n * @param payload The data for the custom event.\n * Ideally should be JSON serializable to avoid serialization issues downstream, but not enforced.\n * @param config Config object.\n *\n * @example\n * ```typescript\n * import { dispatchCustomEvent } from \"@langchain/core/callbacks/dispatch\";\n *\n * const foo = RunnableLambda.from(async (input: string, config?: RunnableConfig) => {\n * await dispatchCustomEvent(\n * \"my_custom_event\",\n * { arbitraryField: \"someval\" },\n * config\n * );\n * return input;\n * });\n *\n * const callbacks = [{\n * handleCustomEvent: (eventName: string, payload: any) => {\n * // Logs \"my_custom_event\" and { arbitraryField: \"someval\" }\n * console.log(eventName, payload);\n * }\n * }];\n *\n * await foo.invoke(\"hi\", { callbacks })\n * ```\n */\nexport async function dispatchCustomEvent(\n name: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload: any,\n config?: RunnableConfig\n) {\n if (config === undefined) {\n throw new Error(\n [\n \"Unable to dispatch a custom event without a parent run id.\",\n `\"dispatchCustomEvent\" can only be called from within an existing run (e.g.,`,\n \"inside a tool or a RunnableLambda).\",\n `\\n\\nIf you continue to see this error, please import from \"@langchain/core/callbacks/dispatch/web\"`,\n \"and explicitly pass in a config parameter.\",\n `\\n\\nOr, if you are calling this from a custom tool, ensure you're using the \"tool\" helper constructor as documented here:`,\n \"\\n |\",\n \"\\n └-> https://js.langchain.com/docs/how_to/custom_tools#tool-function\",\n \"\\n\",\n ].join(\" \")\n );\n }\n const callbackManager = await getCallbackManagerForConfig(config);\n const parentRunId = callbackManager?.getParentRunId();\n // We pass parent id as the current run id here intentionally since events dispatch\n // from within things like RunnableLambda\n if (callbackManager !== undefined && parentRunId !== undefined) {\n await callbackManager.handleCustomEvent?.(name, payload, parentRunId);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,eAAsB,oBACpBA,MAEAC,SACAC,QACA;AACA,KAAI,WAAW,OACb,OAAM,IAAI,MACR;EACE;EACA,CAAC,2EAA2E,CAAC;EAC7E;EACA,CAAC,kGAAkG,CAAC;EACpG;EACA,CAAC,yHAAyH,CAAC;EAC3H;EACA;EACA;CACD,EAAC,KAAK,IAAI;CAGf,MAAM,kBAAkB,MAAM,4BAA4B,OAAO;CACjE,MAAM,cAAc,iBAAiB,gBAAgB;AAGrD,KAAI,oBAAoB,UAAa,gBAAgB,QACnD,MAAM,gBAAgB,oBAAoB,MAAM,SAAS,YAAY;AAExE"}
package/dist/context.cjs CHANGED
@@ -5,23 +5,10 @@ require('./singletons/index.cjs');
5
5
  const node_async_hooks = require_rolldown_runtime.__toESM(require("node:async_hooks"));
6
6
 
7
7
  //#region src/context.ts
8
- var context_exports = {};
9
- require_rolldown_runtime.__export(context_exports, {
10
- foo: () => foo,
11
- getContextVariable: () => require_context.getContextVariable,
12
- registerConfigureHook: () => require_context.registerConfigureHook,
13
- setContextVariable: () => require_context.setContextVariable
14
- });
15
8
  require_index.AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new node_async_hooks.AsyncLocalStorage());
16
9
  const foo = "bar";
17
10
 
18
11
  //#endregion
19
- Object.defineProperty(exports, 'context_exports', {
20
- enumerable: true,
21
- get: function () {
22
- return context_exports;
23
- }
24
- });
25
12
  exports.foo = foo;
26
13
  exports.getContextVariable = require_context.getContextVariable;
27
14
  exports.registerConfigureHook = require_context.registerConfigureHook;
@@ -1 +1 @@
1
- {"version":3,"file":"context.cjs","names":["AsyncLocalStorageProviderSingleton","AsyncLocalStorage"],"sources":["../src/context.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\n/**\n * This file exists as a convenient public entrypoint for functionality\n * related to context variables.\n *\n * Because it automatically initializes AsyncLocalStorage, internal\n * functionality SHOULD NEVER import from this file outside of tests.\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { AsyncLocalStorageProviderSingleton } from \"./singletons/index.js\";\nimport {\n getContextVariable,\n setContextVariable,\n type ConfigureHook,\n registerConfigureHook,\n} from \"./singletons/async_local_storage/context.js\";\n\nAsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n);\n\nexport {\n getContextVariable,\n setContextVariable,\n registerConfigureHook,\n type ConfigureHook,\n};\n\nexport const foo = \"bar\";\n"],"mappings":";;;;;;;;;;;;;;AAmBAA,iDAAmC,yBACjC,IAAIC,qCACL;AASD,MAAa,MAAM"}
1
+ {"version":3,"file":"context.cjs","names":["AsyncLocalStorageProviderSingleton","AsyncLocalStorage"],"sources":["../src/context.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\n/**\n * This file exists as a convenient public entrypoint for functionality\n * related to context variables.\n *\n * Because it automatically initializes AsyncLocalStorage, internal\n * functionality SHOULD NEVER import from this file outside of tests.\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { AsyncLocalStorageProviderSingleton } from \"./singletons/index.js\";\nimport {\n getContextVariable,\n setContextVariable,\n type ConfigureHook,\n registerConfigureHook,\n} from \"./singletons/async_local_storage/context.js\";\n\nAsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n);\n\nexport {\n getContextVariable,\n setContextVariable,\n registerConfigureHook,\n type ConfigureHook,\n};\n\nexport const foo = \"bar\";\n"],"mappings":";;;;;;;AAmBAA,iDAAmC,yBACjC,IAAIC,qCACL;AASD,MAAa,MAAM"}
package/dist/context.js CHANGED
@@ -1,20 +1,12 @@
1
- import { __export } from "./_virtual/rolldown_runtime.js";
2
1
  import { getContextVariable, registerConfigureHook, setContextVariable } from "./singletons/async_local_storage/context.js";
3
2
  import { AsyncLocalStorageProviderSingleton } from "./singletons/async_local_storage/index.js";
4
3
  import "./singletons/index.js";
5
4
  import { AsyncLocalStorage } from "node:async_hooks";
6
5
 
7
6
  //#region src/context.ts
8
- var context_exports = {};
9
- __export(context_exports, {
10
- foo: () => foo,
11
- getContextVariable: () => getContextVariable,
12
- registerConfigureHook: () => registerConfigureHook,
13
- setContextVariable: () => setContextVariable
14
- });
15
7
  AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new AsyncLocalStorage());
16
8
  const foo = "bar";
17
9
 
18
10
  //#endregion
19
- export { context_exports, foo, getContextVariable, registerConfigureHook, setContextVariable };
11
+ export { foo, getContextVariable, registerConfigureHook, setContextVariable };
20
12
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","names":[],"sources":["../src/context.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\n/**\n * This file exists as a convenient public entrypoint for functionality\n * related to context variables.\n *\n * Because it automatically initializes AsyncLocalStorage, internal\n * functionality SHOULD NEVER import from this file outside of tests.\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { AsyncLocalStorageProviderSingleton } from \"./singletons/index.js\";\nimport {\n getContextVariable,\n setContextVariable,\n type ConfigureHook,\n registerConfigureHook,\n} from \"./singletons/async_local_storage/context.js\";\n\nAsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n);\n\nexport {\n getContextVariable,\n setContextVariable,\n registerConfigureHook,\n type ConfigureHook,\n};\n\nexport const foo = \"bar\";\n"],"mappings":";;;;;;;;;;;;;;AAmBA,mCAAmC,yBACjC,IAAI,oBACL;AASD,MAAa,MAAM"}
1
+ {"version":3,"file":"context.js","names":[],"sources":["../src/context.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\n/**\n * This file exists as a convenient public entrypoint for functionality\n * related to context variables.\n *\n * Because it automatically initializes AsyncLocalStorage, internal\n * functionality SHOULD NEVER import from this file outside of tests.\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { AsyncLocalStorageProviderSingleton } from \"./singletons/index.js\";\nimport {\n getContextVariable,\n setContextVariable,\n type ConfigureHook,\n registerConfigureHook,\n} from \"./singletons/async_local_storage/context.js\";\n\nAsyncLocalStorageProviderSingleton.initializeGlobalInstance(\n new AsyncLocalStorage()\n);\n\nexport {\n getContextVariable,\n setContextVariable,\n registerConfigureHook,\n type ConfigureHook,\n};\n\nexport const foo = \"bar\";\n"],"mappings":";;;;;;AAmBA,mCAAmC,yBACjC,IAAI,oBACL;AASD,MAAa,MAAM"}
@@ -18,7 +18,6 @@ const require_utils_json_schema = require('../utils/json_schema.cjs');
18
18
  const require_runnables_graph = require('../runnables/graph.cjs');
19
19
  const require_messages_index = require('../messages/index.cjs');
20
20
  const require_chat_history = require('../chat_history.cjs');
21
- const require_context = require('../context.cjs');
22
21
  const require_embeddings = require('../embeddings.cjs');
23
22
  const require_index = require('../index.cjs');
24
23
  const require_memory = require('../memory.cjs');
@@ -37,8 +36,6 @@ const require_utils_tiktoken = require('../utils/tiktoken.cjs');
37
36
  const require_language_models_base = require('../language_models/base.cjs');
38
37
  const require_language_models_chat_models = require('../language_models/chat_models.cjs');
39
38
  const require_language_models_llms = require('../language_models/llms.cjs');
40
- const require_callbacks_dispatch_web = require('../callbacks/dispatch/web.cjs');
41
- const require_callbacks_dispatch_index = require('../callbacks/dispatch/index.cjs');
42
39
  const require_runnables_index = require('../runnables/index.cjs');
43
40
  const require_utils_json_patch = require('../utils/json_patch.cjs');
44
41
  const require_output_parsers_index = require('../output_parsers/index.cjs');
@@ -63,12 +60,9 @@ require_rolldown_runtime.__export(import_map_exports, {
63
60
  agents: () => require_agents.agents_exports,
64
61
  caches: () => require_caches_base.base_exports,
65
62
  callbacks__base: () => require_callbacks_base.base_exports,
66
- callbacks__dispatch: () => require_callbacks_dispatch_index.dispatch_exports,
67
- callbacks__dispatch__web: () => require_callbacks_dispatch_web.web_exports,
68
63
  callbacks__manager: () => require_callbacks_manager.manager_exports,
69
64
  callbacks__promises: () => require_callbacks_promises.promises_exports,
70
65
  chat_history: () => require_chat_history.chat_history_exports,
71
- context: () => require_context.context_exports,
72
66
  document_loaders__base: () => require_document_loaders_base.base_exports,
73
67
  document_loaders__langsmith: () => require_document_loaders_langsmith.langsmith_exports,
74
68
  documents: () => require_documents_index.documents_exports,
@@ -1 +1 @@
1
- {"version":3,"file":"import_map.cjs","names":[],"sources":["../../src/load/import_map.ts"],"sourcesContent":["// Auto-generated by import-map plugin. Do not edit manually.\n\nexport * as index from \"../index.js\";\nexport * as agents from \"../agents.js\";\nexport * as caches from \"../caches/base.js\";\nexport * as callbacks__base from \"../callbacks/base.js\";\nexport * as callbacks__dispatch from \"../callbacks/dispatch/index.js\";\nexport * as callbacks__dispatch__web from \"../callbacks/dispatch/web.js\";\nexport * as callbacks__manager from \"../callbacks/manager.js\";\nexport * as callbacks__promises from \"../callbacks/promises.js\";\nexport * as chat_history from \"../chat_history.js\";\nexport * as context from \"../context.js\";\nexport * as documents from \"../documents/index.js\";\nexport * as document_loaders__base from \"../document_loaders/base.js\";\nexport * as document_loaders__langsmith from \"../document_loaders/langsmith.js\";\nexport * as embeddings from \"../embeddings.js\";\nexport * as example_selectors from \"../example_selectors/index.js\";\nexport * as indexing from \"../indexing/index.js\";\nexport * as language_models__base from \"../language_models/base.js\";\nexport * as language_models__chat_models from \"../language_models/chat_models.js\";\nexport * as language_models__llms from \"../language_models/llms.js\";\nexport * as load__serializable from \"../load/serializable.js\";\nexport * as memory from \"../memory.js\";\nexport * as messages from \"../messages/index.js\";\nexport * as messages__tool from \"../messages/tool.js\";\nexport * as output_parsers from \"../output_parsers/index.js\";\nexport * as output_parsers__openai_tools from \"../output_parsers/openai_tools/index.js\";\nexport * as output_parsers__openai_functions from \"../output_parsers/openai_functions/index.js\";\nexport * as outputs from \"../outputs.js\";\nexport * as prompts from \"../prompts/index.js\";\nexport * as prompt_values from \"../prompt_values.js\";\nexport * as runnables from \"../runnables/index.js\";\nexport * as runnables__graph from \"../runnables/graph.js\";\nexport * as retrievers from \"../retrievers/index.js\";\nexport * as retrievers__document_compressors from \"../retrievers/document_compressors/base.js\";\nexport * as singletons from \"../singletons/index.js\";\nexport * as stores from \"../stores.js\";\nexport * as structured_query from \"../structured_query/index.js\";\nexport * as tools from \"../tools/index.js\";\nexport * as tracers__base from \"../tracers/base.js\";\nexport * as tracers__console from \"../tracers/console.js\";\nexport * as tracers__log_stream from \"../tracers/log_stream.js\";\nexport * as tracers__run_collector from \"../tracers/run_collector.js\";\nexport * as tracers__tracer_langchain from \"../tracers/tracer_langchain.js\";\nexport * as types__stream from \"../types/stream.js\";\nexport * as utils__async_caller from \"../utils/async_caller.js\";\nexport * as utils__chunk_array from \"../utils/chunk_array.js\";\nexport * as utils__env from \"../utils/env.js\";\nexport * as utils__event_source_parse from \"../utils/event_source_parse.js\";\nexport * as utils__function_calling from \"../utils/function_calling.js\";\nexport * as utils__hash from \"../utils/hash.js\";\nexport * as utils__json_patch from \"../utils/json_patch.js\";\nexport * as utils__json_schema from \"../utils/json_schema.js\";\nexport * as utils__math from \"../utils/math.js\";\nexport * as utils__stream from \"../utils/stream.js\";\nexport * as utils__testing from \"../utils/testing/index.js\";\nexport * as utils__tiktoken from \"../utils/tiktoken.js\";\nexport * as utils__types from \"../utils/types/index.js\";\nexport * as vectorstores from \"../vectorstores.js\";\n"],"mappings":""}
1
+ {"version":3,"file":"import_map.cjs","names":[],"sources":["../../src/load/import_map.ts"],"sourcesContent":["// Auto-generated by import-map plugin. Do not edit manually.\n\nexport * as index from \"../index.js\";\nexport * as agents from \"../agents.js\";\nexport * as caches from \"../caches/base.js\";\nexport * as callbacks__base from \"../callbacks/base.js\";\nexport * as callbacks__manager from \"../callbacks/manager.js\";\nexport * as callbacks__promises from \"../callbacks/promises.js\";\nexport * as chat_history from \"../chat_history.js\";\nexport * as documents from \"../documents/index.js\";\nexport * as document_loaders__base from \"../document_loaders/base.js\";\nexport * as document_loaders__langsmith from \"../document_loaders/langsmith.js\";\nexport * as embeddings from \"../embeddings.js\";\nexport * as example_selectors from \"../example_selectors/index.js\";\nexport * as indexing from \"../indexing/index.js\";\nexport * as language_models__base from \"../language_models/base.js\";\nexport * as language_models__chat_models from \"../language_models/chat_models.js\";\nexport * as language_models__llms from \"../language_models/llms.js\";\nexport * as load__serializable from \"../load/serializable.js\";\nexport * as memory from \"../memory.js\";\nexport * as messages from \"../messages/index.js\";\nexport * as messages__tool from \"../messages/tool.js\";\nexport * as output_parsers from \"../output_parsers/index.js\";\nexport * as output_parsers__openai_tools from \"../output_parsers/openai_tools/index.js\";\nexport * as output_parsers__openai_functions from \"../output_parsers/openai_functions/index.js\";\nexport * as outputs from \"../outputs.js\";\nexport * as prompts from \"../prompts/index.js\";\nexport * as prompt_values from \"../prompt_values.js\";\nexport * as runnables from \"../runnables/index.js\";\nexport * as runnables__graph from \"../runnables/graph.js\";\nexport * as retrievers from \"../retrievers/index.js\";\nexport * as retrievers__document_compressors from \"../retrievers/document_compressors/base.js\";\nexport * as singletons from \"../singletons/index.js\";\nexport * as stores from \"../stores.js\";\nexport * as structured_query from \"../structured_query/index.js\";\nexport * as tools from \"../tools/index.js\";\nexport * as tracers__base from \"../tracers/base.js\";\nexport * as tracers__console from \"../tracers/console.js\";\nexport * as tracers__log_stream from \"../tracers/log_stream.js\";\nexport * as tracers__run_collector from \"../tracers/run_collector.js\";\nexport * as tracers__tracer_langchain from \"../tracers/tracer_langchain.js\";\nexport * as types__stream from \"../types/stream.js\";\nexport * as utils__async_caller from \"../utils/async_caller.js\";\nexport * as utils__chunk_array from \"../utils/chunk_array.js\";\nexport * as utils__env from \"../utils/env.js\";\nexport * as utils__event_source_parse from \"../utils/event_source_parse.js\";\nexport * as utils__function_calling from \"../utils/function_calling.js\";\nexport * as utils__hash from \"../utils/hash.js\";\nexport * as utils__json_patch from \"../utils/json_patch.js\";\nexport * as utils__json_schema from \"../utils/json_schema.js\";\nexport * as utils__math from \"../utils/math.js\";\nexport * as utils__stream from \"../utils/stream.js\";\nexport * as utils__testing from \"../utils/testing/index.js\";\nexport * as utils__tiktoken from \"../utils/tiktoken.js\";\nexport * as utils__types from \"../utils/types/index.js\";\nexport * as vectorstores from \"../vectorstores.js\";\n"],"mappings":""}
@@ -18,7 +18,6 @@ import { json_schema_exports } from "../utils/json_schema.js";
18
18
  import { graph_exports } from "../runnables/graph.js";
19
19
  import { messages_exports } from "../messages/index.js";
20
20
  import { chat_history_exports } from "../chat_history.js";
21
- import { context_exports } from "../context.js";
22
21
  import { embeddings_exports } from "../embeddings.js";
23
22
  import { src_exports } from "../index.js";
24
23
  import { memory_exports } from "../memory.js";
@@ -37,8 +36,6 @@ import { tiktoken_exports } from "../utils/tiktoken.js";
37
36
  import { base_exports as base_exports$4 } from "../language_models/base.js";
38
37
  import { chat_models_exports } from "../language_models/chat_models.js";
39
38
  import { llms_exports } from "../language_models/llms.js";
40
- import { web_exports } from "../callbacks/dispatch/web.js";
41
- import { dispatch_exports } from "../callbacks/dispatch/index.js";
42
39
  import { runnables_exports } from "../runnables/index.js";
43
40
  import { json_patch_exports } from "../utils/json_patch.js";
44
41
  import { output_parsers_exports } from "../output_parsers/index.js";
@@ -63,12 +60,9 @@ __export(import_map_exports, {
63
60
  agents: () => agents_exports,
64
61
  caches: () => base_exports$2,
65
62
  callbacks__base: () => base_exports,
66
- callbacks__dispatch: () => dispatch_exports,
67
- callbacks__dispatch__web: () => web_exports,
68
63
  callbacks__manager: () => manager_exports,
69
64
  callbacks__promises: () => promises_exports,
70
65
  chat_history: () => chat_history_exports,
71
- context: () => context_exports,
72
66
  document_loaders__base: () => base_exports$3,
73
67
  document_loaders__langsmith: () => langsmith_exports,
74
68
  documents: () => documents_exports,
@@ -1 +1 @@
1
- {"version":3,"file":"import_map.js","names":[],"sources":["../../src/load/import_map.ts"],"sourcesContent":["// Auto-generated by import-map plugin. Do not edit manually.\n\nexport * as index from \"../index.js\";\nexport * as agents from \"../agents.js\";\nexport * as caches from \"../caches/base.js\";\nexport * as callbacks__base from \"../callbacks/base.js\";\nexport * as callbacks__dispatch from \"../callbacks/dispatch/index.js\";\nexport * as callbacks__dispatch__web from \"../callbacks/dispatch/web.js\";\nexport * as callbacks__manager from \"../callbacks/manager.js\";\nexport * as callbacks__promises from \"../callbacks/promises.js\";\nexport * as chat_history from \"../chat_history.js\";\nexport * as context from \"../context.js\";\nexport * as documents from \"../documents/index.js\";\nexport * as document_loaders__base from \"../document_loaders/base.js\";\nexport * as document_loaders__langsmith from \"../document_loaders/langsmith.js\";\nexport * as embeddings from \"../embeddings.js\";\nexport * as example_selectors from \"../example_selectors/index.js\";\nexport * as indexing from \"../indexing/index.js\";\nexport * as language_models__base from \"../language_models/base.js\";\nexport * as language_models__chat_models from \"../language_models/chat_models.js\";\nexport * as language_models__llms from \"../language_models/llms.js\";\nexport * as load__serializable from \"../load/serializable.js\";\nexport * as memory from \"../memory.js\";\nexport * as messages from \"../messages/index.js\";\nexport * as messages__tool from \"../messages/tool.js\";\nexport * as output_parsers from \"../output_parsers/index.js\";\nexport * as output_parsers__openai_tools from \"../output_parsers/openai_tools/index.js\";\nexport * as output_parsers__openai_functions from \"../output_parsers/openai_functions/index.js\";\nexport * as outputs from \"../outputs.js\";\nexport * as prompts from \"../prompts/index.js\";\nexport * as prompt_values from \"../prompt_values.js\";\nexport * as runnables from \"../runnables/index.js\";\nexport * as runnables__graph from \"../runnables/graph.js\";\nexport * as retrievers from \"../retrievers/index.js\";\nexport * as retrievers__document_compressors from \"../retrievers/document_compressors/base.js\";\nexport * as singletons from \"../singletons/index.js\";\nexport * as stores from \"../stores.js\";\nexport * as structured_query from \"../structured_query/index.js\";\nexport * as tools from \"../tools/index.js\";\nexport * as tracers__base from \"../tracers/base.js\";\nexport * as tracers__console from \"../tracers/console.js\";\nexport * as tracers__log_stream from \"../tracers/log_stream.js\";\nexport * as tracers__run_collector from \"../tracers/run_collector.js\";\nexport * as tracers__tracer_langchain from \"../tracers/tracer_langchain.js\";\nexport * as types__stream from \"../types/stream.js\";\nexport * as utils__async_caller from \"../utils/async_caller.js\";\nexport * as utils__chunk_array from \"../utils/chunk_array.js\";\nexport * as utils__env from \"../utils/env.js\";\nexport * as utils__event_source_parse from \"../utils/event_source_parse.js\";\nexport * as utils__function_calling from \"../utils/function_calling.js\";\nexport * as utils__hash from \"../utils/hash.js\";\nexport * as utils__json_patch from \"../utils/json_patch.js\";\nexport * as utils__json_schema from \"../utils/json_schema.js\";\nexport * as utils__math from \"../utils/math.js\";\nexport * as utils__stream from \"../utils/stream.js\";\nexport * as utils__testing from \"../utils/testing/index.js\";\nexport * as utils__tiktoken from \"../utils/tiktoken.js\";\nexport * as utils__types from \"../utils/types/index.js\";\nexport * as vectorstores from \"../vectorstores.js\";\n"],"mappings":""}
1
+ {"version":3,"file":"import_map.js","names":[],"sources":["../../src/load/import_map.ts"],"sourcesContent":["// Auto-generated by import-map plugin. Do not edit manually.\n\nexport * as index from \"../index.js\";\nexport * as agents from \"../agents.js\";\nexport * as caches from \"../caches/base.js\";\nexport * as callbacks__base from \"../callbacks/base.js\";\nexport * as callbacks__manager from \"../callbacks/manager.js\";\nexport * as callbacks__promises from \"../callbacks/promises.js\";\nexport * as chat_history from \"../chat_history.js\";\nexport * as documents from \"../documents/index.js\";\nexport * as document_loaders__base from \"../document_loaders/base.js\";\nexport * as document_loaders__langsmith from \"../document_loaders/langsmith.js\";\nexport * as embeddings from \"../embeddings.js\";\nexport * as example_selectors from \"../example_selectors/index.js\";\nexport * as indexing from \"../indexing/index.js\";\nexport * as language_models__base from \"../language_models/base.js\";\nexport * as language_models__chat_models from \"../language_models/chat_models.js\";\nexport * as language_models__llms from \"../language_models/llms.js\";\nexport * as load__serializable from \"../load/serializable.js\";\nexport * as memory from \"../memory.js\";\nexport * as messages from \"../messages/index.js\";\nexport * as messages__tool from \"../messages/tool.js\";\nexport * as output_parsers from \"../output_parsers/index.js\";\nexport * as output_parsers__openai_tools from \"../output_parsers/openai_tools/index.js\";\nexport * as output_parsers__openai_functions from \"../output_parsers/openai_functions/index.js\";\nexport * as outputs from \"../outputs.js\";\nexport * as prompts from \"../prompts/index.js\";\nexport * as prompt_values from \"../prompt_values.js\";\nexport * as runnables from \"../runnables/index.js\";\nexport * as runnables__graph from \"../runnables/graph.js\";\nexport * as retrievers from \"../retrievers/index.js\";\nexport * as retrievers__document_compressors from \"../retrievers/document_compressors/base.js\";\nexport * as singletons from \"../singletons/index.js\";\nexport * as stores from \"../stores.js\";\nexport * as structured_query from \"../structured_query/index.js\";\nexport * as tools from \"../tools/index.js\";\nexport * as tracers__base from \"../tracers/base.js\";\nexport * as tracers__console from \"../tracers/console.js\";\nexport * as tracers__log_stream from \"../tracers/log_stream.js\";\nexport * as tracers__run_collector from \"../tracers/run_collector.js\";\nexport * as tracers__tracer_langchain from \"../tracers/tracer_langchain.js\";\nexport * as types__stream from \"../types/stream.js\";\nexport * as utils__async_caller from \"../utils/async_caller.js\";\nexport * as utils__chunk_array from \"../utils/chunk_array.js\";\nexport * as utils__env from \"../utils/env.js\";\nexport * as utils__event_source_parse from \"../utils/event_source_parse.js\";\nexport * as utils__function_calling from \"../utils/function_calling.js\";\nexport * as utils__hash from \"../utils/hash.js\";\nexport * as utils__json_patch from \"../utils/json_patch.js\";\nexport * as utils__json_schema from \"../utils/json_schema.js\";\nexport * as utils__math from \"../utils/math.js\";\nexport * as utils__stream from \"../utils/stream.js\";\nexport * as utils__testing from \"../utils/testing/index.js\";\nexport * as utils__tiktoken from \"../utils/tiktoken.js\";\nexport * as utils__types from \"../utils/types/index.js\";\nexport * as vectorstores from \"../vectorstores.js\";\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"async_caller.d.cts","names":["FailedAttemptHandler","AsyncCallerParams","AsyncCallerCallOptions","AbortSignal","AsyncCaller","A","Promise","T","Parameters","ReturnType","Awaited","fetch"],"sources":["../../src/utils/async_caller.d.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FailedAttemptHandler = (error: any) => any;\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n /**\n * Custom handler to handle failed attempts. Takes the originally thrown\n * error object as input, and should itself throw an error if the input\n * error is not retryable.\n */\n onFailedAttempt?: FailedAttemptHandler;\n}\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 6. This\n * means that by default, each call will be retried up to 6 times, with an\n * exponential backoff between each attempt.\n */\nexport declare class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n protected onFailedAttempt: AsyncCallerParams[\"onFailedAttempt\"];\n private queue;\n constructor(params: AsyncCallerParams);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;\n}\n"],"mappings":";;AACYA,KAAAA,oBAAAA,GAAoB,CAAA,KAAA,EAAA,GAAA,EAAA,GAAA,GAAA;AACfC,UAAAA,iBAAAA,CAAiB;EAkBjBC;AAgBjB;;;EAC+C,cACrBD,CAAAA,EAAAA,MAAAA;EAAiB;;;;EAKgB,UAAiBM,CAAAA,EAAAA,MAAAA;EAAC;;;;;EAA0C,eAAfD,CAAAA,EAzBlFN,oBAyBkFM;;AAEzCA,UAzB9CJ,sBAAAA,CAyB8CI;EAAO,MAAgBJ,CAAAA,EAxBzEC,WAwByED;;;;;;;;;;;;AAC9B;;;cAVnCE,WAAAA;4BACSH;wBACJA;6BACKA;;sBAEPA;;4CAEsBI,MAAMC,wBAAwBC,YAAYC,WAAWD,KAAKD,QAAQI,QAAQD,WAAWF;;uDAE1EF,MAAMC,uBAAuBJ,kCAAkCK,YAAYC,WAAWD,KAAKD,QAAQI,QAAQD,WAAWF;iBAC5JC,kBAAkBG,SAASF,kBAAkBE"}
1
+ {"version":3,"file":"async_caller.d.cts","names":["FailedAttemptHandler","AsyncCallerParams","AsyncCallerCallOptions","AbortSignal","AsyncCaller","A","Promise","T","Parameters","ReturnType","Awaited","fetch"],"sources":["../../src/utils/async_caller.d.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FailedAttemptHandler = (error: any) => any;\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n /**\n * Custom handler to handle failed attempts. Takes the originally thrown\n * error object as input, and should itself throw an error if the input\n * error is not retryable.\n */\n onFailedAttempt?: FailedAttemptHandler;\n}\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 6. This\n * means that by default, each call will be retried up to 6 times, with an\n * exponential backoff between each attempt.\n */\nexport declare class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n protected onFailedAttempt: AsyncCallerParams[\"onFailedAttempt\"];\n private queue;\n constructor(params: AsyncCallerParams);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;\n}\n"],"mappings":";;AACYA,KAAAA,oBAAAA,GAAoB,CAAA,KAAA,EAAA,GAAA,EAAA,GAAA,GAAA;AACfC,UAAAA,iBAAAA,CAgBKD;EAELE;AAgBjB;;;EAC+C,cACrBD,CAAAA,EAAAA,MAAAA;EAAiB;;;;EAKgB,UAAiBM,CAAAA,EAAAA,MAAAA;EAAC;;;;;EAA0C,eAAfD,CAAAA,EAzBlFN,oBAyBkFM;;AAEzCA,UAzB9CJ,sBAAAA,CAyB8CI;EAAO,MAAgBJ,CAAAA,EAxBzEC,WAwByED;;;;;;;;;;;;AAC9B;;;cAVnCE,WAAAA;4BACSH;wBACJA;6BACKA;;sBAEPA;;4CAEsBI,MAAMC,wBAAwBC,YAAYC,WAAWD,KAAKD,QAAQI,QAAQD,WAAWF;;uDAE1EF,MAAMC,uBAAuBJ,kCAAkCK,YAAYC,WAAWD,KAAKD,QAAQI,QAAQD,WAAWF;iBAC5JC,kBAAkBG,SAASF,kBAAkBE"}
@@ -1 +1 @@
1
- {"version":3,"file":"async_caller.d.ts","names":["FailedAttemptHandler","AsyncCallerParams","AsyncCallerCallOptions","AbortSignal","AsyncCaller","A","Promise","T","Parameters","ReturnType","Awaited","fetch"],"sources":["../../src/utils/async_caller.d.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FailedAttemptHandler = (error: any) => any;\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n /**\n * Custom handler to handle failed attempts. Takes the originally thrown\n * error object as input, and should itself throw an error if the input\n * error is not retryable.\n */\n onFailedAttempt?: FailedAttemptHandler;\n}\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 6. This\n * means that by default, each call will be retried up to 6 times, with an\n * exponential backoff between each attempt.\n */\nexport declare class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n protected onFailedAttempt: AsyncCallerParams[\"onFailedAttempt\"];\n private queue;\n constructor(params: AsyncCallerParams);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;\n}\n"],"mappings":";;AACYA,KAAAA,oBAAAA,GAAoB,CAAA,KAAA,EAAA,GAAA,EAAA,GAAA,GAAA;AACfC,UAAAA,iBAAAA,CAAiB;EAkBjBC;AAgBjB;;;EAC+C,cACrBD,CAAAA,EAAAA,MAAAA;EAAiB;;;;EAKgB,UAAiBM,CAAAA,EAAAA,MAAAA;EAAC;;;;;EAA0C,eAAfD,CAAAA,EAzBlFN,oBAyBkFM;;AAEzCA,UAzB9CJ,sBAAAA,CAyB8CI;EAAO,MAAgBJ,CAAAA,EAxBzEC,WAwByED;;;;;;;;;;;;AAC9B;;;cAVnCE,WAAAA;4BACSH;wBACJA;6BACKA;;sBAEPA;;4CAEsBI,MAAMC,wBAAwBC,YAAYC,WAAWD,KAAKD,QAAQI,QAAQD,WAAWF;;uDAE1EF,MAAMC,uBAAuBJ,kCAAkCK,YAAYC,WAAWD,KAAKD,QAAQI,QAAQD,WAAWF;iBAC5JC,kBAAkBG,SAASF,kBAAkBE"}
1
+ {"version":3,"file":"async_caller.d.ts","names":["FailedAttemptHandler","AsyncCallerParams","AsyncCallerCallOptions","AbortSignal","AsyncCaller","A","Promise","T","Parameters","ReturnType","Awaited","fetch"],"sources":["../../src/utils/async_caller.d.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FailedAttemptHandler = (error: any) => any;\nexport interface AsyncCallerParams {\n /**\n * The maximum number of concurrent calls that can be made.\n * Defaults to `Infinity`, which means no limit.\n */\n maxConcurrency?: number;\n /**\n * The maximum number of retries that can be made for a single call,\n * with an exponential backoff between each attempt. Defaults to 6.\n */\n maxRetries?: number;\n /**\n * Custom handler to handle failed attempts. Takes the originally thrown\n * error object as input, and should itself throw an error if the input\n * error is not retryable.\n */\n onFailedAttempt?: FailedAttemptHandler;\n}\nexport interface AsyncCallerCallOptions {\n signal?: AbortSignal;\n}\n/**\n * A class that can be used to make async calls with concurrency and retry logic.\n *\n * This is useful for making calls to any kind of \"expensive\" external resource,\n * be it because it's rate-limited, subject to network issues, etc.\n *\n * Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n * to `Infinity`. This means that by default, all calls will be made in parallel.\n *\n * Retries are limited by the `maxRetries` parameter, which defaults to 6. This\n * means that by default, each call will be retried up to 6 times, with an\n * exponential backoff between each attempt.\n */\nexport declare class AsyncCaller {\n protected maxConcurrency: AsyncCallerParams[\"maxConcurrency\"];\n protected maxRetries: AsyncCallerParams[\"maxRetries\"];\n protected onFailedAttempt: AsyncCallerParams[\"onFailedAttempt\"];\n private queue;\n constructor(params: AsyncCallerParams);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n call<A extends any[], T extends (...args: A) => Promise<any>>(callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n callWithOptions<A extends any[], T extends (...args: A) => Promise<any>>(options: AsyncCallerCallOptions, callable: T, ...args: Parameters<T>): Promise<Awaited<ReturnType<T>>>;\n fetch(...args: Parameters<typeof fetch>): ReturnType<typeof fetch>;\n}\n"],"mappings":";;AACYA,KAAAA,oBAAAA,GAAoB,CAAA,KAAA,EAAA,GAAA,EAAA,GAAA,GAAA;AACfC,UAAAA,iBAAAA,CAgBKD;EAELE;AAgBjB;;;EAC+C,cACrBD,CAAAA,EAAAA,MAAAA;EAAiB;;;;EAKgB,UAAiBM,CAAAA,EAAAA,MAAAA;EAAC;;;;;EAA0C,eAAfD,CAAAA,EAzBlFN,oBAyBkFM;;AAEzCA,UAzB9CJ,sBAAAA,CAyB8CI;EAAO,MAAgBJ,CAAAA,EAxBzEC,WAwByED;;;;;;;;;;;;AAC9B;;;cAVnCE,WAAAA;4BACSH;wBACJA;6BACKA;;sBAEPA;;4CAEsBI,MAAMC,wBAAwBC,YAAYC,WAAWD,KAAKD,QAAQI,QAAQD,WAAWF;;uDAE1EF,MAAMC,uBAAuBJ,kCAAkCK,YAAYC,WAAWD,KAAKD,QAAQI,QAAQD,WAAWF;iBAC5JC,kBAAkBG,SAASF,kBAAkBE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/core",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Core LangChain.js abstractions and schemas",
5
5
  "type": "module",
6
6
  "engines": {