mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2026-08-17 13:35:44 +08:00
[v1] add renderer ut (#9722)
This commit is contained in:
@@ -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."""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user