32 lines
846 B
Python
32 lines
846 B
Python
from __future__ import annotations
|
|
|
|
from typing import Any, Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class ChatMessage(BaseModel):
|
|
model_config = ConfigDict(extra="allow")
|
|
|
|
role: Literal["system", "developer", "user", "assistant", "tool"]
|
|
content: Any = None
|
|
name: str | None = None
|
|
tool_call_id: str | None = None
|
|
tool_calls: list[dict[str, Any]] | None = None
|
|
|
|
|
|
class ChatCompletionRequest(BaseModel):
|
|
model_config = ConfigDict(extra="allow")
|
|
|
|
model: str
|
|
messages: list[ChatMessage] = Field(min_length=1)
|
|
stream: bool = False
|
|
tools: list[dict[str, Any]] | None = None
|
|
tool_choice: Any = None
|
|
metadata: dict[str, Any] | None = None
|
|
|
|
|
|
class PlanItem(BaseModel):
|
|
step: str = Field(min_length=1, max_length=1000)
|
|
status: Literal["pending", "in_progress", "completed"]
|