Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs[patch]: Add custom callback event guide to index page #6092

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/core_docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docs/core_docs/docs/concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion docs/core_docs/docs/how_to/callbacks_custom_events.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"```"
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion docs/core_docs/docs/how_to/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
13 changes: 11 additions & 2 deletions docs/core_docs/docs/how_to/streaming.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading