mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-16 14:57:20 +00:00
chatcompletion & completion input type validation
This commit is contained in:
parent
e468e23249
commit
29e48cc5c1
5 changed files with 57 additions and 30 deletions
|
@ -46,6 +46,21 @@ class CustomType(BaseModel):
|
|||
validator_class: str
|
||||
|
||||
|
||||
class ChatCompletionInputType(BaseModel):
|
||||
# expects List[Message] for messages
|
||||
type: Literal["chat_completion_input"] = "chat_completion_input"
|
||||
|
||||
|
||||
class CompletionInputType(BaseModel):
|
||||
# expects InterleavedTextMedia for content
|
||||
type: Literal["completion_input"] = "completion_input"
|
||||
|
||||
|
||||
class AgentTurnInputType(BaseModel):
|
||||
# expects List[Message] for messages (may also include attachments?)
|
||||
type: Literal["agent_turn_input"] = "agent_turn_input"
|
||||
|
||||
|
||||
ParamType = Annotated[
|
||||
Union[
|
||||
StringType,
|
||||
|
@ -56,6 +71,9 @@ ParamType = Annotated[
|
|||
JsonType,
|
||||
UnionType,
|
||||
CustomType,
|
||||
ChatCompletionInputType,
|
||||
CompletionInputType,
|
||||
AgentTurnInputType,
|
||||
],
|
||||
Field(discriminator="type"),
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue