Declarative providers (#5084)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Michael Neale <michael.neale@gmail.com>
This commit is contained in:
Douwe Osinga
2025-10-15 09:48:14 -04:00
committed by GitHub
parent 925a042cb1
commit 9251da4314
28 changed files with 1219 additions and 802 deletions
+206 -37
View File
@@ -382,7 +382,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateCustomProviderRequest"
"$ref": "#/components/schemas/UpdateCustomProviderRequest"
}
}
},
@@ -409,6 +409,84 @@
}
},
"/config/custom-providers/{id}": {
"get": {
"tags": [
"super::routes::config_management"
],
"operationId": "get_custom_provider",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Custom provider retrieved successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LoadedProvider"
}
}
}
},
"404": {
"description": "Provider not found"
},
"500": {
"description": "Internal server error"
}
}
},
"put": {
"tags": [
"super::routes::config_management"
],
"operationId": "update_custom_provider",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateCustomProviderRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Custom provider updated successfully",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "Provider not found"
},
"500": {
"description": "Internal server error"
}
}
},
"delete": {
"tags": [
"super::routes::config_management"
@@ -2203,40 +2281,6 @@
"$ref": "#/components/schemas/Message"
}
},
"CreateCustomProviderRequest": {
"type": "object",
"required": [
"provider_type",
"display_name",
"api_url",
"api_key",
"models"
],
"properties": {
"api_key": {
"type": "string"
},
"api_url": {
"type": "string"
},
"display_name": {
"type": "string"
},
"models": {
"type": "array",
"items": {
"type": "string"
}
},
"provider_type": {
"type": "string"
},
"supports_streaming": {
"type": "boolean",
"nullable": true
}
}
},
"CreateRecipeRequest": {
"type": "object",
"required": [
@@ -2296,6 +2340,61 @@
}
}
},
"DeclarativeProviderConfig": {
"type": "object",
"required": [
"name",
"engine",
"display_name",
"api_key_env",
"base_url",
"models"
],
"properties": {
"api_key_env": {
"type": "string"
},
"base_url": {
"type": "string"
},
"description": {
"type": "string",
"nullable": true
},
"display_name": {
"type": "string"
},
"engine": {
"$ref": "#/components/schemas/ProviderEngine"
},
"headers": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"nullable": true
},
"models": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ModelInfo"
}
},
"name": {
"type": "string"
},
"supports_streaming": {
"type": "boolean",
"nullable": true
},
"timeout_seconds": {
"type": "integer",
"format": "int64",
"nullable": true,
"minimum": 0
}
}
},
"DecodeRecipeRequest": {
"type": "object",
"required": [
@@ -2979,6 +3078,21 @@
}
}
},
"LoadedProvider": {
"type": "object",
"required": [
"config",
"is_editable"
],
"properties": {
"config": {
"$ref": "#/components/schemas/DeclarativeProviderConfig"
},
"is_editable": {
"type": "boolean"
}
}
},
"Message": {
"type": "object",
"description": "A message to or from an LLM",
@@ -3347,7 +3461,8 @@
"required": [
"name",
"metadata",
"is_configured"
"is_configured",
"provider_type"
],
"properties": {
"is_configured": {
@@ -3358,9 +3473,20 @@
},
"name": {
"type": "string"
},
"provider_type": {
"$ref": "#/components/schemas/ProviderType"
}
}
},
"ProviderEngine": {
"type": "string",
"enum": [
"openai",
"ollama",
"anthropic"
]
},
"ProviderMetadata": {
"type": "object",
"description": "Metadata about a provider's configuration requirements and capabilities",
@@ -3398,7 +3524,7 @@
"items": {
"$ref": "#/components/schemas/ModelInfo"
},
"description": "A list of currently known models with their capabilities\nTODO: eventually query the apis directly"
"description": "A list of currently known models with their capabilities"
},
"model_doc_link": {
"type": "string",
@@ -3410,6 +3536,15 @@
}
}
},
"ProviderType": {
"type": "string",
"enum": [
"Preferred",
"Builtin",
"Declarative",
"Custom"
]
},
"ProvidersResponse": {
"type": "object",
"required": [
@@ -4449,6 +4584,40 @@
}
}
},
"UpdateCustomProviderRequest": {
"type": "object",
"required": [
"engine",
"display_name",
"api_url",
"api_key",
"models"
],
"properties": {
"api_key": {
"type": "string"
},
"api_url": {
"type": "string"
},
"display_name": {
"type": "string"
},
"engine": {
"type": "string"
},
"models": {
"type": "array",
"items": {
"type": "string"
}
},
"supports_streaming": {
"type": "boolean",
"nullable": true
}
}
},
"UpdateProviderRequest": {
"type": "object",
"required": [