feat(api): Extend Files API to support registering ressources

This commit proposes extending the Files API to support registering and
unregistering ressources. This is particularly useful if you want to
point to pre-existing data and let Llama Stack know about them.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han 2025-03-27 15:59:34 +01:00
parent 935e706b15
commit 4905a8ee66
No known key found for this signature in database
3 changed files with 317 additions and 0 deletions

View file

@ -815,6 +815,56 @@
}
]
},
"post": {
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FileRegistrationResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Files"
],
"description": "Register an existing file with the provider.",
"parameters": [
{
"name": "bucket",
"in": "path",
"description": "Storage location",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "key",
"in": "path",
"description": "File path relative to the storage location",
"required": true,
"schema": {
"type": "string"
}
}
]
},
"delete": {
"responses": {
"200": {
@ -2540,6 +2590,47 @@
}
}
]
},
"post": {
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BucketRegistrationResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest400"
},
"429": {
"$ref": "#/components/responses/TooManyRequests429"
},
"500": {
"$ref": "#/components/responses/InternalServerError500"
},
"default": {
"$ref": "#/components/responses/DefaultError"
}
},
"tags": [
"Files"
],
"description": "Register an existing storage location with the provider.",
"parameters": [
{
"name": "bucket",
"in": "path",
"description": "Storage location",
"required": true,
"schema": {
"type": "string"
}
}
]
}
},
"/v1/models": {
@ -9385,6 +9476,61 @@
],
"title": "RegisterBenchmarkRequest"
},
"BucketRegistrationResponse": {
"type": "object",
"properties": {
"bucket": {
"type": "string",
"description": "The registered storage location URI (e.g., \"s3://my-bucket\" or \"file:///data\")"
},
"created_at": {
"type": "integer",
"description": "Timestamp of registration"
},
"status": {
"type": "string",
"description": "Current status of the storage location"
}
},
"additionalProperties": false,
"required": [
"bucket",
"created_at",
"status"
],
"title": "BucketRegistrationResponse",
"description": "Response after registering a storage location."
},
"FileRegistrationResponse": {
"type": "object",
"properties": {
"bucket": {
"type": "string",
"description": "The storage location URI (e.g., \"s3://my-bucket\" or \"file:///data\")"
},
"key": {
"type": "string",
"description": "The file path relative to the storage location"
},
"created_at": {
"type": "integer",
"description": "Timestamp of registration"
},
"status": {
"type": "string",
"description": "Current status of the file"
}
},
"additionalProperties": false,
"required": [
"bucket",
"key",
"created_at",
"status"
],
"title": "FileRegistrationResponse",
"description": "Response after registering a file."
},
"RegisterDatasetRequest": {
"type": "object",
"properties": {