@papr/memory 1.8.3 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +2 -2
  3. package/client.d.mts +17 -5
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +17 -5
  6. package/client.d.ts.map +1 -1
  7. package/client.js +24 -11
  8. package/client.js.map +1 -1
  9. package/client.mjs +24 -11
  10. package/client.mjs.map +1 -1
  11. package/index.d.mts +1 -0
  12. package/index.d.ts +1 -0
  13. package/index.js +2 -0
  14. package/index.js.map +1 -1
  15. package/index.mjs +1 -0
  16. package/internal/request-options.d.mts +42 -0
  17. package/internal/request-options.d.mts.map +1 -1
  18. package/internal/request-options.d.ts +42 -0
  19. package/internal/request-options.d.ts.map +1 -1
  20. package/internal/request-options.js.map +1 -1
  21. package/internal/request-options.mjs.map +1 -1
  22. package/internal/uploads.js +1 -1
  23. package/internal/uploads.js.map +1 -1
  24. package/internal/uploads.mjs +1 -1
  25. package/internal/uploads.mjs.map +1 -1
  26. package/internal/utils/log.d.mts.map +1 -1
  27. package/internal/utils/log.d.ts.map +1 -1
  28. package/internal/utils/log.js +4 -3
  29. package/internal/utils/log.js.map +1 -1
  30. package/internal/utils/log.mjs +4 -3
  31. package/internal/utils/log.mjs.map +1 -1
  32. package/internal/utils/path.d.mts.map +1 -1
  33. package/internal/utils/path.d.ts.map +1 -1
  34. package/internal/utils/path.js +26 -5
  35. package/internal/utils/path.js.map +1 -1
  36. package/internal/utils/path.mjs +26 -5
  37. package/internal/utils/path.mjs.map +1 -1
  38. package/package.json +1 -1
  39. package/resources/feedback.d.mts +333 -0
  40. package/resources/feedback.d.mts.map +1 -0
  41. package/resources/feedback.d.ts +333 -0
  42. package/resources/feedback.d.ts.map +1 -0
  43. package/resources/feedback.js +108 -0
  44. package/resources/feedback.js.map +1 -0
  45. package/resources/feedback.mjs +104 -0
  46. package/resources/feedback.mjs.map +1 -0
  47. package/resources/index.d.mts +1 -0
  48. package/resources/index.d.mts.map +1 -1
  49. package/resources/index.d.ts +1 -0
  50. package/resources/index.d.ts.map +1 -1
  51. package/resources/index.js +3 -1
  52. package/resources/index.js.map +1 -1
  53. package/resources/index.mjs +1 -0
  54. package/resources/index.mjs.map +1 -1
  55. package/resources/memory.d.mts +66 -12
  56. package/resources/memory.d.mts.map +1 -1
  57. package/resources/memory.d.ts +66 -12
  58. package/resources/memory.d.ts.map +1 -1
  59. package/resources/memory.js +11 -0
  60. package/resources/memory.js.map +1 -1
  61. package/resources/memory.mjs +11 -0
  62. package/resources/memory.mjs.map +1 -1
  63. package/resources/user.d.mts +12 -4
  64. package/resources/user.d.mts.map +1 -1
  65. package/resources/user.d.ts +12 -4
  66. package/resources/user.d.ts.map +1 -1
  67. package/src/client.ts +55 -14
  68. package/src/index.ts +2 -0
  69. package/src/internal/request-options.ts +53 -0
  70. package/src/internal/uploads.ts +1 -1
  71. package/src/internal/utils/log.ts +3 -2
  72. package/src/internal/utils/path.ts +32 -7
  73. package/src/resources/feedback.ts +424 -0
  74. package/src/resources/index.ts +9 -0
  75. package/src/resources/memory.ts +74 -13
  76. package/src/resources/user.ts +4 -4
  77. package/src/version.ts +1 -1
  78. package/version.d.mts +1 -1
  79. package/version.d.mts.map +1 -1
  80. package/version.d.ts +1 -1
  81. package/version.d.ts.map +1 -1
  82. package/version.js +1 -1
  83. package/version.js.map +1 -1
  84. package/version.mjs +1 -1
  85. package/version.mjs.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"path.mjs","sourceRoot":"","sources":["../../src/internal/utils/path.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE;AAEpB;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,OAAO,CAAC,kCAAkC,EAAE,kBAAkB,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,C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,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;aACnB,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,KAAK,SAAS,EAAE,CACvC,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEJ;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papr/memory",
3
- "version": "1.8.3",
3
+ "version": "1.10.0",
4
4
  "description": "The official TypeScript library for the Papr API",
5
5
  "author": "Papr <support@papr.ai>",
6
6
  "types": "./index.d.ts",
@@ -0,0 +1,333 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { RequestOptions } from "../internal/request-options.mjs";
4
+ export declare class Feedback extends APIResource {
5
+ /**
6
+ * Retrieve feedback by ID.
7
+ *
8
+ * This endpoint allows developers to fetch feedback details by feedback ID.
9
+ * Only the user who created the feedback or users with appropriate permissions can access it.
10
+ *
11
+ * **Authentication Required**:
12
+ * One of the following authentication methods must be used:
13
+ * - Bearer token in `Authorization` header
14
+ * - API Key in `X-API-Key` header
15
+ * - Session token in `X-Session-Token` header
16
+ *
17
+ * **Required Headers**:
18
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const feedbackResponse = await client.feedback.getByID(
23
+ * 'feedback_id',
24
+ * );
25
+ * ```
26
+ */
27
+ getByID(feedbackID: string, options?: RequestOptions): APIPromise<FeedbackResponse>;
28
+ /**
29
+ * Submit feedback on search results to help improve model performance.
30
+ *
31
+ * This endpoint allows developers to provide feedback on:
32
+ * - Overall answer quality (thumbs up/down, ratings)
33
+ * - Specific memory relevance and accuracy
34
+ * - User engagement signals (copy, save, create document actions)
35
+ * - Corrections and improvements
36
+ *
37
+ * The feedback is used to train and improve:
38
+ * - Router model tier predictions
39
+ * - Memory retrieval ranking
40
+ * - Answer generation quality
41
+ * - Agentic graph search performance
42
+ *
43
+ * **Authentication Required**:
44
+ * One of the following authentication methods must be used:
45
+ * - Bearer token in `Authorization` header
46
+ * - API Key in `X-API-Key` header
47
+ * - Session token in `X-Session-Token` header
48
+ *
49
+ * **Required Headers**:
50
+ * - Content-Type: application/json
51
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const feedbackResponse = await client.feedback.submit({
56
+ * feedbackData: {
57
+ * feedbackSource: 'inline',
58
+ * feedbackType: 'thumbs_up',
59
+ * },
60
+ * search_id: 'abc123def456',
61
+ * });
62
+ * ```
63
+ */
64
+ submit(body: FeedbackSubmitParams, options?: RequestOptions): APIPromise<FeedbackResponse>;
65
+ /**
66
+ * Submit multiple feedback items in a single request.
67
+ *
68
+ * Useful for submitting session-end feedback or bulk feedback collection.
69
+ * Each feedback item is processed independently, so partial success is possible.
70
+ *
71
+ * **Authentication Required**:
72
+ * One of the following authentication methods must be used:
73
+ * - Bearer token in `Authorization` header
74
+ * - API Key in `X-API-Key` header
75
+ * - Session token in `X-Session-Token` header
76
+ *
77
+ * **Required Headers**:
78
+ * - Content-Type: application/json
79
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const batchResponse = await client.feedback.submitBatch({
84
+ * feedback_items: [
85
+ * {
86
+ * feedbackData: {
87
+ * feedbackSource: 'inline',
88
+ * feedbackType: 'thumbs_up',
89
+ * },
90
+ * search_id: 'abc123def456',
91
+ * },
92
+ * ],
93
+ * });
94
+ * ```
95
+ */
96
+ submitBatch(body: FeedbackSubmitBatchParams, options?: RequestOptions): APIPromise<BatchResponse>;
97
+ }
98
+ /**
99
+ * Request model for submitting multiple feedback items
100
+ */
101
+ export interface BatchRequest {
102
+ /**
103
+ * List of feedback items to submit
104
+ */
105
+ feedback_items: Array<FeedbackRequest>;
106
+ /**
107
+ * Session-level context for batch feedback
108
+ */
109
+ session_context?: {
110
+ [key: string]: unknown;
111
+ } | null;
112
+ }
113
+ /**
114
+ * Response model for batch feedback submission
115
+ */
116
+ export interface BatchResponse {
117
+ /**
118
+ * HTTP status code
119
+ */
120
+ code: number;
121
+ /**
122
+ * Human-readable message
123
+ */
124
+ message: string;
125
+ /**
126
+ * 'success' or 'error'
127
+ */
128
+ status: string;
129
+ /**
130
+ * Error message if status is 'error'
131
+ */
132
+ error?: string | null;
133
+ /**
134
+ * List of error details
135
+ */
136
+ errors?: Array<{
137
+ [key: string]: unknown;
138
+ }>;
139
+ /**
140
+ * Number of failed feedback items
141
+ */
142
+ failed_count?: number;
143
+ /**
144
+ * List of feedback IDs
145
+ */
146
+ feedback_ids?: Array<string>;
147
+ /**
148
+ * Number of successfully processed feedback items
149
+ */
150
+ successful_count?: number;
151
+ }
152
+ /**
153
+ * Request model for submitting feedback on search results
154
+ */
155
+ export interface FeedbackRequest {
156
+ /**
157
+ * The feedback data containing all feedback information
158
+ */
159
+ feedbackData: FeedbackRequest.FeedbackData;
160
+ /**
161
+ * The search_id from SearchResponse that this feedback relates to
162
+ */
163
+ search_id: string;
164
+ /**
165
+ * External user ID for developer API keys acting on behalf of end users
166
+ */
167
+ external_user_id?: string | null;
168
+ /**
169
+ * Internal user ID (if not provided, will be resolved from authentication)
170
+ */
171
+ user_id?: string | null;
172
+ }
173
+ export declare namespace FeedbackRequest {
174
+ /**
175
+ * The feedback data containing all feedback information
176
+ */
177
+ interface FeedbackData {
178
+ /**
179
+ * Where the feedback was provided from
180
+ */
181
+ feedbackSource: 'inline' | 'post_query' | 'session_end' | 'memory_citation' | 'answer_panel';
182
+ /**
183
+ * Types of feedback that can be provided
184
+ */
185
+ feedbackType: 'thumbs_up' | 'thumbs_down' | 'rating' | 'correction' | 'report' | 'copy_action' | 'save_action' | 'create_document' | 'memory_relevance' | 'answer_quality';
186
+ /**
187
+ * A pointer to a Parse object
188
+ */
189
+ assistantMessage?: FeedbackData.AssistantMessage | null;
190
+ citedMemoryIds?: Array<string> | null;
191
+ citedNodeIds?: Array<string> | null;
192
+ feedbackImpact?: string | null;
193
+ feedbackProcessed?: boolean | null;
194
+ feedbackScore?: number | null;
195
+ feedbackText?: string | null;
196
+ feedbackValue?: string | null;
197
+ /**
198
+ * A pointer to a Parse object
199
+ */
200
+ userMessage?: FeedbackData.UserMessage | null;
201
+ }
202
+ namespace FeedbackData {
203
+ /**
204
+ * A pointer to a Parse object
205
+ */
206
+ interface AssistantMessage {
207
+ className: string;
208
+ objectId: string;
209
+ __type?: string;
210
+ }
211
+ /**
212
+ * A pointer to a Parse object
213
+ */
214
+ interface UserMessage {
215
+ className: string;
216
+ objectId: string;
217
+ __type?: string;
218
+ }
219
+ }
220
+ }
221
+ /**
222
+ * Response model for feedback submission
223
+ */
224
+ export interface FeedbackResponse {
225
+ /**
226
+ * HTTP status code
227
+ */
228
+ code: number;
229
+ /**
230
+ * Human-readable message
231
+ */
232
+ message: string;
233
+ /**
234
+ * 'success' or 'error'
235
+ */
236
+ status: string;
237
+ /**
238
+ * Additional error details
239
+ */
240
+ details?: {
241
+ [key: string]: unknown;
242
+ } | null;
243
+ /**
244
+ * Error message if status is 'error'
245
+ */
246
+ error?: string | null;
247
+ /**
248
+ * Unique feedback ID
249
+ */
250
+ feedback_id?: string | null;
251
+ }
252
+ export interface FeedbackSubmitParams {
253
+ /**
254
+ * The feedback data containing all feedback information
255
+ */
256
+ feedbackData: FeedbackSubmitParams.FeedbackData;
257
+ /**
258
+ * The search_id from SearchResponse that this feedback relates to
259
+ */
260
+ search_id: string;
261
+ /**
262
+ * External user ID for developer API keys acting on behalf of end users
263
+ */
264
+ external_user_id?: string | null;
265
+ /**
266
+ * Internal user ID (if not provided, will be resolved from authentication)
267
+ */
268
+ user_id?: string | null;
269
+ }
270
+ export declare namespace FeedbackSubmitParams {
271
+ /**
272
+ * The feedback data containing all feedback information
273
+ */
274
+ interface FeedbackData {
275
+ /**
276
+ * Where the feedback was provided from
277
+ */
278
+ feedbackSource: 'inline' | 'post_query' | 'session_end' | 'memory_citation' | 'answer_panel';
279
+ /**
280
+ * Types of feedback that can be provided
281
+ */
282
+ feedbackType: 'thumbs_up' | 'thumbs_down' | 'rating' | 'correction' | 'report' | 'copy_action' | 'save_action' | 'create_document' | 'memory_relevance' | 'answer_quality';
283
+ /**
284
+ * A pointer to a Parse object
285
+ */
286
+ assistantMessage?: FeedbackData.AssistantMessage | null;
287
+ citedMemoryIds?: Array<string> | null;
288
+ citedNodeIds?: Array<string> | null;
289
+ feedbackImpact?: string | null;
290
+ feedbackProcessed?: boolean | null;
291
+ feedbackScore?: number | null;
292
+ feedbackText?: string | null;
293
+ feedbackValue?: string | null;
294
+ /**
295
+ * A pointer to a Parse object
296
+ */
297
+ userMessage?: FeedbackData.UserMessage | null;
298
+ }
299
+ namespace FeedbackData {
300
+ /**
301
+ * A pointer to a Parse object
302
+ */
303
+ interface AssistantMessage {
304
+ className: string;
305
+ objectId: string;
306
+ __type?: string;
307
+ }
308
+ /**
309
+ * A pointer to a Parse object
310
+ */
311
+ interface UserMessage {
312
+ className: string;
313
+ objectId: string;
314
+ __type?: string;
315
+ }
316
+ }
317
+ }
318
+ export interface FeedbackSubmitBatchParams {
319
+ /**
320
+ * List of feedback items to submit
321
+ */
322
+ feedback_items: Array<FeedbackRequest>;
323
+ /**
324
+ * Session-level context for batch feedback
325
+ */
326
+ session_context?: {
327
+ [key: string]: unknown;
328
+ } | null;
329
+ }
330
+ export declare namespace Feedback {
331
+ export { type BatchRequest as BatchRequest, type BatchResponse as BatchResponse, type FeedbackRequest as FeedbackRequest, type FeedbackResponse as FeedbackResponse, type FeedbackSubmitParams as FeedbackSubmitParams, type FeedbackSubmitBatchParams as FeedbackSubmitBatchParams, };
332
+ }
333
+ //# sourceMappingURL=feedback.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback.d.mts","source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B,EACzC,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,yBAAyB,IAAI,yBAAyB,GAC5D,CAAC;CACH"}
@@ -0,0 +1,333 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import { APIPromise } from "../core/api-promise.js";
3
+ import { RequestOptions } from "../internal/request-options.js";
4
+ export declare class Feedback extends APIResource {
5
+ /**
6
+ * Retrieve feedback by ID.
7
+ *
8
+ * This endpoint allows developers to fetch feedback details by feedback ID.
9
+ * Only the user who created the feedback or users with appropriate permissions can access it.
10
+ *
11
+ * **Authentication Required**:
12
+ * One of the following authentication methods must be used:
13
+ * - Bearer token in `Authorization` header
14
+ * - API Key in `X-API-Key` header
15
+ * - Session token in `X-Session-Token` header
16
+ *
17
+ * **Required Headers**:
18
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const feedbackResponse = await client.feedback.getByID(
23
+ * 'feedback_id',
24
+ * );
25
+ * ```
26
+ */
27
+ getByID(feedbackID: string, options?: RequestOptions): APIPromise<FeedbackResponse>;
28
+ /**
29
+ * Submit feedback on search results to help improve model performance.
30
+ *
31
+ * This endpoint allows developers to provide feedback on:
32
+ * - Overall answer quality (thumbs up/down, ratings)
33
+ * - Specific memory relevance and accuracy
34
+ * - User engagement signals (copy, save, create document actions)
35
+ * - Corrections and improvements
36
+ *
37
+ * The feedback is used to train and improve:
38
+ * - Router model tier predictions
39
+ * - Memory retrieval ranking
40
+ * - Answer generation quality
41
+ * - Agentic graph search performance
42
+ *
43
+ * **Authentication Required**:
44
+ * One of the following authentication methods must be used:
45
+ * - Bearer token in `Authorization` header
46
+ * - API Key in `X-API-Key` header
47
+ * - Session token in `X-Session-Token` header
48
+ *
49
+ * **Required Headers**:
50
+ * - Content-Type: application/json
51
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const feedbackResponse = await client.feedback.submit({
56
+ * feedbackData: {
57
+ * feedbackSource: 'inline',
58
+ * feedbackType: 'thumbs_up',
59
+ * },
60
+ * search_id: 'abc123def456',
61
+ * });
62
+ * ```
63
+ */
64
+ submit(body: FeedbackSubmitParams, options?: RequestOptions): APIPromise<FeedbackResponse>;
65
+ /**
66
+ * Submit multiple feedback items in a single request.
67
+ *
68
+ * Useful for submitting session-end feedback or bulk feedback collection.
69
+ * Each feedback item is processed independently, so partial success is possible.
70
+ *
71
+ * **Authentication Required**:
72
+ * One of the following authentication methods must be used:
73
+ * - Bearer token in `Authorization` header
74
+ * - API Key in `X-API-Key` header
75
+ * - Session token in `X-Session-Token` header
76
+ *
77
+ * **Required Headers**:
78
+ * - Content-Type: application/json
79
+ * - X-Client-Type: (e.g., 'papr_plugin', 'browser_extension')
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const batchResponse = await client.feedback.submitBatch({
84
+ * feedback_items: [
85
+ * {
86
+ * feedbackData: {
87
+ * feedbackSource: 'inline',
88
+ * feedbackType: 'thumbs_up',
89
+ * },
90
+ * search_id: 'abc123def456',
91
+ * },
92
+ * ],
93
+ * });
94
+ * ```
95
+ */
96
+ submitBatch(body: FeedbackSubmitBatchParams, options?: RequestOptions): APIPromise<BatchResponse>;
97
+ }
98
+ /**
99
+ * Request model for submitting multiple feedback items
100
+ */
101
+ export interface BatchRequest {
102
+ /**
103
+ * List of feedback items to submit
104
+ */
105
+ feedback_items: Array<FeedbackRequest>;
106
+ /**
107
+ * Session-level context for batch feedback
108
+ */
109
+ session_context?: {
110
+ [key: string]: unknown;
111
+ } | null;
112
+ }
113
+ /**
114
+ * Response model for batch feedback submission
115
+ */
116
+ export interface BatchResponse {
117
+ /**
118
+ * HTTP status code
119
+ */
120
+ code: number;
121
+ /**
122
+ * Human-readable message
123
+ */
124
+ message: string;
125
+ /**
126
+ * 'success' or 'error'
127
+ */
128
+ status: string;
129
+ /**
130
+ * Error message if status is 'error'
131
+ */
132
+ error?: string | null;
133
+ /**
134
+ * List of error details
135
+ */
136
+ errors?: Array<{
137
+ [key: string]: unknown;
138
+ }>;
139
+ /**
140
+ * Number of failed feedback items
141
+ */
142
+ failed_count?: number;
143
+ /**
144
+ * List of feedback IDs
145
+ */
146
+ feedback_ids?: Array<string>;
147
+ /**
148
+ * Number of successfully processed feedback items
149
+ */
150
+ successful_count?: number;
151
+ }
152
+ /**
153
+ * Request model for submitting feedback on search results
154
+ */
155
+ export interface FeedbackRequest {
156
+ /**
157
+ * The feedback data containing all feedback information
158
+ */
159
+ feedbackData: FeedbackRequest.FeedbackData;
160
+ /**
161
+ * The search_id from SearchResponse that this feedback relates to
162
+ */
163
+ search_id: string;
164
+ /**
165
+ * External user ID for developer API keys acting on behalf of end users
166
+ */
167
+ external_user_id?: string | null;
168
+ /**
169
+ * Internal user ID (if not provided, will be resolved from authentication)
170
+ */
171
+ user_id?: string | null;
172
+ }
173
+ export declare namespace FeedbackRequest {
174
+ /**
175
+ * The feedback data containing all feedback information
176
+ */
177
+ interface FeedbackData {
178
+ /**
179
+ * Where the feedback was provided from
180
+ */
181
+ feedbackSource: 'inline' | 'post_query' | 'session_end' | 'memory_citation' | 'answer_panel';
182
+ /**
183
+ * Types of feedback that can be provided
184
+ */
185
+ feedbackType: 'thumbs_up' | 'thumbs_down' | 'rating' | 'correction' | 'report' | 'copy_action' | 'save_action' | 'create_document' | 'memory_relevance' | 'answer_quality';
186
+ /**
187
+ * A pointer to a Parse object
188
+ */
189
+ assistantMessage?: FeedbackData.AssistantMessage | null;
190
+ citedMemoryIds?: Array<string> | null;
191
+ citedNodeIds?: Array<string> | null;
192
+ feedbackImpact?: string | null;
193
+ feedbackProcessed?: boolean | null;
194
+ feedbackScore?: number | null;
195
+ feedbackText?: string | null;
196
+ feedbackValue?: string | null;
197
+ /**
198
+ * A pointer to a Parse object
199
+ */
200
+ userMessage?: FeedbackData.UserMessage | null;
201
+ }
202
+ namespace FeedbackData {
203
+ /**
204
+ * A pointer to a Parse object
205
+ */
206
+ interface AssistantMessage {
207
+ className: string;
208
+ objectId: string;
209
+ __type?: string;
210
+ }
211
+ /**
212
+ * A pointer to a Parse object
213
+ */
214
+ interface UserMessage {
215
+ className: string;
216
+ objectId: string;
217
+ __type?: string;
218
+ }
219
+ }
220
+ }
221
+ /**
222
+ * Response model for feedback submission
223
+ */
224
+ export interface FeedbackResponse {
225
+ /**
226
+ * HTTP status code
227
+ */
228
+ code: number;
229
+ /**
230
+ * Human-readable message
231
+ */
232
+ message: string;
233
+ /**
234
+ * 'success' or 'error'
235
+ */
236
+ status: string;
237
+ /**
238
+ * Additional error details
239
+ */
240
+ details?: {
241
+ [key: string]: unknown;
242
+ } | null;
243
+ /**
244
+ * Error message if status is 'error'
245
+ */
246
+ error?: string | null;
247
+ /**
248
+ * Unique feedback ID
249
+ */
250
+ feedback_id?: string | null;
251
+ }
252
+ export interface FeedbackSubmitParams {
253
+ /**
254
+ * The feedback data containing all feedback information
255
+ */
256
+ feedbackData: FeedbackSubmitParams.FeedbackData;
257
+ /**
258
+ * The search_id from SearchResponse that this feedback relates to
259
+ */
260
+ search_id: string;
261
+ /**
262
+ * External user ID for developer API keys acting on behalf of end users
263
+ */
264
+ external_user_id?: string | null;
265
+ /**
266
+ * Internal user ID (if not provided, will be resolved from authentication)
267
+ */
268
+ user_id?: string | null;
269
+ }
270
+ export declare namespace FeedbackSubmitParams {
271
+ /**
272
+ * The feedback data containing all feedback information
273
+ */
274
+ interface FeedbackData {
275
+ /**
276
+ * Where the feedback was provided from
277
+ */
278
+ feedbackSource: 'inline' | 'post_query' | 'session_end' | 'memory_citation' | 'answer_panel';
279
+ /**
280
+ * Types of feedback that can be provided
281
+ */
282
+ feedbackType: 'thumbs_up' | 'thumbs_down' | 'rating' | 'correction' | 'report' | 'copy_action' | 'save_action' | 'create_document' | 'memory_relevance' | 'answer_quality';
283
+ /**
284
+ * A pointer to a Parse object
285
+ */
286
+ assistantMessage?: FeedbackData.AssistantMessage | null;
287
+ citedMemoryIds?: Array<string> | null;
288
+ citedNodeIds?: Array<string> | null;
289
+ feedbackImpact?: string | null;
290
+ feedbackProcessed?: boolean | null;
291
+ feedbackScore?: number | null;
292
+ feedbackText?: string | null;
293
+ feedbackValue?: string | null;
294
+ /**
295
+ * A pointer to a Parse object
296
+ */
297
+ userMessage?: FeedbackData.UserMessage | null;
298
+ }
299
+ namespace FeedbackData {
300
+ /**
301
+ * A pointer to a Parse object
302
+ */
303
+ interface AssistantMessage {
304
+ className: string;
305
+ objectId: string;
306
+ __type?: string;
307
+ }
308
+ /**
309
+ * A pointer to a Parse object
310
+ */
311
+ interface UserMessage {
312
+ className: string;
313
+ objectId: string;
314
+ __type?: string;
315
+ }
316
+ }
317
+ }
318
+ export interface FeedbackSubmitBatchParams {
319
+ /**
320
+ * List of feedback items to submit
321
+ */
322
+ feedback_items: Array<FeedbackRequest>;
323
+ /**
324
+ * Session-level context for batch feedback
325
+ */
326
+ session_context?: {
327
+ [key: string]: unknown;
328
+ } | null;
329
+ }
330
+ export declare namespace Feedback {
331
+ export { type BatchRequest as BatchRequest, type BatchResponse as BatchResponse, type FeedbackRequest as FeedbackRequest, type FeedbackResponse as FeedbackResponse, type FeedbackSubmitParams as FeedbackSubmitParams, type FeedbackSubmitBatchParams as FeedbackSubmitBatchParams, };
332
+ }
333
+ //# sourceMappingURL=feedback.d.ts.map