Repository navigation
Expand file tree
/
Copy pathAUTO_NOTES_OPENAPI.yaml
More file actions
431 lines (416 loc) · 13.4 KB
/
Copy pathAUTO_NOTES_OPENAPI.yaml
File metadata and controls
431 lines (416 loc) · 13.4 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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
openapi: 3.0.3
info:
title: FlowReader Auto Notes API
description: |
Intelligent automatic note generation API that integrates with FlowReader's T5 Knowledge Enhancement
and T7 Dialog History systems to provide context-aware note creation.
version: 1.0.0
contact:
name: FlowReader API Team
license:
name: Proprietary
servers:
- url: https://api.flowreader.com
description: Production server
- url: https://staging-api.flowreader.com
description: Staging server
security:
- bearerAuth: []
paths:
/api/notes/auto:
post:
summary: Generate automatic note
description: |
Creates an intelligent note based on text selection, reading context, or dialog history.
Integrates with T5 Knowledge Enhancement for structured analysis and T7 Dialog History for context.
operationId: generateAutoNote
tags:
- Auto Notes
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AutoNoteRequest'
examples:
enhance_selection:
summary: Enhance text selection
value:
bookId: "123e4567-e89b-12d3-a456-426614174000"
selection:
text: "The concept of quantum entanglement"
start: 1250
end: 1285
chapterId: "456e7890-e89b-12d3-a456-426614174000"
intent: "enhance"
dialog_summary:
summary: Summarize recent dialog
value:
bookId: "123e4567-e89b-12d3-a456-426614174000"
contextScope: "recent_dialog"
options:
includeMetrics: true
maxLength: 1500
explain_chapter:
summary: Explain chapter content
value:
bookId: "123e4567-e89b-12d3-a456-426614174000"
contextScope: "chapter"
intent: "explain"
responses:
'201':
description: Auto note generated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/AutoNoteResponse'
example:
id: "789e0123-e89b-12d3-a456-426614174000"
userId: "abc12345-e89b-12d3-a456-426614174000"
bookId: "123e4567-e89b-12d3-a456-426614174000"
chapterId: "456e7890-e89b-12d3-a456-426614174000"
selection:
text: "The concept of quantum entanglement"
start: 1250
end: 1285
chapterId: "456e7890-e89b-12d3-a456-426614174000"
content: "**Quantum Entanglement** refers to a quantum mechanical phenomenon where particles become interconnected and the quantum state of each particle cannot be described independently..."
source: "auto"
meta:
intent: "enhance"
generationMethod: "knowledge_enhancement"
confidence: 0.87
sourceSelection:
text: "The concept of quantum entanglement"
start: 1250
end: 1285
contextScope: "selection"
metrics:
tokens: 456
cost: 0.0234
processingTime: 3420
createdAt: "2024-01-01T12:34:56.789Z"
'400':
description: Bad Request - Invalid input parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
missing_book_id:
summary: Missing bookId
value:
error:
code: "VALIDATION_ERROR"
message: "Request validation failed"
details:
errors:
- field: "bookId"
message: "bookId is required"
invalid_selection_length:
summary: Selection text too long
value:
error:
code: "VALIDATION_ERROR"
message: "Request validation failed"
details:
errors:
- field: "selection.text"
message: "Selection text must be 1000 characters or less"
'401':
description: Unauthorized - Authentication required
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error:
code: "UNAUTHORIZED"
message: "Authentication required"
'403':
description: Forbidden - Access denied to book
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error:
code: "FORBIDDEN"
message: "Access denied to this book"
details:
bookId: "123e4567-e89b-12d3-a456-426614174000"
reason: "not_owner"
'422':
description: Unprocessable Entity - Invalid parameter combination
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error:
code: "UNPROCESSABLE_ENTITY"
message: "Invalid parameter combination"
details:
reason: "selection_required_for_intent"
intent: "enhance"
'429':
description: Too Many Requests - Rate limit exceeded
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error:
code: "RATE_LIMITED"
message: "Auto note generation rate limit exceeded"
details:
limit: 20
window: "1 hour"
reset_time: "2024-01-01T15:00:00Z"
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error:
code: "INTERNAL_ERROR"
message: "Auto note generation failed"
details:
retry_after: 30
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: JWT token obtained from authentication endpoint
schemas:
AutoNoteRequest:
type: object
required:
- bookId
properties:
bookId:
type: string
format: uuid
description: UUID of the book for which to generate the note
example: "123e4567-e89b-12d3-a456-426614174000"
selection:
$ref: '#/components/schemas/TextSelection'
intent:
$ref: '#/components/schemas/IntentType'
contextScope:
$ref: '#/components/schemas/ContextScope'
options:
$ref: '#/components/schemas/AutoNoteOptions'
AutoNoteOptions:
type: object
properties:
maxLength:
type: integer
minimum: 50
maximum: 4000
default: 2000
description: Maximum length of generated note content
example: 1500
includeMetrics:
type: boolean
default: false
description: Whether to include generation metrics in response
example: true
TextSelection:
type: object
required:
- text
properties:
text:
type: string
maxLength: 1000
description: Selected text content
example: "The concept of quantum entanglement"
start:
type: integer
minimum: 0
description: Start position of selection
example: 1250
end:
type: integer
minimum: 0
description: End position of selection
example: 1285
chapterId:
type: string
format: uuid
description: Chapter identifier where selection is located
example: "456e7890-e89b-12d3-a456-426614174000"
IntentType:
type: string
enum:
- translate
- explain
- analyze
- ask
- enhance
description: |
Intent for note generation:
- translate: Create translation notes
- explain: Generate explanatory content
- analyze: Provide analytical insights
- ask: Generate Q&A style content
- enhance: Use T5 Knowledge Enhancer for structured analysis
example: "enhance"
ContextScope:
type: string
enum:
- selection
- recent_dialog
- chapter
default: selection
description: |
Context scope for generation:
- selection: Based on provided text selection
- recent_dialog: Summarize recent T7 dialog history
- chapter: Generate chapter-based contextual summary
example: "selection"
GenerationMethod:
type: string
enum:
- knowledge_enhancement
- dialog_summary
- context_analysis
description: |
Method used for note generation:
- knowledge_enhancement: T5 Knowledge Enhancer integration
- dialog_summary: T7 Dialog History summarization
- context_analysis: General context-based analysis
example: "knowledge_enhancement"
AutoNoteResponse:
type: object
required:
- id
- userId
- bookId
- content
- source
- meta
- createdAt
properties:
id:
type: string
format: uuid
description: Generated note UUID
example: "789e0123-e89b-12d3-a456-426614174000"
userId:
type: string
format: uuid
description: User UUID
example: "abc12345-e89b-12d3-a456-426614174000"
bookId:
type: string
format: uuid
description: Book UUID
example: "123e4567-e89b-12d3-a456-426614174000"
chapterId:
type: string
format: uuid
description: Chapter UUID (if applicable)
example: "456e7890-e89b-12d3-a456-426614174000"
selection:
$ref: '#/components/schemas/TextSelection'
content:
type: string
minLength: 50
maxLength: 4000
description: Generated note content
example: "**Quantum Entanglement** refers to a quantum mechanical phenomenon where particles become interconnected..."
source:
type: string
enum:
- auto
description: Always 'auto' for this endpoint
example: "auto"
meta:
$ref: '#/components/schemas/AutoNoteMeta'
metrics:
$ref: '#/components/schemas/NoteMetrics'
createdAt:
type: string
format: date-time
description: ISO timestamp of note creation
example: "2024-01-01T12:34:56.789Z"
AutoNoteMeta:
type: object
required:
- generationMethod
- confidence
properties:
intent:
$ref: '#/components/schemas/IntentType'
generationMethod:
$ref: '#/components/schemas/GenerationMethod'
confidence:
type: number
minimum: 0
maximum: 1
description: Quality confidence score (0-1)
example: 0.87
sourceSelection:
$ref: '#/components/schemas/TextSelection'
contextScope:
type: string
description: Context scope used for generation
example: "selection"
NoteMetrics:
type: object
required:
- tokens
- cost
- processingTime
properties:
tokens:
type: integer
minimum: 0
description: Total tokens consumed during generation
example: 456
cost:
type: number
minimum: 0
description: Estimated cost in USD
example: 0.0234
processingTime:
type: integer
minimum: 0
description: Processing time in milliseconds
example: 3420
ErrorResponse:
type: object
required:
- error
properties:
error:
type: object
required:
- code
- message
properties:
code:
type: string
description: Error code identifier
example: "VALIDATION_ERROR"
message:
type: string
description: Human-readable error message
example: "Request validation failed"
details:
type: object
description: Additional error details
additionalProperties: true
example:
errors:
- field: "bookId"
message: "bookId is required"
tags:
- name: Auto Notes
description: Intelligent automatic note generation API