UNPKG

@langchain/core

Version:
1 lines 1.62 kB
{"version":3,"file":"index.d.ts","names":["RunnableConfig","dispatchCustomEvent","Promise"],"sources":["../../../src/callbacks/dispatch/index.d.ts"],"sourcesContent":["import { type RunnableConfig } from \"../../runnables/config.js\";\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 declare function dispatchCustomEvent(eventName: string, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\npayload: any, config?: RunnableConfig): Promise<void>;\n"],"mappings":";;;;;;AAkCA;;;;AAE+C;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAFvBC,mBAAAA;;uBAEDD,iBAAiBE"}