Skip to content

Commit df03dc0

Browse files
committed
more guides
1 parent 54a4bde commit df03dc0

27 files changed

Lines changed: 1590 additions & 836 deletions

docs/concepts/actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ When you set `handler: "client"`, the action flows into the client SDK’s `widg
1919
Your client integration can also initiate actions directly with `chatkit.sendCustomAction(action, itemId?)`, optionally namespaced to a specific widget item. The server receives these in `ChatKitServer.action` just like a widget-triggered action and can stream widgets, messages, or client effects in response. This pattern is useful when a flow starts outside a widget—or after a client-handled action—but you still want the server to persist results or involve the model.
2020

2121
## Related guides
22-
- [Handle widget actions](../guides/handle-widget-actions.md)
22+
- [Build interactive responses with widgets](../guides/build-interactive-responses-with-widgets.md)

docs/concepts/tools.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Tools
2+
3+
Tools let the assistant call into your application logic during a turn—for example to search data, run a workflow, or fetch the user’s current context—then feed the results back into the model.
4+
5+
At a high level:
6+
7+
- **Server tools** run on your backend. The assistant calls them through your inference pipeline, and you stream their results back into the conversation.
8+
- **Client tools** run in the browser or host app. ChatKit surfaces a tool call as a streamed thread item, lets the client handle it, then resumes the conversation with the tool’s output.
9+
10+
## Server tools
11+
12+
Server tools are ordinary Python functions you register with your inference setup (for example, as tools on an agent or as explicit steps in your pipeline). During inference, the model can decide to call them; ChatKit serializes the call, runs your function, and feeds the output back to the model.
13+
14+
Use server tools to:
15+
16+
- Look up data in your own APIs or databases.
17+
- Kick off long-running jobs while streaming progress updates.
18+
- Update your own domain state (tickets, orders, files, etc.) in response to a turn.
19+
20+
From the model’s perspective, tools are structured, named capabilities it can invoke instead of guessing from free text.
21+
22+
## Client tools
23+
24+
Some operations can only run on the client—for example:
25+
26+
- Reading the current selection in a canvas or document.
27+
- Inspecting local application state that never leaves the browser.
28+
- Calling into the host app (for example, a design tool or IDE) via its own APIs.
29+
30+
Client tools let the model request that kind of data mid-turn:
31+
32+
- On the server, you instruct your inference pipeline to stop when a specific tool is called (for example, by using `StopAtTools` around that tool).
33+
- ChatKit turns the tool call into a streamed thread item.
34+
- On the client, `onClientTool` receives that item, runs your callback, and returns a JSON result.
35+
- ChatKit sends the result back to the server, which starts a new stream to continue the run with the tool output included as model input.
36+
37+
Use client tools when the model needs fresh, local context it cannot safely obtain from server-side state alone.

docs/concepts/widgets.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Every widget must be wrapped in a root-level container element. For single, self
3131

3232
## .widget files
3333

34-
Exported `.widget` files are JSON blobs that include the widget template, the expected data schema, and supporting metadata. You can load them server-side and render widgets dynamically with `WidgetTemplate`; see [Build widgets with `WidgetTemplate`](../guides/stream-widgets.md#build-widgets-with-widgettemplate) for examples.
34+
Exported `.widget` files are JSON blobs that include the widget template, the expected data schema, and supporting metadata. You can load them server-side and render widgets dynamically with `WidgetTemplate`; see [Build widgets with `WidgetTemplate`](../guides/build-interactive-responses-with-widgets.md#build-widgets-with-widgettemplate) for examples.
3535

3636
## WidgetItem
3737

@@ -51,6 +51,4 @@ The [`entities.onRequestPreview`](https://openai.github.io/chatkit-js/api/openai
5151

5252
## Related guides
5353

54-
- [Stream widgets](../guides/stream-widgets.md)
55-
- [Create custom forms](../guides/create-custom-forms.md)
56-
- [Handle widget actions](../guides/handle-widget-actions.md)
54+
- [Build interactive responses with widgets](../guides/build-interactive-responses-with-widgets.md)

docs/guides/accept-attachments.md

Lines changed: 0 additions & 149 deletions
This file was deleted.

0 commit comments

Comments
 (0)