-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-docs.yaml
More file actions
947 lines (899 loc) · 26.7 KB
/
api-docs.yaml
File metadata and controls
947 lines (899 loc) · 26.7 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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
openapi: 3.0.3
info:
title: OpenAI Retrieval Augmented Generation API
version: 0.0.1
paths:
/document/upload:
post:
tags:
- document
summary: Upload a document to process
description: Upload a document to extract the text, chunk it and embed the chunks and store in a vector store
operationId: doc_upload_document_upload_post
parameters:
- name: callback_url
in: query
required: false
schema:
anyOf:
- type: string
format: uri
minLength: 1
maxLength: 2083
title: Callback Url
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/Body_doc_upload_document_upload_post'
callbacks:
document_processed_notification:
'{$callback_url}':
post:
summary: Document Processed Notification
operationId: document_processed_notification__callback_url__post
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/DocumentResponse-Output'
responses:
'201':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/DocumentResponse-Input'
'409':
description: Conflict
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/document/list:
get:
tags:
- document
summary: Get list of documents
operationId: get_documents_document_list_get
parameters:
- name: page
in: query
required: false
schema:
type: integer
default: 1
title: Page
- name: size
in: query
required: false
schema:
type: integer
default: 20
title: Size
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/DocumentListResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/document/{document_id}:
get:
tags:
- document
summary: Get document details by document id
operationId: get_document_document__document_id__get
parameters:
- name: document_id
in: path
required: true
schema:
type: string
title: Document Id
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/DocumentResponse-Input'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
delete:
tags:
- document
summary: Delete document
operationId: delete_document_document__document_id__delete
parameters:
- name: document_id
in: path
required: true
schema:
type: string
title: Document Id
responses:
'204':
description: Successful Response
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/document/{document_id}/summary:
post:
tags:
- document
summary: Generate document summary
operationId: get_document_summary_document__document_id__summary_post
parameters:
- name: document_id
in: path
required: true
schema:
type: string
title: Document Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SummaryRequest'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/SummaryResponse'
'202':
description: Successful Response
content:
application/json:
schema: {}
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/collection:
post:
tags:
- collection
summary: Create a collection
description: Create a collection (collection of documents) to place documents
operationId: create_collection_collection_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CollectionModel'
required: true
responses:
'201':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/CollectionModel'
'409':
description: Conflict
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/collection/list:
get:
tags:
- collection
summary: Get list of documents
operationId: get_collection_list_collection_list_get
parameters:
- name: page
in: query
required: false
schema:
type: integer
default: 1
title: Page
- name: size
in: query
required: false
schema:
type: integer
default: 20
title: Size
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/CollectionListModel'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/collection/{collection_id}:
get:
tags:
- collection
summary: Get document details by document id
operationId: get_collection_collection__collection_id__get
parameters:
- name: collection_id
in: path
required: true
schema:
type: string
title: Collection Id
- name: with_documents
in: query
required: false
schema:
type: boolean
default: false
title: With Documents
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/CollectionModel'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/chat:
post:
tags:
- rag
summary: Ask a question from a collection or a document
operationId: chat_completion_chat_post
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ChatRequest'
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/ChatResponse'
'409':
description: Conflict
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
Body_doc_upload_document_upload_post:
properties:
file:
type: string
format: binary
title: File
collection:
anyOf:
- type: string
title: Collection
type: object
required:
- file
- collection
title: Body_doc_upload_document_upload_post
ChatRequest:
properties:
collection_name:
type: string
title: Collection Name
filter:
anyOf:
- $ref: '#/components/schemas/Filter'
query:
type: string
title: Query
llm:
anyOf:
- $ref: '#/components/schemas/LLM'
include_citations:
type: boolean
title: Include Citations
default: true
include_usage:
type: boolean
title: Include Usage
default: false
type: object
required:
- collection_name
- query
title: ChatRequest
description: |2-
Represents a request for a query on a collection of documents.
Attributes:
collection_name (str): The name of the collection to query.
filter (Filter | None, optional): Filter criteria for the query (default: None).
query (str): The query string.
llm (LLM | None, optional): Language Model configuration for the query (default: None).
ChatResponse:
properties:
result:
type: string
title: Result
citations:
anyOf:
- items:
$ref: '#/components/schemas/Citation'
type: array
title: Citations
usage:
anyOf:
- $ref: '#/components/schemas/Usage'
type: object
required:
- result
title: ChatResponse
description: |2-
Represents the response to a query.
Attributes:
result (str): The query result.
citations (list[Citation] | None, optional): List of citations (default: None).
usage (Usage | None, optional): Usage statistics (default: None).
Citation:
properties:
content:
anyOf:
- type: string
title: Content
document:
anyOf:
- type: string
title: Document
page:
anyOf:
- type: integer
title: Page
page_offset:
anyOf:
- type: integer
title: Page Offset
type: object
title: Citation
description: |2-
Represents a citation within a document.
Attributes:
content (str | None, optional): The content of the citation (default: None).
document (str | None, optional): The document associated with the citation (default: None).
page (int | None, optional): The page number of the citation (default: None).
page_offset (int | None, optional): The page offset of the citation (default: None).
CollectionListModel:
properties:
collections:
items:
$ref: '#/components/schemas/CollectionModel'
type: array
title: Collections
links:
$ref: '#/components/schemas/Links'
meta:
$ref: '#/components/schemas/Meta'
type: object
required:
- collections
- links
- meta
title: CollectionListModel
description: |2-
Represents a response containing a list of collections.
Attributes:
collections (list[CollectionModel]): List of CollectionModel objects.
links (Links): Navigation links.
meta (Meta): Metadata information.
CollectionModel:
properties:
uuid:
type: string
format: uuid4
title: Uuid
name:
type: string
title: Name
cmetadata:
anyOf:
- type: object
title: Cmetadata
documents:
anyOf:
- items:
type: string
type: array
title: Documents
type: object
required:
- name
- cmetadata
title: CollectionModel
description: |2-
Represents a collection of documents with metadata.
Attributes:
uuid (UUID4, optional): Unique identifier for the collection (default: None).
name (str): The name of the collection.
cmetadata (dict | None, optional): Custom metadata associated with the collection (default: None).
documents (list[str] | None, optional): List of document names in the collection (default: None).
DocumentListResponse:
properties:
documents:
items:
$ref: '#/components/schemas/DocumentResponse-Input'
type: array
title: Documents
links:
anyOf:
- $ref: '#/components/schemas/Links'
meta:
anyOf:
- $ref: '#/components/schemas/Meta'
type: object
required:
- documents
- links
- meta
title: DocumentListResponse
description: |2-
Represents a response containing a list of documents.
Attributes:
documents (list[DocumentResponse]): List of DocumentResponse objects.
links (Links | None, optional): Navigation links or None if not available.
meta (Meta | None, optional): Metadata information or None if not available.
DocumentResponse-Input:
properties:
id:
type: string
format: uuid4
title: Id
file_name:
type: string
title: File Name
process_status:
allOf:
- $ref: '#/components/schemas/ProcStatus'
default: pending
process_description:
anyOf:
- type: string
title: Process Description
collection_name:
anyOf:
- type: string
title: Collection Name
type: object
required:
- file_name
title: DocumentResponse
description: |2-
Represents a document response with various attributes.
Attributes:
id (UUID4, optional): The unique identifier for the document response.
file_name (str): The name of the associated file.
process_status (ProcStatus): The processing status of the document (default: 'pending').
process_description (str, optional): A description of the document processing (default: None).
collection_name (str, optional): The name of the collection the document belongs to (default: None).
model_config (ConfigDict): Configuration dictionary for model settings (generated from attributes).
DocumentResponse-Output:
properties:
id:
type: string
format: uuid4
title: Id
file_name:
type: string
title: File Name
process_status:
allOf:
- $ref: '#/components/schemas/ProcStatus'
default: pending
process_description:
anyOf:
- type: string
title: Process Description
collection_name:
anyOf:
- type: string
title: Collection Name
type: object
required:
- id
- file_name
- process_status
- process_description
- collection_name
title: DocumentResponse
description: |2-
Represents a document response with various attributes.
Attributes:
id (UUID4, optional): The unique identifier for the document response.
file_name (str): The name of the associated file.
process_status (ProcStatus): The processing status of the document (default: 'pending').
process_description (str, optional): A description of the document processing (default: None).
collection_name (str, optional): The name of the collection the document belongs to (default: None).
model_config (ConfigDict): Configuration dictionary for model settings (generated from attributes).
ErrorResponse:
properties:
status:
type: string
title: Status
default: error
message:
type: string
title: Message
exception:
anyOf:
- type: string
title: Exception
type: object
required:
- message
title: ErrorResponse
description: |2-
Error response model.
Attributes:
status (str): Status of the response ('error').
message (str): Message indicating the response status.
exception (str): String representing the exception details.
Filter:
properties:
document_name:
type: string
title: Document Name
type: object
required:
- document_name
title: Filter
description: |2-
Represents filter criteria
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
LLM:
properties:
model:
type: string
title: Model
default: gpt-3.5-turbo-0613
temperature:
type: number
maximum: 2
minimum: 0
title: Temperature
default: 0
top_p:
type: number
maximum: 1
minimum: 0
title: Top P
default: 1
max_tokens:
type: integer
minimum: 0
title: Max Tokens
default: 500
presence_penalty:
type: number
maximum: 2
minimum: -2
title: Presence Penalty
default: 0
frequency_penalty:
type: number
maximum: 2
minimum: -2
title: Frequency Penalty
default: 0
logit_bias:
anyOf:
- additionalProperties:
type: integer
type: object
title: Logit Bias
default:
'50256': -100
type: object
title: LLM
description: |2-
Represents configuration options for a Language Model (LLM).
Attributes:
model (str): The LLM model to use (default: Settings.get_settings().openai_default_llm_model).
temperature (float): The temperature parameter (default: 0, range: [0, 2]).
top_p (float): The top_p parameter (default: 1, range: [0, 1]).
max_tokens (int): The maximum number of tokens (default: 500, minimum: 0).
presence_penalty (float): The presence penalty (default: 0, range: [-2, 2]).
frequency_penalty (float): The frequency penalty (default: 0, range: [-2, 2]).
logit_bias (dict[str, int] | None): Logit bias dictionary (default: {"50256": -100}).
Links:
properties:
current_page:
type: string
maxLength: 2083
minLength: 1
format: uri
title: Current Page
first_page:
type: string
maxLength: 2083
minLength: 1
format: uri
title: First Page
prev_page:
anyOf:
- type: string
maxLength: 2083
minLength: 1
format: uri
title: Prev Page
next_page:
anyOf:
- type: string
maxLength: 2083
minLength: 1
format: uri
title: Next Page
last_page:
type: string
maxLength: 2083
minLength: 1
format: uri
title: Last Page
type: object
required:
- current_page
- first_page
- prev_page
- next_page
- last_page
title: Links
description: |2-
Represents navigation links for paginated results.
Attributes:
current_page (HttpUrl): The URL of the current page.
first_page (HttpUrl): The URL of the first page.
prev_page (HttpUrl | None, optional): The URL of the previous page or None if not available.
next_page (HttpUrl | None, optional): The URL of the next page or None if not available.
last_page (HttpUrl): The URL of the last page.
Meta:
properties:
total_records:
type: integer
title: Total Records
total_pages:
type: integer
title: Total Pages
type: object
required:
- total_records
- total_pages
title: Meta
description: |2-
Represents metadata information.
Attributes:
total_records (int): Total number of records.
total_pages (int): Total number of pages.
ProcStatus:
type: string
enum:
- pending
- complete
- error
title: ProcStatus
description: Enum representing the processing status of a document.
SummaryRequest:
properties:
regenerate:
type: boolean
title: Regenerate
default: false
synchronous:
type: boolean
title: Synchronous
default: false
type: object
title: SummaryRequest
description: |2-
Represents a request for document summary generation.
Attributes:
regenerate (bool, optional): Whether to regenerate the summary (default: False).
synchronous (bool, optional): Whether to generate the summary synchronously (default: False).
SummaryResponse:
properties:
document_id:
type: string
format: uuid4
title: Document Id
file_name:
type: string
title: File Name
summary:
type: string
title: Summary
type: object
required:
- document_id
- file_name
- summary
title: SummaryResponse
description: |2-
Represents a summary response for a document.
Attributes:
document_id (UUID4): Unique identifier for the associated document.
file_name (str): The name of the document file.
summary (str): The summary of the document.
Usage:
properties:
prompt_tokens:
type: integer
title: Prompt Tokens
completion_tokens:
type: integer
title: Completion Tokens
total_tokens:
type: integer
title: Total Tokens
type: object
required:
- prompt_tokens
- completion_tokens
- total_tokens
title: Usage
description: |2-
Represents usage statistics for a language model.
Attributes:
prompt_tokens (int): The number of tokens in the prompt.
completion_tokens (int): The number of tokens in the completion.
total_tokens (int): The total number of tokens used.
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError