• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IBM / unitxt / 15436196019

04 Jun 2025 07:24AM UTC coverage: 80.242% (-0.3%) from 80.504%
15436196019

Pull #1579

github

web-flow
Merge a3562c478 into 5d576f6fd
Pull Request #1579: Add Multi Turn Metrics Support

1687 of 2079 branches covered (81.14%)

Branch coverage included in aggregate %.

10472 of 13074 relevant lines covered (80.1%)

0.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
src/unitxt/types.py
1
from typing import Any, Dict, List, Literal, NewType, Optional, TypedDict, Union
1✔
2

3
from .type_utils import register_type
1✔
4

5
Text = NewType("Text", str)
1✔
6
Number = NewType("Number", Union[float, int])
1✔
7

8

9
class Turn(TypedDict):
1✔
10
    role: Literal["system", "user", "agent"]
1✔
11
    content: Text
1✔
12

13

14
class RagResponse(TypedDict):
1✔
15
    answer: str
1✔
16
    contexts: List[str]
1✔
17
    context_ids: Union[List[int], List[str]]
1✔
18
    is_answerable: bool
1✔
19

20

21
Dialog = NewType("Dialog", List[Turn])
1✔
22

23

24
class Conversation(TypedDict):
1✔
25
    id: str
1✔
26
    dialog: Dialog
1✔
27

28

29
class Image(TypedDict):
1✔
30
    image: Any
1✔
31
    format: str
1✔
32

33

34
class Document(TypedDict):
1✔
35
    title: str
1✔
36
    body: str
1✔
37

38

39
MultiDocument = NewType("MultiDocument", List[Document])
1✔
40

41
Video = NewType("Video", List[Image])
1✔
42

43

44
class Audio(TypedDict):
1✔
45
    audio: Any
1✔
46

47

48
class Table(TypedDict):
1✔
49
    header: List[str]
1✔
50
    rows: List[List[Any]]
1✔
51

52

53
class SQLDatabase(TypedDict):
1✔
54
    db_id: Optional[str]
1✔
55
    db_type: Literal["local", "in_memory", "remote"]
1✔
56
    dbms: Optional[str]
1✔
57
    data: Optional[Dict[str, Dict]]
1✔
58

59

60
class JsonSchema:
1✔
61
    @classmethod
1✔
62
    def __verify_type__(cls, object):
1✔
63
        if not isinstance(object, dict):
×
64
            return False
×
65
        import jsonschema_rs
×
66

67
        jsonschema_rs.meta.validate(object)
×
68
        return True
×
69

70

71
class Tool(TypedDict):
1✔
72
    name: str
1✔
73
    description: str
1✔
74
    parameters: JsonSchema
1✔
75

76

77
class ToolCall(TypedDict):
1✔
78
    name: str
1✔
79
    arguments: Dict[str, Any]
1✔
80

81

82
register_type(Text)
1✔
83
register_type(Number)
1✔
84
register_type(Turn)
1✔
85
register_type(Dialog)
1✔
86
register_type(Table)
1✔
87
register_type(Audio)
1✔
88
register_type(Image)
1✔
89
register_type(Video)
1✔
90
register_type(Conversation)
1✔
91
register_type(Document)
1✔
92
register_type(MultiDocument)
1✔
93
register_type(RagResponse)
1✔
94
register_type(SQLDatabase)
1✔
95
register_type(Tool)
1✔
96
register_type(JsonSchema)
1✔
97
register_type(ToolCall)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc