feat: Add missing Vector Store Files API surface

This adds the ability to list, retrieve, update, and delete Vector
Store Files. It implements these new APIs for the faiss and sqlite-vec
providers, since those are the two that also have the rest of the
vector store files implementation.

There are a number of new integration tests added, which I ran for
each provider as outlined below.

faiss (from ollama distro):

```
INFERENCE_MODEL="meta-llama/Llama-3.2-3B-Instruct" \
llama stack run llama_stack/templates/ollama/run.yaml

LLAMA_STACK_CONFIG=http://localhost:8321 \
pytest -sv tests/integration/vector_io/test_openai_vector_stores.py \
  --embedding-model=all-MiniLM-L6-v2
```

sqlite-vec (from starter distro):

```
llama stack run llama_stack/templates/starter/run.yaml

LLAMA_STACK_CONFIG=http://localhost:8321 \
pytest -sv tests/integration/vector_io/test_openai_vector_stores.py \
  --embedding-model=all-MiniLM-L6-v2
```

Signed-off-by: Ben Browning <bbrownin@redhat.com>
This commit is contained in:
Ben Browning 2025-06-18 09:14:22 -04:00
parent c20388c424
commit 459d50a365
11 changed files with 1248 additions and 20 deletions

View file

@ -3241,6 +3241,47 @@
}
},
"/v1/openai/v1/vector_stores/{vector_store_id}/files": {
"get": {
"responses": {
"200": {
"description": "A VectorStoreListFilesResponse containing the list of files.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VectorStoreListFilesResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"VectorIO"
],
"description": "List files in a vector store.",
"parameters": [
{
"name": "vector_store_id",
"in": "path",
"description": "The ID of the vector store to list files from.",
"required": true,
"schema": {
"type": "string"
}
}
]
},
"post": {
"responses": {
"200": {
@ -3666,6 +3707,168 @@
]
}
},
"/v1/openai/v1/vector_stores/{vector_store_id}/files/{file_id}": {
"get": {
"responses": {
"200": {
"description": "A VectorStoreFileObject representing the file.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VectorStoreFileObject"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"VectorIO"
],
"description": "Retrieves a vector store file.",
"parameters": [
{
"name": "vector_store_id",
"in": "path",
"description": "The ID of the vector store containing the file to retrieve.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "file_id",
"in": "path",
"description": "The ID of the file to retrieve.",
"required": true,
"schema": {
"type": "string"
}
}
]
},
"post": {
"responses": {
"200": {
"description": "A VectorStoreFileObject representing the updated file.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VectorStoreFileObject"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"VectorIO"
],
"description": "Updates a vector store file.",
"parameters": [
{
"name": "vector_store_id",
"in": "path",
"description": "The ID of the vector store containing the file to update.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "file_id",
"in": "path",
"description": "The ID of the file to update.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OpenaiUpdateVectorStoreFileRequest"
}
}
},
"required": true
}
},
"delete": {
"responses": {
"200": {
"description": "A VectorStoreFileDeleteResponse indicating the deletion status.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VectorStoreFileDeleteResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"VectorIO"
],
"description": "Delete a vector store file.",
"parameters": [
{
"name": "vector_store_id",
"in": "path",
"description": "The ID of the vector store containing the file to delete.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "file_id",
"in": "path",
"description": "The ID of the file to delete.",
"required": true,
"schema": {
"type": "string"
}
}
]
}
},
"/v1/openai/v1/embeddings": {
"post": {
"responses": {
@ -12969,6 +13172,35 @@
],
"title": "OpenaiCreateVectorStoreRequest"
},
"VectorStoreFileCounts": {
"type": "object",
"properties": {
"completed": {
"type": "integer"
},
"cancelled": {
"type": "integer"
},
"failed": {
"type": "integer"
},
"in_progress": {
"type": "integer"
},
"total": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"completed",
"cancelled",
"failed",
"in_progress",
"total"
],
"title": "VectorStoreFileCounts"
},
"VectorStoreObject": {
"type": "object",
"properties": {
@ -12990,10 +13222,7 @@
"default": 0
},
"file_counts": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
"$ref": "#/components/schemas/VectorStoreFileCounts"
},
"status": {
"type": "string",
@ -13120,6 +13349,30 @@
"title": "VectorStoreDeleteResponse",
"description": "Response from deleting a vector store."
},
"VectorStoreFileDeleteResponse": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"object": {
"type": "string",
"default": "vector_store.file.deleted"
},
"deleted": {
"type": "boolean",
"default": true
}
},
"additionalProperties": false,
"required": [
"id",
"object",
"deleted"
],
"title": "VectorStoreFileDeleteResponse",
"description": "Response from deleting a vector store file."
},
"OpenaiEmbeddingsRequest": {
"type": "object",
"properties": {
@ -13348,6 +13601,28 @@
"title": "OpenAIFileObject",
"description": "OpenAI File object as defined in the OpenAI Files API."
},
"VectorStoreListFilesResponse": {
"type": "object",
"properties": {
"object": {
"type": "string",
"default": "list"
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/VectorStoreFileObject"
}
}
},
"additionalProperties": false,
"required": [
"object",
"data"
],
"title": "VectorStoreListFilesResponse",
"description": "Response from listing vector stores."
},
"OpenAIModel": {
"type": "object",
"properties": {
@ -13661,6 +13936,42 @@
"additionalProperties": false,
"title": "OpenaiUpdateVectorStoreRequest"
},
"OpenaiUpdateVectorStoreFileRequest": {
"type": "object",
"properties": {
"attributes": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
},
"description": "The updated key-value attributes to store with the file."
}
},
"additionalProperties": false,
"required": [
"attributes"
],
"title": "OpenaiUpdateVectorStoreFileRequest"
},
"DPOAlignmentConfig": {
"type": "object",
"properties": {

View file

@ -2264,6 +2264,36 @@ paths:
$ref: '#/components/schemas/LogEventRequest'
required: true
/v1/openai/v1/vector_stores/{vector_store_id}/files:
get:
responses:
'200':
description: >-
A VectorStoreListFilesResponse containing the list of files.
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreListFilesResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- VectorIO
description: List files in a vector store.
parameters:
- name: vector_store_id
in: path
description: >-
The ID of the vector store to list files from.
required: true
schema:
type: string
post:
responses:
'200':
@ -2572,6 +2602,121 @@ paths:
required: true
schema:
type: string
/v1/openai/v1/vector_stores/{vector_store_id}/files/{file_id}:
get:
responses:
'200':
description: >-
A VectorStoreFileObject representing the file.
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreFileObject'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- VectorIO
description: Retrieves a vector store file.
parameters:
- name: vector_store_id
in: path
description: >-
The ID of the vector store containing the file to retrieve.
required: true
schema:
type: string
- name: file_id
in: path
description: The ID of the file to retrieve.
required: true
schema:
type: string
post:
responses:
'200':
description: >-
A VectorStoreFileObject representing the updated file.
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreFileObject'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- VectorIO
description: Updates a vector store file.
parameters:
- name: vector_store_id
in: path
description: >-
The ID of the vector store containing the file to update.
required: true
schema:
type: string
- name: file_id
in: path
description: The ID of the file to update.
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OpenaiUpdateVectorStoreFileRequest'
required: true
delete:
responses:
'200':
description: >-
A VectorStoreFileDeleteResponse indicating the deletion status.
content:
application/json:
schema:
$ref: '#/components/schemas/VectorStoreFileDeleteResponse'
'400':
$ref: '#/components/responses/BadRequest400'
'429':
$ref: >-
#/components/responses/TooManyRequests429
'500':
$ref: >-
#/components/responses/InternalServerError500
default:
$ref: '#/components/responses/DefaultError'
tags:
- VectorIO
description: Delete a vector store file.
parameters:
- name: vector_store_id
in: path
description: >-
The ID of the vector store containing the file to delete.
required: true
schema:
type: string
- name: file_id
in: path
description: The ID of the file to delete.
required: true
schema:
type: string
/v1/openai/v1/embeddings:
post:
responses:
@ -9031,6 +9176,27 @@ components:
required:
- name
title: OpenaiCreateVectorStoreRequest
VectorStoreFileCounts:
type: object
properties:
completed:
type: integer
cancelled:
type: integer
failed:
type: integer
in_progress:
type: integer
total:
type: integer
additionalProperties: false
required:
- completed
- cancelled
- failed
- in_progress
- total
title: VectorStoreFileCounts
VectorStoreObject:
type: object
properties:
@ -9047,9 +9213,7 @@ components:
type: integer
default: 0
file_counts:
type: object
additionalProperties:
type: integer
$ref: '#/components/schemas/VectorStoreFileCounts'
status:
type: string
default: completed
@ -9129,6 +9293,25 @@ components:
- deleted
title: VectorStoreDeleteResponse
description: Response from deleting a vector store.
VectorStoreFileDeleteResponse:
type: object
properties:
id:
type: string
object:
type: string
default: vector_store.file.deleted
deleted:
type: boolean
default: true
additionalProperties: false
required:
- id
- object
- deleted
title: VectorStoreFileDeleteResponse
description: >-
Response from deleting a vector store file.
OpenaiEmbeddingsRequest:
type: object
properties:
@ -9320,6 +9503,22 @@ components:
title: OpenAIFileObject
description: >-
OpenAI File object as defined in the OpenAI Files API.
VectorStoreListFilesResponse:
type: object
properties:
object:
type: string
default: list
data:
type: array
items:
$ref: '#/components/schemas/VectorStoreFileObject'
additionalProperties: false
required:
- object
- data
title: VectorStoreListFilesResponse
description: Response from listing vector stores.
OpenAIModel:
type: object
properties:
@ -9524,6 +9723,25 @@ components:
Set of 16 key-value pairs that can be attached to an object.
additionalProperties: false
title: OpenaiUpdateVectorStoreRequest
OpenaiUpdateVectorStoreFileRequest:
type: object
properties:
attributes:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
The updated key-value attributes to store with the file.
additionalProperties: false
required:
- attributes
title: OpenaiUpdateVectorStoreFileRequest
DPOAlignmentConfig:
type: object
properties: