-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
143 lines (104 loc) · 2.54 KB
/
Copy pathschemas.py
File metadata and controls
143 lines (104 loc) · 2.54 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
from pydantic import BaseModel,ConfigDict
from typing import List
from datetime import datetime
from typing import Optional
class DocumentCreate(BaseModel):
title:str
content:str
source:str
class DocumentOut(BaseModel):
id:int
title:str
content:str
source:str
model_config = ConfigDict(from_attributes=True)
class DocumentDetailOut(BaseModel):
id:int
title:str
content:str
source:str
chunk_count:int
created_at:datetime
class DocumentSummaryOut(BaseModel):
id:int
title:str
source:str
chunk_count:int
created_at:datetime
class DocumentListOut(BaseModel):
items:List[DocumentSummaryOut]
model_config = ConfigDict(from_attributes=True)
class AskRequest(BaseModel):
question:str
class CitationOut(BaseModel):
document_id:int
title:str
source:str
chunk_index:int
text:str
model_config = ConfigDict(from_attributes=True)
class AskOut(BaseModel):
citations:List[CitationOut]
answer:str
status:str
mode:str
top_score: float
threshold_used: float
used_chunks: int
model_config = ConfigDict(from_attributes=True)
class RetrievedChunkOut(BaseModel):
chunk_id: int
document_id: int
title: str
source: str
chunk_index: int
text: str
class QALogOut(BaseModel):
id:int
question:str
answer:str
status:str
retrieved_chunk_ids:str
resolved_chunk_count:int
recorded_chunk_count:int
created_at:datetime
helpful:Optional[bool]=None
top_score: float
retrieved_chunks_snapshot: List[RetrievedChunkOut]
class QALogDetailOut(BaseModel):
id: int
question: str
answer: str
status: str
mode: str
retrieved_chunk_ids: str
resolved_chunk_count:int
recorded_chunk_count:int
retrieved_chunks: List[RetrievedChunkOut]
top_score: float
helpful: Optional[bool] = None
created_at: datetime
class QALogFeedbackUpdate(BaseModel):
helpful:bool
class QALogFeedbackOut(BaseModel):
id:int
helpful:bool
class StatsOut(BaseModel):
total_documents: int
total_chunks: int
total_logs: int
grounded_count: int
no_evidence_count: int
error_count:int
helpful_count: int
unhelpful_count: int
avg_top_score: float
avg_grounded_top_score: float
avg_no_evidence_top_score: float
grounded_rate: float
no_evidence_rate: float
helpful_rate: float
rejected_by_threshold_count:int
rejected_by_generation_count:int
grounded_answer_count:int
generation_error_count:int