schemas.py
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from __future__ import annotations
from dataclasses import asdict, dataclass, field
from typing import Any
@dataclass
class ParsedDocument:
doc_id: str
source_file: str
file_type: str
content: str
page: int | None = None
sheet: str | None = None
row_index: int | None = None
metadata: dict[str, Any] = field(default_factory=dict)
def to_dict(self) -> dict[str, Any]:
return asdict(self)
@dataclass
class TestsetRecord:
sample_id: str
user_input: str
reference: str
reference_contexts: list[str]
source_file: str | None = None
gold_chunk_ids: list[str] = field(default_factory=list)
question_type: str = "single_hop"
review_status: str = "pending"
def to_dict(self) -> dict[str, Any]:
return asdict(self)
@dataclass
class WeKnoraAnswer:
sample_id: str
user_input: str
response: str
retrieved_contexts: list[str]
weknora_references: list[dict[str, Any]]
session_id: str | None = None
request_id: str | None = None
error: str | None = None
def to_dict(self) -> dict[str, Any]:
return asdict(self)