-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexamples.py
36 lines (27 loc) · 826 Bytes
/
examples.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
from attr import attrs, attrib
from typing import List, Dict
from blendsql.utils import newline_dedent
from blendsql.ingredients.few_shot import Example
@attrs(kw_only=True)
class JoinExample(Example):
join_criteria: str = attrib(default="Join to the same topics.")
left_values: List[str] = attrib()
right_values: List[str] = attrib()
def to_string(self, *args, **kwargs) -> str:
return newline_dedent(
"""
Criteria: {}
Left Values:
{}
Right Values:
{}
Output:
""".format(
self.join_criteria,
"\n".join(self.left_values),
"\n".join(self.right_values),
)
)
@attrs(kw_only=True)
class AnnotatedJoinExample(JoinExample):
mapping: Dict[str, str] = attrib()