[v1] add renderer ut (#9722)

This commit is contained in:
Yaowei Zheng
2026-01-07 02:06:07 +08:00
committed by GitHub
parent ea0b4e2466
commit d22de0d4bf
13 changed files with 420 additions and 249 deletions

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING, Literal, NotRequired, TypedDict, Union
from typing import TYPE_CHECKING, Any, Literal, NotRequired, TypedDict, Union
if TYPE_CHECKING:
@@ -102,8 +102,10 @@ class Message(TypedDict):
class SFTSample(TypedDict):
messages: list[Message]
"""Messages in the sample."""
tools: NotRequired[str]
"""Tools for the sample in JSON string format."""
extra_info: NotRequired[str]
"""Extra information for the sample, including tools, kto_labels."""
"""Extra information for the sample, e.g. kto_labels."""
_dataset_name: NotRequired[str]
"""Dataset name for the sample."""
@@ -113,8 +115,10 @@ class DPOSample(TypedDict):
"""Chosen messages in the sample."""
rejected_messages: list[Message]
"""Rejected messages in the sample."""
tools: NotRequired[str]
"""Tools for the sample in JSON string format."""
extra_info: NotRequired[str]
"""Extra information for the sample, including tools, kto_labels."""
"""Extra information for the sample, e.g. kto_labels."""
_dataset_name: NotRequired[str]
"""Dataset name for the sample."""
@@ -125,7 +129,7 @@ Sample = Union[SFTSample, DPOSample]
class ToolCall(TypedDict):
name: str
"""Function name."""
arguments: str
arguments: dict[str, Any]
"""Function arguments."""