The name of the custom event.
The data for the custom event. Ideally should be JSON serializable to avoid serialization issues downstream, but not enforced.
Optionalconfig: RunnableConfigConfig object.
import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch";
const foo = RunnableLambda.from(async (input: string, config?: RunnableConfig) => {
  await dispatchCustomEvent(
    "my_custom_event",
    { arbitraryField: "someval" },
    config
  );
  return input;
});
const callbacks = [{
  handleCustomEvent: (eventName: string, payload: any) => {
    // Logs "my_custom_event" and { arbitraryField: "someval" }
    console.log(eventName, payload);
  }
}];
await foo.invoke("hi", { callbacks })
Dispatch a custom event. Requires an explicit config object.