-
Notifications
You must be signed in to change notification settings - Fork 0
/
eri-specification.json
531 lines (531 loc) · 17.6 KB
/
eri-specification.json
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
{
"openapi": "3.0.1",
"info": {
"title": "ERI - (E)xternal (R)etrieval (I)nterface",
"description": "This API serves as a contract between LLM tools like AI Studio and any external data sources for RAG\n(retrieval-augmented generation). The tool, e.g., AI Studio acts as the client (the augmentation and\ngeneration parts) and the data sources act as the server (the retrieval part). The data\nsources implement some form of data retrieval and return a suitable context to the LLM tool.\nThe LLM tool, in turn, handles the integration of appropriate LLMs (augmentation & generation).\nData sources can be document or graph databases, or even a file system, for example. They\nwill likely implement an appropriate retrieval process by using some kind of embedding.\nHowever, this API does not inherently require any embedding, as data processing is\nimplemented decentralized by the data sources.",
"version": "v1"
},
"paths": {
"/auth/methods": {
"get": {
"tags": [
"Authentication"
],
"description": "Get the available authentication methods.",
"operationId": "GetAuthMethods",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AuthScheme"
}
}
}
}
}
}
}
},
"/auth": {
"post": {
"tags": [
"Authentication"
],
"description": "Authenticate with the data source to get a token for further requests.",
"operationId": "Authenticate",
"parameters": [
{
"name": "authMethod",
"in": "query",
"required": true,
"schema": {
"$ref": "#/components/schemas/AuthMethod"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AuthResponse"
}
}
}
}
}
}
},
"/dataSource": {
"get": {
"tags": [
"Data Source"
],
"description": "Get information about the data source.",
"operationId": "GetDataSourceInfo",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DataSourceInfo"
}
}
}
}
}
}
},
"/embedding/info": {
"get": {
"tags": [
"Embedding"
],
"description": "Get information about the used embedding(s).",
"operationId": "GetEmbeddingInfo",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/EmbeddingInfo"
}
}
}
}
}
}
}
},
"/retrieval/info": {
"get": {
"tags": [
"Retrieval"
],
"description": "Get information about the retrieval processes implemented by this data source.",
"operationId": "GetRetrievalInfo",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RetrievalInfo"
}
}
}
}
}
}
}
},
"/retrieval": {
"post": {
"tags": [
"Retrieval"
],
"description": "Retrieve information from the data source.",
"operationId": "Retrieve",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RetrievalRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Context"
}
}
}
}
}
}
}
},
"/security/requirements": {
"get": {
"tags": [
"Security"
],
"description": "Get the security requirements for this data source.",
"operationId": "GetSecurityRequirements",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SecurityRequirements"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"AuthField": {
"enum": [
"NONE",
"USERNAME",
"PASSWORD",
"TOKEN",
"KERBEROS_TICKET"
],
"type": "string",
"description": "An authentication field."
},
"AuthFieldMapping": {
"type": "object",
"properties": {
"authField": {
"$ref": "#/components/schemas/AuthField"
},
"fieldName": {
"type": "string",
"description": "The field name in the authentication request.",
"nullable": true
}
},
"additionalProperties": false,
"description": "The mapping between an AuthField and the field name in the authentication request."
},
"AuthMethod": {
"enum": [
"NONE",
"KERBEROS",
"USERNAME_PASSWORD",
"TOKEN"
],
"type": "string"
},
"AuthResponse": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "True, when the authentication was successful."
},
"token": {
"type": "string",
"description": "The token to use for further requests.",
"nullable": true
},
"message": {
"type": "string",
"description": "When the authentication was not successful, this contains the reason.",
"nullable": true
}
},
"additionalProperties": false,
"description": "The response to an authentication request."
},
"AuthScheme": {
"type": "object",
"properties": {
"authMethod": {
"$ref": "#/components/schemas/AuthMethod"
},
"authFieldMappings": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AuthFieldMapping"
},
"description": "A list of field mappings for the authentication method. The client must know,\r\n e.g., how the password field is named in the request.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Describes one authentication scheme for this data source."
},
"ChatThread": {
"type": "object",
"properties": {
"contentBlocks": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ContentBlock"
},
"description": "The content blocks in this chat thread.",
"nullable": true
}
},
"additionalProperties": false,
"description": "A chat thread, which is a list of content blocks."
},
"ContentBlock": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The content of the block. Remember that images and other media are base64 encoded.",
"nullable": true
},
"role": {
"$ref": "#/components/schemas/Role"
},
"type": {
"$ref": "#/components/schemas/ContentType"
}
},
"additionalProperties": false,
"description": "A block of content of a chat thread."
},
"ContentType": {
"enum": [
"NONE",
"UNKNOWN",
"TEXT",
"IMAGE",
"VIDEO",
"AUDIO",
"SPEECH"
],
"type": "string",
"description": "The type of content."
},
"Context": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the source, e.g., a document name, database name,\r\n collection name, etc.",
"nullable": true
},
"category": {
"type": "string",
"description": "What are the contents of the source? For example, is it a\r\n dictionary, a book chapter, business concept, a paper, etc.",
"nullable": true
},
"path": {
"type": "string",
"description": "The path to the content, e.g., a URL, a file path, a path in a\r\n graph database, etc.",
"nullable": true
},
"type": {
"$ref": "#/components/schemas/ContentType"
},
"matchedContent": {
"type": "string",
"description": "The content that matched the user prompt. For text, you\r\n return the matched text and, e.g., three words before and after it.",
"nullable": true
},
"surroundingContent": {
"type": "array",
"items": {
"type": "string"
},
"description": "The surrounding content of the matched content.\r\n For text, you may return, e.g., one sentence or paragraph before and after\r\n the matched content.",
"nullable": true
},
"links": {
"type": "array",
"items": {
"type": "string"
},
"description": "Links to related content, e.g., links to Wikipedia articles,\r\n links to sources, etc.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Matching context returned by the data source as a result of a retrieval request."
},
"DataSourceInfo": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the data source, e.g., \"Internal Organization Documents.\"",
"nullable": true
},
"description": {
"type": "string",
"description": "A short description of the data source. What kind of data does it contain?\r\n What is the data source used for?",
"nullable": true
}
},
"additionalProperties": false,
"description": "Information about the data source."
},
"EmbeddingInfo": {
"type": "object",
"properties": {
"embeddingType": {
"type": "string",
"description": "What kind of embedding is used. For example, \"Transformer Embedding,\" \"Contextual Word\r\n Embedding,\" \"Graph Embedding,\" etc.",
"nullable": true
},
"embeddingName": {
"type": "string",
"description": "Name the embedding used. This can be a library, a framework, or the name of the used\r\n algorithm.",
"nullable": true
},
"description": {
"type": "string",
"description": "A short description of the embedding. Describe what the embedding is doing.",
"nullable": true
},
"usedWhen": {
"type": "string",
"description": "Describe when the embedding is used. For example, when the user prompt contains certain\r\n keywords, or anytime?",
"nullable": true
},
"link": {
"type": "string",
"description": "A link to the embedding's documentation or the source code. Might be null.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Represents information about the used embedding for this data source. The purpose of this information is to give the\r\ninterested user an idea of what kind of embedding is used and what it does."
},
"ProviderType": {
"enum": [
"NONE",
"ANY",
"SELF_HOSTED"
],
"type": "string",
"description": "Known types of providers that can process data."
},
"RetrievalInfo": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "A unique identifier for the retrieval process. This can be a GUID, a unique name, or an increasing integer.",
"nullable": true
},
"name": {
"type": "string",
"description": "The name of the retrieval process, e.g., \"Keyword-Based Wikipedia Article Retrieval\".",
"nullable": true
},
"description": {
"type": "string",
"description": "A short description of the retrieval process. What kind of retrieval process is it?",
"nullable": true
},
"link": {
"type": "string",
"description": "A link to the retrieval process's documentation, paper, Wikipedia article, or the source code. Might be null.",
"nullable": true
},
"parametersDescription": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "A dictionary that describes the parameters of the retrieval process. The key is the parameter name,\r\n and the value is a description of the parameter. Although each parameter will be sent as a string, the description should indicate the\r\n expected type and range, e.g., 0.0 to 1.0 for a float parameter.",
"nullable": true
},
"embeddings": {
"type": "array",
"items": {
"$ref": "#/components/schemas/EmbeddingInfo"
},
"description": "A list of embeddings used in this retrieval process. It might be empty in case no embedding is used.",
"nullable": true
}
},
"additionalProperties": false,
"description": "Information about a retrieval process, which this data source implements."
},
"RetrievalRequest": {
"type": "object",
"properties": {
"latestUserPrompt": {
"type": "string",
"description": "The latest user prompt that AI Studio received.",
"nullable": true
},
"latestUserPromptType": {
"$ref": "#/components/schemas/ContentType"
},
"thread": {
"$ref": "#/components/schemas/ChatThread"
},
"retrievalProcessId": {
"type": "string",
"description": "Optional. The ID of the retrieval process that the data source should use.\r\n When null, the data source chooses an appropriate retrieval process. Selecting a retrieval process is optional\r\n for AI Studio users. Most users do not specify a retrieval process.",
"nullable": true
},
"parameters": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "A dictionary of parameters that the data source should use for the retrieval process.\r\n Although each parameter will be sent as a string, the retrieval process specifies the expected type and range.",
"nullable": true
},
"maxMatches": {
"type": "integer",
"description": "The maximum number of matches that the data source should return. AI Studio uses\r\n any value below 1 to indicate that the data source should return as many matches as appropriate.",
"format": "int32"
}
},
"additionalProperties": false,
"description": "The retrieval request sent by AI Studio."
},
"Role": {
"enum": [
"NONE",
"UNKNOW",
"SYSTEM",
"USER",
"AI",
"AGENT"
],
"type": "string",
"description": "Possible roles of any chat thread."
},
"SecurityRequirements": {
"type": "object",
"properties": {
"allowedProviderType": {
"$ref": "#/components/schemas/ProviderType"
}
},
"additionalProperties": false,
"description": "Represents the security requirements for this data source."
}
},
"securitySchemes": {
"ERI_Token": {
"type": "apiKey",
"description": "Enter the ERI token yielded by the authentication process at /auth.",
"name": "token",
"in": "header"
}
}
},
"security": [
{
"ERI_Token": [ ]
}
]
}