-
Notifications
You must be signed in to change notification settings - Fork 3
/
models.py
54 lines (44 loc) · 1.47 KB
/
models.py
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
from pydantic import BaseModel, field_validator
# Also works for MultiHop Query
class SyntheticQuery(BaseModel):
query: str
explanation: str
class Property(BaseModel):
name: str
data_type: str
class WeaviateCollectionConfig(BaseModel):
name: str
properties: list[Property]
envisioned_use_case_overview: str
class SimpleSyntheticSchema(BaseModel):
envisioned_use_case_description: str
name: str
text_valued_property_name: str
int_valued_property_name: str
boolean_valued_property_name: str
# Not sure if this works
class ComplexSyntheticSchema(BaseModel):
envisioned_use_case_description: str
name: str
text_valued_property_names: list[str]
int_valued_property_names: list[str]
boolean_valued_property_names: list[str]
@field_validator('text_valued_property_names', 'int_valued_property_names', 'boolean_valued_property_names')
def check_list_length(cls, v):
assert len(v) == 2, f'Must have at least two {v}'
return v
class PredictionWithGroundTruth(BaseModel):
prediction: int
ground_truth: int
class PromptWithResponse(BaseModel):
prompt: str
response: str
class FunctionClassifierTestResult(BaseModel):
num_correct: int
num_attempted: int
accuracy: float
confusion_matrix: list[PredictionWithGroundTruth]
misclassified_repsonses: list[PromptWithResponse]
all_responses: list[PromptWithResponse]
class TestLMConnectionModel(BaseModel):
generic_response: str