Skip to content

Commit 13037c0

Browse files
authored
Merge pull request #6290 from segmentio/ai-copilot-spec-1
AI Copilot Spec [DOC-852]
2 parents 3c6e7ce + af33e0f commit 13037c0

File tree

2 files changed

+311
-0
lines changed

2 files changed

+311
-0
lines changed

src/_data/sidenav/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ sections:
114114
title: 'Spec: Identify'
115115
- path: /connections/spec/alias
116116
title: 'Spec: Alias'
117+
- path: /connections/spec/copilot
118+
title: 'Spec: AI Copilot'
117119
- path: /connections/spec/common
118120
title: 'Spec: Common Fields'
119121
- path: /connections/spec/mobile

src/connections/spec/copilot.md

Lines changed: 309 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
---
2+
title: 'Spec: AI Copilot'
3+
---
4+
5+
This page is a guide for developers who want to track interactions with AI copilots using Segment. It explains what data to send to Segment, letting you understand customer interactions with AI copilots.
6+
7+
## Overview
8+
9+
AI copilots are like virtual assistants that help customers in conversations.
10+
11+
Each conversation starts when a customer sends their first message or question. Throughout the conversation, Segment can track various events that capture key moments, like messages sent and received, tools invoked, and media generated.
12+
13+
While some copilot conversations have clear ending points, which occur when the customer explicitly indicates that the conversation is over, the tracked events provide valuable insights into the entire conversation flow.
14+
15+
## Tracked events
16+
17+
In this section, you'll find the tracked semantic events that serve as a starting point for AI copilot events. You can extend them based on your own requirements.
18+
19+
This table lists the events that you can track from any conversation:
20+
21+
| Event | Definition | Fields |
22+
| -------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
23+
| Conversation Started | When a new conversation begins | `conversationId` |
24+
| Message Sent | When the first message is added to a thread by user | `conversationId`, `messageId`, `message_body` |
25+
| Message Received | Non-custom response (text/voice) to user prompt by copilot | `conversationId`, `messageId`, `message_body` |
26+
| Conversation Ended | When a conversation is completed | `conversationId`, `message_count` |
27+
| Tool Invoked | When the model or user invokes a capability or tool | `conversationId`, `messageId`, `type`, `action` |
28+
| Media Generated | When the model generates an image/video/audio | `conversationId`, `messageId`, `type`, `sub_type` |
29+
| Component Loaded | When a new custom (non-text/voice) component is shown to a user | `conversationId`, `messageId`, `type` |
30+
| Feedback Submitted | When a user rates a conversation or message | `conversationId`, `messageId`, `rating` |
31+
| Identify | When a new user is identified anonymously or known | `userId` and/or `anonymousId` |
32+
| Standard Track Calls | For all events sent to Segment based on user actions taken, like `items purchased`, `support requested` | `conversationId`, `messageId`, `...` |
33+
34+
### Live chat events
35+
36+
Segment can also track the following live chat events:
37+
38+
- Conversation Started
39+
- Message Sent
40+
- Message Received
41+
- Custom Component Loaded
42+
- Tool Invoked
43+
- Media Generated
44+
- Conversation Ended
45+
46+
## Event details
47+
48+
This section contains the structure and properties of each AI copilot tracked event.
49+
50+
### Conversation Started
51+
52+
The Conversation Started event should be sent when a customer sends their first message.
53+
54+
This event supports the following semantic properties:
55+
56+
| Property | Type | Description |
57+
| ---------------- | ------ | ------------------------------------- |
58+
| `conversationId` | string | The conversation's unique identifier. |
59+
60+
61+
Here's an example of a Conversation Started call:
62+
63+
```json
64+
{
65+
"userId": "123",
66+
"action": "track",
67+
"event": "Conversation Started",
68+
"properties": {
69+
"conversationId": "1238041hdou"
70+
}
71+
}
72+
```
73+
74+
### Message Sent
75+
76+
The Message Sent event should be sent when a user adds a new message to a thread.
77+
78+
This event supports the following semantic properties:
79+
80+
| Property | Type | Description |
81+
| ---------------- | ------ | ------------------------------------- |
82+
| `conversationId` | string | The conversation's unique identifier. |
83+
| `messageId` | string | The message's unique identifier. |
84+
| `message_body` | string | The message's content. |
85+
86+
Here's an example of a Message Sent call:
87+
88+
```json
89+
{
90+
"userId": "123",
91+
"action": "track",
92+
"event": "Message Sent",
93+
"properties": {
94+
"conversationId": "1238041hdou",
95+
"messageId": "msg123",
96+
"message_body": "What's the best stock in the Nasdaq right now?"
97+
}
98+
}
99+
```
100+
101+
### Message Received
102+
103+
The Message Received event should be sent when the copilot gives a non-custom response (either text or voice) to something the user asked.
104+
105+
This event supports the following semantic properties:
106+
107+
| Property | Type | Description |
108+
| ---------------- | ------ | ------------------------------------- |
109+
| `conversationId` | string | The conversation's unique identifier. |
110+
| `messageId` | string | The message's unique identifier. |
111+
| `message_body` | string | The received message's content. |
112+
113+
```json
114+
{
115+
"userId": "123",
116+
"action": "track",
117+
"event": "Message Received",
118+
"properties": {
119+
"conversationId": "1238041hdou",
120+
"messageId": "msg124",
121+
"message_body": "Thank you for reaching out. How can I assist you today?"
122+
}
123+
}
124+
```
125+
126+
### Conversation Ended
127+
128+
The Conversation Ended event should be sent when a customer or agent explicitly indicates that the conversation has ended or deletes the chat.
129+
130+
This event supports the following semantic property:
131+
132+
| Property | Type | Description |
133+
| ---------------- | ------ | ------------------------------------- |
134+
| `conversationId` | string | The conversation's unique identifier. |
135+
136+
Here's an example of a Conversation Ended call:
137+
138+
```json
139+
{
140+
"userId": "123",
141+
"action": "track",
142+
"event": "Conversation Ended",
143+
"properties": {
144+
"conversationId": "1238041hdou"
145+
}
146+
}
147+
```
148+
149+
### Tool Invoked
150+
151+
The Tool Invoked event should be sent when the copilot or user uses a custom capability or tool, like making a call to an external API.
152+
153+
This event supports the following semantic properties:
154+
155+
| Property | Type | Description |
156+
| ---------------- | ------ | ---------------------------------------- |
157+
| `conversationId` | string | The conversation's unique identifier. |
158+
| `messageId` | string | The message's unique identifier. |
159+
| `type` | string | The type of tool invoked. |
160+
| `action` | String | The specific action taken with the tool. |
161+
162+
Here's an example of a Tool Invoked call:
163+
164+
```json
165+
{
166+
"userId": "123",
167+
"action": "track",
168+
"event": "Tool Invoked",
169+
"properties": {
170+
"conversationId": "1238041hdou",
171+
"messageId": "msg125",
172+
"type": "Inventory Request",
173+
"action": "check stock level"
174+
}
175+
}
176+
```
177+
178+
### Media Generated
179+
180+
This event should be sent when an image, video, or custom audio is generated by the model.
181+
182+
This event supports the following semantic properties:
183+
184+
| Property | Type | Description |
185+
| ---------------- | ------ | ------------------------------------------------------- |
186+
| `conversationId` | string | The conversation's unique identifier. |
187+
| `messageId` | string | The message's unique identifier. |
188+
| `type` | string | The type of media generated (like `"image"`, `"video"`) |
189+
| `sub_type` | String | Media data type (like `"gif"`, `"mp4"`, `"wav"`) |
190+
191+
Here's an example of a Media Generated call:
192+
193+
```json
194+
{
195+
"userId": "123",
196+
"action": "track",
197+
"event": "Media Generated",
198+
"properties": {
199+
"conversationId": "1238041hdou",
200+
"messageId": "msg126",
201+
"type": "image",
202+
"sub_type": "gif"
203+
}
204+
}
205+
```
206+
207+
### Component Loaded
208+
209+
This event should be sent when a new, custom component is shown to the user that isn't text or voice.
210+
211+
This event supports the following semantic properties:
212+
213+
| Property | Type | Description |
214+
| ---------------- | ------ | ------------------------------------- |
215+
| `conversationId` | string | The conversation's unique identifier. |
216+
| `messageId` | string | The message's unique identifier. |
217+
| `type` | string | The type of custom component loaded. |
218+
219+
Here's an example of a Component Loaded call:
220+
221+
```json
222+
{
223+
"userId": "123",
224+
"action": "track",
225+
"event": "Component Loaded",
226+
"properties": {
227+
"conversationId": "1238041hdou",
228+
"messageId": "msg127",
229+
"type": "Stock Price Chart"
230+
}
231+
}
232+
```
233+
234+
### Feedback Submitted
235+
236+
This event should be sent when a user rates a conversation or message.
237+
238+
This event supports the following semantic properties:
239+
240+
| Property | Type | Description |
241+
| ---------------- | ------ | ------------------------------------- |
242+
| `conversationId` | string | The conversation's unique identifier. |
243+
| `messageId` | string | The message's unique identifier. |
244+
| `rating` | number | The rating given by the user. |
245+
246+
Here's an example of a Feedback Submitted call:
247+
248+
```json
249+
{
250+
"userId": "123",
251+
"action": "track",
252+
"event": "Feedback Submitted",
253+
"properties": {
254+
"conversationId": "1238041hdou",
255+
"messageId": "msg128",
256+
"rating": 5
257+
}
258+
}
259+
```
260+
261+
### Identify
262+
263+
This event should be sent when a new user is identified, either anonymously or as a known user.
264+
265+
This event supports the following semantic properties:
266+
267+
| Property | Type | Description |
268+
| ------------- | ------ | ------------------------------------------------ |
269+
| `userId` | string | The user's unique identifier. |
270+
| `anonymousId` | string | The user's anonymous identifier (if applicable). |
271+
272+
Here's an example of an Identify call:
273+
274+
```js
275+
{
276+
"userId": "123" || "anonymousId" : "768923ihuy32",
277+
"action": "identify",
278+
"properties":
279+
}
280+
```
281+
282+
### Standard Track calls
283+
284+
When sending events to Segment based on user actions, like items purchased or support requested, make sure to include relevant identifiers for accurate tracking and analysis.
285+
286+
These identifiers include `conversationId` and `messageId`, among others, depending on the specific tracked action:
287+
288+
| Identifier | Description |
289+
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
290+
| `conversationId` | The conversation's unique identifier. This identifier is crucial to tracking actions within a messaging or support context. |
291+
| `messageId` | The message's unique identifier. This identifier is especially important for actions like messages read, media generated, or feedback submitted. |
292+
293+
For example, to track an event where a user makes a purchase, the standard Track call could look like this:
294+
295+
```json
296+
{
297+
"userId": "user123",
298+
"action": "track",
299+
"event": "Item Purchased",
300+
"properties": {
301+
"conversationId": "conv456",
302+
"messageId": "msg789",
303+
"itemId": "item101112",
304+
"itemName": "Super Widget",
305+
"itemPrice": 19.99,
306+
"currency": "USD"
307+
}
308+
}
309+
```

0 commit comments

Comments
 (0)