Enable Pydantic mypy checks and convert configs to Pydantic dataclasses (#17599)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2025-05-28 13:46:04 +01:00
committed by GitHub
parent d781930f90
commit 4c2b38ce9e
11 changed files with 115 additions and 102 deletions

View File

@@ -3,12 +3,10 @@
from dataclasses import dataclass
from typing import Optional, TypedDict, Union
from pydantic import BaseModel
# These classes are deprecated, see SamplingParams
class LLMGuidedOptions(TypedDict, total=False):
guided_json: Union[dict, BaseModel, str]
guided_json: Union[dict, str]
guided_regex: str
guided_choice: list[str]
guided_grammar: str
@@ -20,7 +18,7 @@ class LLMGuidedOptions(TypedDict, total=False):
@dataclass
class GuidedDecodingRequest:
"""One of the fields will be used to retrieve the logit processor."""
guided_json: Optional[Union[dict, BaseModel, str]] = None
guided_json: Optional[Union[dict, str]] = None
guided_regex: Optional[str] = None
guided_choice: Optional[list[str]] = None
guided_grammar: Optional[str] = None