Files

324 lines
6.7 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://go-sip.local/contracts/v1/ai-config.schema.json",
"title": "Immutable AI agent version",
"type": "object",
"additionalProperties": false,
"required": [
"agent_version_id",
"immutable",
"asr",
"conversation"
],
"properties": {
"agent_version_id": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
},
"immutable": {
"const": true
},
"mode": {
"enum": [
"full_ai",
"asr_only"
]
},
"llm": {
"type": "object",
"additionalProperties": false,
"required": [
"provider_ref",
"model"
],
"properties": {
"provider_ref": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"credential_ref": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"model": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"temperature": {
"type": "number",
"minimum": 0,
"maximum": 2
},
"max_tokens": {
"type": "integer",
"minimum": 1
},
"timeout_ms": {
"type": "integer",
"minimum": 1
}
}
},
"prompt": {
"type": "object",
"additionalProperties": false,
"required": [
"text",
"allowed_variables"
],
"properties": {
"text": {
"type": "string",
"minLength": 1,
"maxLength": 32768
},
"allowed_variables": {
"type": "array",
"maxItems": 32,
"items": {
"type": "string",
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
}
},
"max_bytes": {
"type": "integer",
"minimum": 1,
"maximum": 32768
}
}
},
"tts": {
"type": "object",
"additionalProperties": false,
"required": [
"provider_ref",
"model",
"voice",
"format"
],
"properties": {
"provider_ref": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"credential_ref": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"model": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"voice": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"speed": {
"type": "number",
"minimum": 0.25,
"maximum": 3
},
"timeout_ms": {
"type": "integer",
"minimum": 1
},
"format": {
"type": "object",
"additionalProperties": false,
"required": [
"encoding",
"sample_rate_hz",
"channels"
],
"properties": {
"encoding": {
"enum": [
"pcm_s16le",
"pcma"
]
},
"sample_rate_hz": {
"type": "integer",
"minimum": 8000,
"maximum": 48000
},
"channels": {
"const": 1
}
}
}
}
},
"asr": {
"type": "object",
"additionalProperties": false,
"required": [
"provider_ref",
"language",
"input"
],
"properties": {
"provider_ref": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"credential_ref": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"model": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"language": {
"type": "string",
"minLength": 1,
"maxLength": 32
},
"interim": {
"type": "boolean"
},
"timeout_ms": {
"type": "integer",
"minimum": 1
},
"input": {
"type": "object",
"additionalProperties": false,
"required": [
"encoding",
"sample_rate_hz",
"channels",
"sample_width_bytes"
],
"properties": {
"encoding": {
"const": "pcm_s16le"
},
"sample_rate_hz": {
"type": "integer",
"minimum": 8000,
"maximum": 48000
},
"channels": {
"const": 1
},
"sample_width_bytes": {
"const": 2
}
}
}
}
},
"conversation": {
"type": "object",
"additionalProperties": false,
"required": [
"allow_interrupt",
"silence_timeout_ms",
"max_duration_ms",
"max_turns",
"sentence_max_chars",
"max_pending_audio_chunks"
],
"properties": {
"opening": {
"type": "string",
"maxLength": 32768
},
"allow_interrupt": {
"type": "boolean"
},
"silence_timeout_ms": {
"type": "integer",
"minimum": 1
},
"max_duration_ms": {
"type": "integer",
"minimum": 1,
"maximum": 3600000
},
"max_turns": {
"type": "integer",
"minimum": 1,
"maximum": 1000
},
"sentence_max_chars": {
"type": "integer",
"minimum": 1
},
"max_pending_audio_chunks": {
"type": "integer",
"minimum": 1
}
}
},
"metadata": {
"type": "object",
"additionalProperties": true
}
},
"oneOf": [
{
"title": "Full AI",
"required": [
"llm",
"prompt",
"tts"
],
"properties": {
"mode": {
"enum": [
"full_ai"
]
},
"conversation": {
"required": [
"opening"
]
}
}
},
{
"title": "ASR only",
"required": [
"mode"
],
"properties": {
"mode": {
"const": "asr_only"
}
},
"not": {
"anyOf": [
{
"required": [
"llm"
]
},
{
"required": [
"prompt"
]
},
{
"required": [
"tts"
]
}
]
}
}
]
}