You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/[platform]/ai/conversation/connect-your-frontend/index.mdx
+11-13
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ There are two main types within the conversation flow, `Conversation` and `Messa
39
39
40
40
A `Conversation` is an instance of a chat session between an application user and an LLM. It contains data and methods for interacting with the conversation. A conversation has a one-to-many relationship with its messages.
41
41
42
-
The `Conversation` type is accessible via `Schema['myChat']['type']` type definition, where `'myChat'` is the name of the conversation route in your data schema.
42
+
The `Conversation` type is accessible via `Schema['myChat']['type']` type definition, where `'myChat'` is the name of the conversation route in your data schema.
43
43
44
44
| Property/Method | Type | Description |
45
45
|------------------|:-------|:-------------|
@@ -56,7 +56,7 @@ The `Conversation` type is accessible via `Schema['myChat']['type']` type defini
56
56
57
57
A `Message` is a single chat message between an application user and an LLM. Each message has a `role` property that indicates whether the message is from the user or the assistant. User and assistant messages have a one-to-one relationship. Assistant messages contain an `associatedUserMessageId` property that points to the `id` of the user message that triggered the assistant response.
58
58
59
-
The `Message` type is accessible via `Schema['myChat']['messageType']`.
59
+
The `Message` type is accessible via `Schema['myChat']['messageType']`, where `'myChat'` is the name of the conversation route in your data schema.
60
60
61
61
| Property | Type | Description |
62
62
|-----------|:-------|:-------------|
@@ -67,22 +67,29 @@ The `Message` type is accessible via `Schema['myChat']['messageType']`.
67
67
|`role`|`'user' \| 'assistant'`| Whether the message is from the user or assistant |
68
68
|`createdAt`|`string`| The date and time when the message was created |
69
69
70
-
## Data flow
70
+
## Request response flow
71
71
72
72
1. Create a new conversation with `.create()` or get an existing one with `.get()`.
73
73
2. Subscribe to assistant responses for a conversation with `.onStreamEvent()`.
74
74
3. Send messages to the conversation with `.sendMessage()`.
Conversation routes defined in your schema are accessible via the `.conversations` namespace. First create a client instance with the `generateClient()` function.
Then create a new conversation by calling the `.create()` method on your conversation route. In the examples below, we're using a conversation route named `chat`.
105
+
Create a new conversation by calling the `.create()` method on your conversation route. In the examples below, we're using a conversation route named `chat`.
0 commit comments