diff --git a/docs/core_docs/.gitignore b/docs/core_docs/.gitignore index ed244bba57b2..b952a46c9bf6 100644 --- a/docs/core_docs/.gitignore +++ b/docs/core_docs/.gitignore @@ -155,6 +155,10 @@ docs/how_to/document_loader_html.md docs/how_to/document_loader_html.mdx docs/how_to/custom_tools.md docs/how_to/custom_tools.mdx +docs/how_to/custom_llm.md +docs/how_to/custom_llm.mdx +docs/how_to/custom_chat.md +docs/how_to/custom_chat.mdx docs/how_to/custom_callbacks.md docs/how_to/custom_callbacks.mdx docs/how_to/code_splitter.md @@ -171,6 +175,8 @@ docs/how_to/character_text_splitter.md docs/how_to/character_text_splitter.mdx docs/how_to/callbacks_runtime.md docs/how_to/callbacks_runtime.mdx +docs/how_to/callbacks_custom_events.md +docs/how_to/callbacks_custom_events.mdx docs/how_to/callbacks_constructor.md docs/how_to/callbacks_constructor.mdx docs/how_to/callbacks_backgrounding.md diff --git a/docs/core_docs/docs/concepts.mdx b/docs/core_docs/docs/concepts.mdx index 0e368d09b89f..34cbd6d6cd3a 100644 --- a/docs/core_docs/docs/concepts.mdx +++ b/docs/core_docs/docs/concepts.mdx @@ -765,7 +765,8 @@ for await (const event of eventStream) { You can roughly think of it as an iterator over callback events (though the format differs) - and you can use it on almost all LangChain components! -See [this guide](/docs/how_to/streaming/#using-stream-events) for more detailed information on how to use `.streamEvents()`. +See [this guide](/docs/how_to/streaming/#using-stream-events) for more detailed information on how to use `.streamEvents()`, +or [this guide](/docs/how_to/callbacks_custom_events) for how to stream custom events from within a chain. #### Tokens diff --git a/docs/core_docs/docs/how_to/callbacks_custom_events.ipynb b/docs/core_docs/docs/how_to/callbacks_custom_events.ipynb index b910ce083248..bd345828c147 100644 --- a/docs/core_docs/docs/how_to/callbacks_custom_events.ipynb +++ b/docs/core_docs/docs/how_to/callbacks_custom_events.ipynb @@ -42,11 +42,13 @@ "\n", "We can use the `dispatchCustomEvent` API to emit custom events from this method. \n", "\n", + "```{=mdx}\n", ":::caution Compatibility\n", "Dispatching custom callback events requires `@langchain/core>=0.2.16`. See [this guide](/docs/how_to/installation/#installing-integration-packages) for some considerations to take when upgrading `@langchain/core`.\n", "\n", "The default entrypoint below triggers an import and initialization of [`async_hooks`](https://nodejs.org/api/async_hooks.html) to enable automatic `RunnableConfig` passing, which is not supported in all environments. If you see import issues, you must import from `@langchain/callbacks/dispatch/web` and propagate the `RunnableConfig` object manually (see example below).\n", - ":::" + ":::\n", + "```" ] }, { diff --git a/docs/core_docs/docs/how_to/index.mdx b/docs/core_docs/docs/how_to/index.mdx index 29e1ad7089f6..29c97268e721 100644 --- a/docs/core_docs/docs/how_to/index.mdx +++ b/docs/core_docs/docs/how_to/index.mdx @@ -184,6 +184,7 @@ For in depth how-to guides for agents, please check out [LangGraph](https://lang - [How to: pass callbacks into a module constructor](/docs/how_to/callbacks_constructor) - [How to: create custom callback handlers](/docs/how_to/custom_callbacks) - [How to: make callbacks run in the background](/docs/how_to/callbacks_backgrounding) +- [How to: dispatch custom callback events](/docs/how_to/callbacks_custom_events) ### Custom @@ -193,8 +194,9 @@ All of LangChain components can easily be extended to support your own versions. - [How to: create a custom LLM class](/docs/how_to/custom_llm) - [How to: write a custom retriever class](/docs/how_to/custom_retriever) - [How to: write a custom document loader](/docs/how_to/document_loader_custom) -- [How to: define a custom tool](/docs/how_to/custom_tools) - [How to: create custom callback handlers](/docs/how_to/custom_callbacks) +- [How to: define a custom tool](/docs/how_to/custom_tools) +- [How to: dispatch custom callback events](/docs/how_to/callbacks_custom_events) ### Generative UI diff --git a/docs/core_docs/docs/how_to/streaming.ipynb b/docs/core_docs/docs/how_to/streaming.ipynb index 73ebe8475808..b71664a842c4 100644 --- a/docs/core_docs/docs/how_to/streaming.ipynb +++ b/docs/core_docs/docs/how_to/streaming.ipynb @@ -2028,13 +2028,22 @@ "\n", "Chat model chunk: {" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Related\n", + "\n", + "- [Dispatching custom events](/docs/how_to/callbacks_custom_events)" + ] } ], "metadata": { "kernelspec": { - "display_name": "TypeScript", + "display_name": "Deno", "language": "typescript", - "name": "tslab" + "name": "deno" }, "language_info": { "codemirror_mode": {