Skip to content

Commit ef0c757

Browse files
committed
fix(api): fix input_index in wrong apis
1 parent e5b2e90 commit ef0c757

File tree

1 file changed

+118
-27
lines changed

1 file changed

+118
-27
lines changed

docs/ai_api.yaml

Lines changed: 118 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,35 @@ components:
202202
$ref: "#/components/schemas/SingleInferenceResult"
203203

204204
SingleEmbeddingResultNoIndex:
205+
type: object
206+
required:
207+
- vector
208+
- embedding_id
209+
properties:
210+
vector:
211+
type: array
212+
items:
213+
type: number
214+
format: float
215+
embedding_id:
216+
type: string
217+
format: uuid
218+
info:
219+
type: object
220+
properties:
221+
authz:
222+
type: string
223+
format: url
224+
example: "/vector/indices/{index_name}"
225+
authz_version:
226+
type: integer
227+
example: 0
228+
self:
229+
type: string
230+
format: url
231+
example: "/vector/indices/{index_name}/embeddings/{embedding_id}"
232+
233+
SingleEmbeddingResultNoIndexFromInput:
205234
type: object
206235
required:
207236
- vector
@@ -215,6 +244,7 @@ components:
215244
format: float
216245
input_index:
217246
type: integer
247+
example: 0
218248
embedding_id:
219249
type: string
220250
format: uuid
@@ -233,7 +263,39 @@ components:
233263
format: url
234264
example: "/vector/indices/{index_name}/embeddings/{embedding_id}"
235265

236-
SingleEmbeddingResult:
266+
SingleEmbedding:
267+
type: object
268+
required:
269+
- index_name
270+
- embedding_id
271+
- vector
272+
properties:
273+
vector:
274+
type: array
275+
items:
276+
type: number
277+
format: float
278+
embedding_id:
279+
type: string
280+
format: uuid
281+
info:
282+
type: object
283+
properties:
284+
index_name:
285+
type: string
286+
authz:
287+
type: string
288+
format: url
289+
example: "/vector/indices/{index_name}"
290+
authz_version:
291+
type: integer
292+
example: 0
293+
self:
294+
type: string
295+
format: url
296+
example: "/vector/indices/{index_name}/embeddings/{embedding_id}"
297+
298+
SingleEmbeddingFromInput:
237299
type: object
238300
required:
239301
- index_name
@@ -248,6 +310,7 @@ components:
248310
format: float
249311
input_index:
250312
type: integer
313+
example: 0
251314
embedding_id:
252315
type: string
253316
format: uuid
@@ -276,7 +339,21 @@ components:
276339
embeddings:
277340
type: array
278341
items:
279-
$ref: "#/components/schemas/SingleEmbeddingResult"
342+
$ref: "#/components/schemas/SingleEmbedding"
343+
vector_indices:
344+
type: array
345+
items:
346+
$ref: "#/components/schemas/VectorIndex"
347+
348+
EmbeddingResponseFromInput:
349+
type: object
350+
required:
351+
- embeddings
352+
properties:
353+
embeddings:
354+
type: array
355+
items:
356+
$ref: "#/components/schemas/SingleEmbeddingFromInput"
280357
vector_indices:
281358
type: array
282359
items:
@@ -292,6 +369,16 @@ components:
292369
items:
293370
$ref: "#/components/schemas/SingleEmbeddingResultNoIndex"
294371

372+
EmbeddingResponseNoIndexFromInput:
373+
type: object
374+
required:
375+
- embeddings
376+
properties:
377+
embeddings:
378+
type: array
379+
items:
380+
$ref: "#/components/schemas/SingleEmbeddingResultNoIndexFromInput"
381+
295382
AllTopicsResponse:
296383
type: object
297384
required:
@@ -451,7 +538,7 @@ components:
451538
- metadata
452539
properties:
453540
embedding:
454-
$ref: '#/components/schemas/SingleEmbeddingResult'
541+
$ref: '#/components/schemas/SingleEmbedding'
455542
metadata:
456543
# TODO: perhaps we need to handle other data returning
457544
# depending on the type of search performed. similarity_score
@@ -548,25 +635,29 @@ components:
548635

549636
paths:
550637
# ----------- Embeddings -------------
551-
/embeddings/{embedding_uuid}:
552-
get:
553-
tags:
554-
- Embeddings
555-
summary: Read embedding from unknown index
556-
description: |
557-
This will require a lookup to know what index this is in, so will be
558-
less efficient than `/vector/indices/{index_name}/embeddings/{embedding_uuid}`.
559-
parameters:
560-
- $ref: "#/components/parameters/EmbeddingId"
561-
responses:
562-
"200":
563-
description: Embedding detail
564-
content:
565-
application/json:
566-
schema:
567-
$ref: "#/components/schemas/SingleEmbeddingResult"
568-
"404":
569-
$ref: "#/components/responses/NotFound"
638+
# Let's not support this at all for now, but we can add it later if needed.
639+
# This muddies the intended usage with a global search that will be inefficient.
640+
# The intended setup will always include the vector index information anyway.
641+
#
642+
# /embeddings/{embedding_uuid}:
643+
# get:
644+
# tags:
645+
# - Embeddings
646+
# summary: Read embedding from unknown index
647+
# description: |
648+
# This will require a lookup to know what index this is in, so will be
649+
# less efficient than `/vector/indices/{index_name}/embeddings/{embedding_uuid}`.
650+
# parameters:
651+
# - $ref: "#/components/parameters/EmbeddingId"
652+
# responses:
653+
# "200":
654+
# description: Embedding detail
655+
# content:
656+
# application/json:
657+
# schema:
658+
# $ref: "#/components/schemas/SingleEmbeddingFromInput"
659+
# "404":
660+
# $ref: "#/components/responses/NotFound"
570661

571662
/vector/indices/{index_name}/embeddings/{embedding_uuid}:
572663
get:
@@ -582,7 +673,7 @@ paths:
582673
content:
583674
application/json:
584675
schema:
585-
$ref: "#/components/schemas/SingleEmbeddingResult"
676+
$ref: "#/components/schemas/SingleEmbedding"
586677
"404":
587678
$ref: "#/components/responses/NotFound"
588679
put:
@@ -610,7 +701,7 @@ paths:
610701
content:
611702
application/json:
612703
schema:
613-
$ref: "#/components/schemas/SingleEmbeddingResult"
704+
$ref: "#/components/schemas/SingleEmbedding"
614705
"400":
615706
description: Dimensions don't match or other invalid input
616707
delete:
@@ -669,7 +760,7 @@ paths:
669760
content:
670761
application/json:
671762
schema:
672-
$ref: "#/components/schemas/EmbeddingResponseNoIndex"
763+
$ref: "#/components/schemas/EmbeddingResponseNoIndexFromInput"
673764
"400":
674765
$ref: "#/components/responses/BadRequest"
675766

@@ -687,7 +778,7 @@ paths:
687778
content:
688779
application/json:
689780
schema:
690-
$ref: "#/components/schemas/EmbeddingResponseNoIndex"
781+
$ref: "#/components/schemas/EmbeddingResponseNoIndexFromInput"
691782

692783
"400":
693784
$ref: "#/components/responses/BadRequest"
@@ -726,7 +817,7 @@ paths:
726817
content:
727818
application/json:
728819
schema:
729-
$ref: "#/components/schemas/EmbeddingResponseNoIndex"
820+
$ref: "#/components/schemas/EmbeddingResponseNoIndexFromInput"
730821
"400":
731822
$ref: "#/components/responses/BadRequest"
732823

0 commit comments

Comments
 (0)