This commit is contained in:
John Lancaster
2026-06-21 12:41:14 -05:00
parent 9c8ab70c06
commit aec3500370
4 changed files with 25 additions and 29 deletions
+11 -16
View File
@@ -1,6 +1,7 @@
import re
from collections.abc import Mapping
from typing import Any
from typing import Literal
from pydantic import Field
from pydantic import field_validator
@@ -10,29 +11,23 @@ from .common import SKILL_ID_RE
from .common import StrictFrozenModel
from .common import frozen_mapping
type PromptArgumentType = Literal[
"string",
"number",
"integer",
"boolean",
"array",
"object",
]
class PromptArgumentEntry(StrictFrozenModel):
type: str = Field(min_length=1)
type: PromptArgumentType
description: str | None = None
required: bool = False
default: Any | None = None
enum: tuple[str, ...] | None = None
@field_validator("type")
@classmethod
def validate_type(cls, value: str) -> str:
allowed_types = {
"string",
"number",
"integer",
"boolean",
"array",
"object",
}
if value not in allowed_types:
raise ValueError(f"unsupported prompt argument type: {value}")
return value
@field_validator("enum")
@classmethod
def validate_enum(cls, value: tuple[str, ...] | None) -> tuple[str, ...] | None: