UNPKG

@langchain/core

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