vignette/apps/api/engine_gateway/golden/engine_gateway_schema.v1.json
2026-06-28 20:12:05 +09:00

333 lines
6.8 KiB
JSON

{
"$defs": {
"EngineMessage": {
"properties": {
"cache": {
"default": false,
"title": "Cache",
"type": "boolean"
},
"content": {
"title": "Content",
"type": "string"
},
"role": {
"enum": [
"system",
"user",
"assistant"
],
"title": "Role",
"type": "string"
}
},
"required": [
"role",
"content"
],
"title": "EngineMessage",
"type": "object"
},
"GenerateRequest": {
"properties": {
"ai_role": {
"default": "client",
"enum": [
"client",
"counselor",
"evaluator"
],
"title": "Ai Role",
"type": "string"
},
"max_tokens": {
"default": 1024,
"title": "Max Tokens",
"type": "integer"
},
"messages": {
"items": {
"$ref": "#/$defs/EngineMessage"
},
"title": "Messages",
"type": "array"
},
"metadata": {
"title": "Metadata",
"type": "object"
},
"model": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Model"
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Session Id"
},
"structured_schema": {
"anyOf": [
{
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Structured Schema"
},
"temperature": {
"default": 0.7,
"title": "Temperature",
"type": "number"
}
},
"required": [
"messages"
],
"title": "GenerateRequest",
"type": "object"
},
"GenerateResponse": {
"properties": {
"cost_usd": {
"default": 0.0,
"title": "Cost Usd",
"type": "number"
},
"inference_geo": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Inference Geo"
},
"model": {
"title": "Model",
"type": "string"
},
"provider": {
"title": "Provider",
"type": "string"
},
"structured": {
"anyOf": [
{
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Structured"
},
"text": {
"title": "Text",
"type": "string"
},
"tokens_in": {
"default": 0,
"title": "Tokens In",
"type": "integer"
},
"tokens_out": {
"default": 0,
"title": "Tokens Out",
"type": "integer"
}
},
"required": [
"text",
"model",
"provider"
],
"title": "GenerateResponse",
"type": "object"
},
"StreamDoneEvent": {
"properties": {
"cost_usd": {
"default": 0.0,
"title": "Cost Usd",
"type": "number"
},
"model": {
"title": "Model",
"type": "string"
},
"provider": {
"title": "Provider",
"type": "string"
},
"tokens_in": {
"default": 0,
"title": "Tokens In",
"type": "integer"
},
"tokens_out": {
"default": 0,
"title": "Tokens Out",
"type": "integer"
},
"turns": {
"default": 0,
"title": "Turns",
"type": "integer"
}
},
"required": [
"provider",
"model"
],
"title": "StreamDoneEvent",
"type": "object"
},
"StreamErrorEvent": {
"properties": {
"detail": {
"title": "Detail",
"type": "string"
}
},
"required": [
"detail"
],
"title": "StreamErrorEvent",
"type": "object"
},
"StreamPacket": {
"oneOf": [
{
"additionalProperties": false,
"properties": {
"event": {
"const": "token"
},
"payload": {
"$ref": "#/$defs/StreamTokenEvent"
}
},
"required": [
"event",
"payload"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"event": {
"const": "done"
},
"payload": {
"$ref": "#/$defs/StreamDoneEvent"
}
},
"required": [
"event",
"payload"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"event": {
"const": "error"
},
"payload": {
"$ref": "#/$defs/StreamErrorEvent"
}
},
"required": [
"event",
"payload"
],
"type": "object"
}
]
},
"StreamTokenEvent": {
"properties": {
"text": {
"title": "Text",
"type": "string"
}
},
"required": [
"text"
],
"title": "StreamTokenEvent",
"type": "object"
}
},
"$id": "https://vignette.local/schemas/engine_gateway_contract.v1.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"compatibility_lines": {
"items": {
"type": "string"
},
"type": "array"
},
"generate_request": {
"$ref": "#/$defs/GenerateRequest"
},
"generate_response": {
"$ref": "#/$defs/GenerateResponse"
},
"stream_frames": {
"items": {
"type": "string"
},
"type": "array"
},
"stream_packets": {
"items": {
"$ref": "#/$defs/StreamPacket"
},
"type": "array"
},
"version": {
"const": 1
}
},
"required": [
"version",
"generate_request",
"generate_response",
"stream_frames",
"stream_packets",
"compatibility_lines"
],
"title": "EngineGatewayGoldenContract",
"type": "object",
"x-engine-gateway-sse-events": [
"token",
"done",
"error"
]
}