Skip to content

Commit ecc8a55

Browse files
authored
feat(api)!: support extra_body to embeddings and vector_stores APIs (#3794)
Applies the same pattern from #3777 to embeddings and vector_stores.create() endpoints. This should _not_ be a breaking change since (a) our tests were already using the `extra_body` parameter when passing in to the backend (b) but the backend probably wasn't extracting the parameters correctly. This PR will fix that. Updated APIs: `openai_embeddings(), openai_create_vector_store(), openai_create_vector_store_file_batch()`
1 parent 3bb6ef3 commit ecc8a55

File tree

26 files changed

+451
-426
lines changed

26 files changed

+451
-426
lines changed

docs/static/deprecated-llama-stack-spec.html

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@
16621662
"content": {
16631663
"application/json": {
16641664
"schema": {
1665-
"$ref": "#/components/schemas/OpenaiEmbeddingsRequest"
1665+
"$ref": "#/components/schemas/OpenAIEmbeddingsRequestWithExtraBody"
16661666
}
16671667
}
16681668
},
@@ -2436,13 +2436,13 @@
24362436
"VectorIO"
24372437
],
24382438
"summary": "Creates a vector store.",
2439-
"description": "Creates a vector store.",
2439+
"description": "Creates a vector store.\nGenerate an OpenAI-compatible vector store with the given parameters.",
24402440
"parameters": [],
24412441
"requestBody": {
24422442
"content": {
24432443
"application/json": {
24442444
"schema": {
2445-
"$ref": "#/components/schemas/OpenaiCreateVectorStoreRequest"
2445+
"$ref": "#/components/schemas/OpenAICreateVectorStoreRequestWithExtraBody"
24462446
}
24472447
}
24482448
},
@@ -2622,7 +2622,7 @@
26222622
"VectorIO"
26232623
],
26242624
"summary": "Create a vector store file batch.",
2625-
"description": "Create a vector store file batch.",
2625+
"description": "Create a vector store file batch.\nGenerate an OpenAI-compatible vector store file batch for the given vector store.",
26262626
"parameters": [
26272627
{
26282628
"name": "vector_store_id",
@@ -2638,7 +2638,7 @@
26382638
"content": {
26392639
"application/json": {
26402640
"schema": {
2641-
"$ref": "#/components/schemas/OpenaiCreateVectorStoreFileBatchRequest"
2641+
"$ref": "#/components/schemas/OpenAICreateVectorStoreFileBatchRequestWithExtraBody"
26422642
}
26432643
}
26442644
},
@@ -8174,7 +8174,7 @@
81748174
"title": "OpenAICompletionChoice",
81758175
"description": "A choice from an OpenAI-compatible completion response."
81768176
},
8177-
"OpenaiEmbeddingsRequest": {
8177+
"OpenAIEmbeddingsRequestWithExtraBody": {
81788178
"type": "object",
81798179
"properties": {
81808180
"model": {
@@ -8197,6 +8197,7 @@
81978197
},
81988198
"encoding_format": {
81998199
"type": "string",
8200+
"default": "float",
82008201
"description": "(Optional) The format to return the embeddings in. Can be either \"float\" or \"base64\". Defaults to \"float\"."
82018202
},
82028203
"dimensions": {
@@ -8213,7 +8214,8 @@
82138214
"model",
82148215
"input"
82158216
],
8216-
"title": "OpenaiEmbeddingsRequest"
8217+
"title": "OpenAIEmbeddingsRequestWithExtraBody",
8218+
"description": "Request parameters for OpenAI-compatible embeddings endpoint."
82178219
},
82188220
"OpenAIEmbeddingData": {
82198221
"type": "object",
@@ -12061,19 +12063,19 @@
1206112063
"title": "VectorStoreObject",
1206212064
"description": "OpenAI Vector Store object."
1206312065
},
12064-
"OpenaiCreateVectorStoreRequest": {
12066+
"OpenAICreateVectorStoreRequestWithExtraBody": {
1206512067
"type": "object",
1206612068
"properties": {
1206712069
"name": {
1206812070
"type": "string",
12069-
"description": "A name for the vector store."
12071+
"description": "(Optional) A name for the vector store"
1207012072
},
1207112073
"file_ids": {
1207212074
"type": "array",
1207312075
"items": {
1207412076
"type": "string"
1207512077
},
12076-
"description": "A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files."
12078+
"description": "List of file IDs to include in the vector store"
1207712079
},
1207812080
"expires_after": {
1207912081
"type": "object",
@@ -12099,7 +12101,7 @@
1209912101
}
1210012102
]
1210112103
},
12102-
"description": "The expiration policy for a vector store."
12104+
"description": "(Optional) Expiration policy for the vector store"
1210312105
},
1210412106
"chunking_strategy": {
1210512107
"type": "object",
@@ -12125,7 +12127,7 @@
1212512127
}
1212612128
]
1212712129
},
12128-
"description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
12130+
"description": "(Optional) Strategy for splitting files into chunks"
1212912131
},
1213012132
"metadata": {
1213112133
"type": "object",
@@ -12151,23 +12153,12 @@
1215112153
}
1215212154
]
1215312155
},
12154-
"description": "Set of 16 key-value pairs that can be attached to an object."
12155-
},
12156-
"embedding_model": {
12157-
"type": "string",
12158-
"description": "The embedding model to use for this vector store."
12159-
},
12160-
"embedding_dimension": {
12161-
"type": "integer",
12162-
"description": "The dimension of the embedding vectors (default: 384)."
12163-
},
12164-
"provider_id": {
12165-
"type": "string",
12166-
"description": "The ID of the provider to use for this vector store."
12156+
"description": "Set of key-value pairs that can be attached to the vector store"
1216712157
}
1216812158
},
1216912159
"additionalProperties": false,
12170-
"title": "OpenaiCreateVectorStoreRequest"
12160+
"title": "OpenAICreateVectorStoreRequestWithExtraBody",
12161+
"description": "Request to create a vector store with extra_body support."
1217112162
},
1217212163
"OpenaiUpdateVectorStoreRequest": {
1217312164
"type": "object",
@@ -12337,15 +12328,15 @@
1233712328
"title": "VectorStoreChunkingStrategyStaticConfig",
1233812329
"description": "Configuration for static chunking strategy."
1233912330
},
12340-
"OpenaiCreateVectorStoreFileBatchRequest": {
12331+
"OpenAICreateVectorStoreFileBatchRequestWithExtraBody": {
1234112332
"type": "object",
1234212333
"properties": {
1234312334
"file_ids": {
1234412335
"type": "array",
1234512336
"items": {
1234612337
"type": "string"
1234712338
},
12348-
"description": "A list of File IDs that the vector store should use."
12339+
"description": "A list of File IDs that the vector store should use"
1234912340
},
1235012341
"attributes": {
1235112342
"type": "object",
@@ -12371,18 +12362,19 @@
1237112362
}
1237212363
]
1237312364
},
12374-
"description": "(Optional) Key-value attributes to store with the files."
12365+
"description": "(Optional) Key-value attributes to store with the files"
1237512366
},
1237612367
"chunking_strategy": {
1237712368
"$ref": "#/components/schemas/VectorStoreChunkingStrategy",
12378-
"description": "(Optional) The chunking strategy used to chunk the file(s). Defaults to auto."
12369+
"description": "(Optional) The chunking strategy used to chunk the file(s). Defaults to auto"
1237912370
}
1238012371
},
1238112372
"additionalProperties": false,
1238212373
"required": [
1238312374
"file_ids"
1238412375
],
12385-
"title": "OpenaiCreateVectorStoreFileBatchRequest"
12376+
"title": "OpenAICreateVectorStoreFileBatchRequestWithExtraBody",
12377+
"description": "Request to create a vector store file batch with extra_body support."
1238612378
},
1238712379
"VectorStoreFileBatchObject": {
1238812380
"type": "object",

docs/static/deprecated-llama-stack-spec.yaml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ paths:
12031203
content:
12041204
application/json:
12051205
schema:
1206-
$ref: '#/components/schemas/OpenaiEmbeddingsRequest'
1206+
$ref: '#/components/schemas/OpenAIEmbeddingsRequestWithExtraBody'
12071207
required: true
12081208
deprecated: true
12091209
/v1/openai/v1/files:
@@ -1792,13 +1792,16 @@ paths:
17921792
tags:
17931793
- VectorIO
17941794
summary: Creates a vector store.
1795-
description: Creates a vector store.
1795+
description: >-
1796+
Creates a vector store.
1797+
1798+
Generate an OpenAI-compatible vector store with the given parameters.
17961799
parameters: []
17971800
requestBody:
17981801
content:
17991802
application/json:
18001803
schema:
1801-
$ref: '#/components/schemas/OpenaiCreateVectorStoreRequest'
1804+
$ref: '#/components/schemas/OpenAICreateVectorStoreRequestWithExtraBody'
18021805
required: true
18031806
deprecated: true
18041807
/v1/openai/v1/vector_stores/{vector_store_id}:
@@ -1924,7 +1927,11 @@ paths:
19241927
tags:
19251928
- VectorIO
19261929
summary: Create a vector store file batch.
1927-
description: Create a vector store file batch.
1930+
description: >-
1931+
Create a vector store file batch.
1932+
1933+
Generate an OpenAI-compatible vector store file batch for the given vector
1934+
store.
19281935
parameters:
19291936
- name: vector_store_id
19301937
in: path
@@ -1937,7 +1944,7 @@ paths:
19371944
content:
19381945
application/json:
19391946
schema:
1940-
$ref: '#/components/schemas/OpenaiCreateVectorStoreFileBatchRequest'
1947+
$ref: '#/components/schemas/OpenAICreateVectorStoreFileBatchRequestWithExtraBody'
19411948
required: true
19421949
deprecated: true
19431950
/v1/openai/v1/vector_stores/{vector_store_id}/file_batches/{batch_id}:
@@ -6035,7 +6042,7 @@ components:
60356042
title: OpenAICompletionChoice
60366043
description: >-
60376044
A choice from an OpenAI-compatible completion response.
6038-
OpenaiEmbeddingsRequest:
6045+
OpenAIEmbeddingsRequestWithExtraBody:
60396046
type: object
60406047
properties:
60416048
model:
@@ -6054,6 +6061,7 @@ components:
60546061
multiple inputs in a single request, pass an array of strings.
60556062
encoding_format:
60566063
type: string
6064+
default: float
60576065
description: >-
60586066
(Optional) The format to return the embeddings in. Can be either "float"
60596067
or "base64". Defaults to "float".
@@ -6071,7 +6079,9 @@ components:
60716079
required:
60726080
- model
60736081
- input
6074-
title: OpenaiEmbeddingsRequest
6082+
title: OpenAIEmbeddingsRequestWithExtraBody
6083+
description: >-
6084+
Request parameters for OpenAI-compatible embeddings endpoint.
60756085
OpenAIEmbeddingData:
60766086
type: object
60776087
properties:
@@ -9147,19 +9157,18 @@ components:
91479157
- metadata
91489158
title: VectorStoreObject
91499159
description: OpenAI Vector Store object.
9150-
OpenaiCreateVectorStoreRequest:
9160+
"OpenAICreateVectorStoreRequestWithExtraBody":
91519161
type: object
91529162
properties:
91539163
name:
91549164
type: string
9155-
description: A name for the vector store.
9165+
description: (Optional) A name for the vector store
91569166
file_ids:
91579167
type: array
91589168
items:
91599169
type: string
91609170
description: >-
9161-
A list of File IDs that the vector store should use. Useful for tools
9162-
like `file_search` that can access files.
9171+
List of file IDs to include in the vector store
91639172
expires_after:
91649173
type: object
91659174
additionalProperties:
@@ -9171,7 +9180,7 @@ components:
91719180
- type: array
91729181
- type: object
91739182
description: >-
9174-
The expiration policy for a vector store.
9183+
(Optional) Expiration policy for the vector store
91759184
chunking_strategy:
91769185
type: object
91779186
additionalProperties:
@@ -9183,8 +9192,7 @@ components:
91839192
- type: array
91849193
- type: object
91859194
description: >-
9186-
The chunking strategy used to chunk the file(s). If not set, will use
9187-
the `auto` strategy.
9195+
(Optional) Strategy for splitting files into chunks
91889196
metadata:
91899197
type: object
91909198
additionalProperties:
@@ -9196,21 +9204,12 @@ components:
91969204
- type: array
91979205
- type: object
91989206
description: >-
9199-
Set of 16 key-value pairs that can be attached to an object.
9200-
embedding_model:
9201-
type: string
9202-
description: >-
9203-
The embedding model to use for this vector store.
9204-
embedding_dimension:
9205-
type: integer
9206-
description: >-
9207-
The dimension of the embedding vectors (default: 384).
9208-
provider_id:
9209-
type: string
9210-
description: >-
9211-
The ID of the provider to use for this vector store.
9207+
Set of key-value pairs that can be attached to the vector store
92129208
additionalProperties: false
9213-
title: OpenaiCreateVectorStoreRequest
9209+
title: >-
9210+
OpenAICreateVectorStoreRequestWithExtraBody
9211+
description: >-
9212+
Request to create a vector store with extra_body support.
92149213
OpenaiUpdateVectorStoreRequest:
92159214
type: object
92169215
properties:
@@ -9331,15 +9330,15 @@ components:
93319330
title: VectorStoreChunkingStrategyStaticConfig
93329331
description: >-
93339332
Configuration for static chunking strategy.
9334-
OpenaiCreateVectorStoreFileBatchRequest:
9333+
"OpenAICreateVectorStoreFileBatchRequestWithExtraBody":
93359334
type: object
93369335
properties:
93379336
file_ids:
93389337
type: array
93399338
items:
93409339
type: string
93419340
description: >-
9342-
A list of File IDs that the vector store should use.
9341+
A list of File IDs that the vector store should use
93439342
attributes:
93449343
type: object
93459344
additionalProperties:
@@ -9351,16 +9350,19 @@ components:
93519350
- type: array
93529351
- type: object
93539352
description: >-
9354-
(Optional) Key-value attributes to store with the files.
9353+
(Optional) Key-value attributes to store with the files
93559354
chunking_strategy:
93569355
$ref: '#/components/schemas/VectorStoreChunkingStrategy'
93579356
description: >-
93589357
(Optional) The chunking strategy used to chunk the file(s). Defaults to
9359-
auto.
9358+
auto
93609359
additionalProperties: false
93619360
required:
93629361
- file_ids
9363-
title: OpenaiCreateVectorStoreFileBatchRequest
9362+
title: >-
9363+
OpenAICreateVectorStoreFileBatchRequestWithExtraBody
9364+
description: >-
9365+
Request to create a vector store file batch with extra_body support.
93649366
VectorStoreFileBatchObject:
93659367
type: object
93669368
properties:

0 commit comments

Comments
 (0)