-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy paththread.go
More file actions
380 lines (332 loc) · 9.77 KB
/
Copy paththread.go
File metadata and controls
380 lines (332 loc) · 9.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
// Code generated by Fern. DO NOT EDIT.
package zep
import (
json "encoding/json"
fmt "fmt"
internal "github.com/getzep/zep-go/v3/internal"
)
type CreateThreadRequest struct {
// The unique identifier of the thread.
ThreadID string `json:"thread_id" url:"-"`
// The unique identifier of the user associated with the thread
UserID string `json:"user_id" url:"-"`
}
type ThreadGetRequest struct {
// Limit the number of results returned
Limit *int `json:"-" url:"limit,omitempty"`
// Cursor for pagination
Cursor *int `json:"-" url:"cursor,omitempty"`
// Number of most recent messages to return (overrides limit and cursor)
Lastn *int `json:"-" url:"lastn,omitempty"`
}
type ThreadGetUserContextRequest struct {
// Optional template ID to use for custom context rendering.
TemplateID *string `json:"-" url:"template_id,omitempty"`
}
type ThreadListAllRequest struct {
// Page number for pagination, starting from 1
PageNumber *int `json:"-" url:"page_number,omitempty"`
// Number of threads to retrieve per page.
PageSize *int `json:"-" url:"page_size,omitempty"`
// Field to order the results by: created_at, updated_at, user_id, thread_id.
OrderBy *string `json:"-" url:"order_by,omitempty"`
// Order direction: true for ascending, false for descending.
Asc *bool `json:"-" url:"asc,omitempty"`
}
type AddThreadMessagesRequest struct {
// Optional list of role types to ignore when adding messages to graph memory.
// The message itself will still be added, retained and used as context for messages
// that are added to a user's graph.
IgnoreRoles []RoleType `json:"ignore_roles,omitempty" url:"ignore_roles,omitempty"`
// A list of message objects, where each message contains a role and content.
Messages []*Message `json:"messages" url:"messages"`
// Optionally return context block relevant to the most recent messages.
ReturnContext *bool `json:"return_context,omitempty" url:"return_context,omitempty"`
// When true, prevents extraction of generic Entity nodes that do not match the configured ontology.
StrictOntology *bool `json:"strict_ontology,omitempty" url:"strict_ontology,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (a *AddThreadMessagesRequest) GetIgnoreRoles() []RoleType {
if a == nil {
return nil
}
return a.IgnoreRoles
}
func (a *AddThreadMessagesRequest) GetMessages() []*Message {
if a == nil {
return nil
}
return a.Messages
}
func (a *AddThreadMessagesRequest) GetReturnContext() *bool {
if a == nil {
return nil
}
return a.ReturnContext
}
func (a *AddThreadMessagesRequest) GetStrictOntology() *bool {
if a == nil {
return nil
}
return a.StrictOntology
}
func (a *AddThreadMessagesRequest) GetExtraProperties() map[string]interface{} {
return a.extraProperties
}
func (a *AddThreadMessagesRequest) UnmarshalJSON(data []byte) error {
type unmarshaler AddThreadMessagesRequest
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*a = AddThreadMessagesRequest(value)
extraProperties, err := internal.ExtractExtraProperties(data, *a)
if err != nil {
return err
}
a.extraProperties = extraProperties
a.rawJSON = json.RawMessage(data)
return nil
}
func (a *AddThreadMessagesRequest) String() string {
if len(a.rawJSON) > 0 {
if value, err := internal.StringifyJSON(a.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(a); err == nil {
return value
}
return fmt.Sprintf("%#v", a)
}
type AddThreadMessagesResponse struct {
Context *string `json:"context,omitempty" url:"context,omitempty"`
MessageUUIDs []string `json:"message_uuids,omitempty" url:"message_uuids,omitempty"`
TaskID *string `json:"task_id,omitempty" url:"task_id,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (a *AddThreadMessagesResponse) GetContext() *string {
if a == nil {
return nil
}
return a.Context
}
func (a *AddThreadMessagesResponse) GetMessageUUIDs() []string {
if a == nil {
return nil
}
return a.MessageUUIDs
}
func (a *AddThreadMessagesResponse) GetTaskID() *string {
if a == nil {
return nil
}
return a.TaskID
}
func (a *AddThreadMessagesResponse) GetExtraProperties() map[string]interface{} {
return a.extraProperties
}
func (a *AddThreadMessagesResponse) UnmarshalJSON(data []byte) error {
type unmarshaler AddThreadMessagesResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*a = AddThreadMessagesResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *a)
if err != nil {
return err
}
a.extraProperties = extraProperties
a.rawJSON = json.RawMessage(data)
return nil
}
func (a *AddThreadMessagesResponse) String() string {
if len(a.rawJSON) > 0 {
if value, err := internal.StringifyJSON(a.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(a); err == nil {
return value
}
return fmt.Sprintf("%#v", a)
}
type MessageListResponse struct {
// A list of message objects.
Messages []*Message `json:"messages,omitempty" url:"messages,omitempty"`
// The number of messages returned.
RowCount *int `json:"row_count,omitempty" url:"row_count,omitempty"`
// The thread creation timestamp.
ThreadCreatedAt *string `json:"thread_created_at,omitempty" url:"thread_created_at,omitempty"`
// The total number of messages.
TotalCount *int `json:"total_count,omitempty" url:"total_count,omitempty"`
// The user ID associated with this thread.
UserID *string `json:"user_id,omitempty" url:"user_id,omitempty"`
// The opaque user identifier used by dashboard routes.
UserUUID *string `json:"user_uuid,omitempty" url:"user_uuid,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (m *MessageListResponse) GetMessages() []*Message {
if m == nil {
return nil
}
return m.Messages
}
func (m *MessageListResponse) GetRowCount() *int {
if m == nil {
return nil
}
return m.RowCount
}
func (m *MessageListResponse) GetThreadCreatedAt() *string {
if m == nil {
return nil
}
return m.ThreadCreatedAt
}
func (m *MessageListResponse) GetTotalCount() *int {
if m == nil {
return nil
}
return m.TotalCount
}
func (m *MessageListResponse) GetUserID() *string {
if m == nil {
return nil
}
return m.UserID
}
func (m *MessageListResponse) GetUserUUID() *string {
if m == nil {
return nil
}
return m.UserUUID
}
func (m *MessageListResponse) GetExtraProperties() map[string]interface{} {
return m.extraProperties
}
func (m *MessageListResponse) UnmarshalJSON(data []byte) error {
type unmarshaler MessageListResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*m = MessageListResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *m)
if err != nil {
return err
}
m.extraProperties = extraProperties
m.rawJSON = json.RawMessage(data)
return nil
}
func (m *MessageListResponse) String() string {
if len(m.rawJSON) > 0 {
if value, err := internal.StringifyJSON(m.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(m); err == nil {
return value
}
return fmt.Sprintf("%#v", m)
}
type ThreadContextResponse struct {
// Context block containing relevant facts, entities, and messages/episodes from the user graph. Meant to be replaced in the system prompt on every chat turn.
Context *string `json:"context,omitempty" url:"context,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (t *ThreadContextResponse) GetContext() *string {
if t == nil {
return nil
}
return t.Context
}
func (t *ThreadContextResponse) GetExtraProperties() map[string]interface{} {
return t.extraProperties
}
func (t *ThreadContextResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ThreadContextResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*t = ThreadContextResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *t)
if err != nil {
return err
}
t.extraProperties = extraProperties
t.rawJSON = json.RawMessage(data)
return nil
}
func (t *ThreadContextResponse) String() string {
if len(t.rawJSON) > 0 {
if value, err := internal.StringifyJSON(t.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}
type ThreadListResponse struct {
ResponseCount *int `json:"response_count,omitempty" url:"response_count,omitempty"`
Threads []*Thread `json:"threads,omitempty" url:"threads,omitempty"`
TotalCount *int `json:"total_count,omitempty" url:"total_count,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (t *ThreadListResponse) GetResponseCount() *int {
if t == nil {
return nil
}
return t.ResponseCount
}
func (t *ThreadListResponse) GetThreads() []*Thread {
if t == nil {
return nil
}
return t.Threads
}
func (t *ThreadListResponse) GetTotalCount() *int {
if t == nil {
return nil
}
return t.TotalCount
}
func (t *ThreadListResponse) GetExtraProperties() map[string]interface{} {
return t.extraProperties
}
func (t *ThreadListResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ThreadListResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*t = ThreadListResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *t)
if err != nil {
return err
}
t.extraProperties = extraProperties
t.rawJSON = json.RawMessage(data)
return nil
}
func (t *ThreadListResponse) String() string {
if len(t.rawJSON) > 0 {
if value, err := internal.StringifyJSON(t.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}