Smoothie
Smoothie
The Smoothie
object defines the output of an executed BlendSQL script.
Source code in blendsql/smoothie.py
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 | @dataclass
class Smoothie:
df: pd.DataFrame = field()
meta: SmoothieMeta = field()
def __post_init__(self):
self.df = PrettyDataFrame(self.df)
def summary(self):
s = "-------------------------------- SUMMARY --------------------------------\n"
s += self.meta.query + "\n"
s += tabulate(
pd.DataFrame(
{
"Time (s)": self.meta.process_time_seconds
if hasattr(self.meta, "process_time_seconds")
else "N.A.",
"# Generation Calls": self.meta.num_generation_calls,
"Prompt Tokens": self.meta.prompt_tokens,
"Completion Tokens": self.meta.completion_tokens,
},
index=[0],
)
)
return s
def __str__(self):
return self.summary()
|
Source code in blendsql/smoothie.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 | @dataclass
class SmoothieMeta:
num_values_passed: int = (
field()
) # Number of values passed to a Map/Join/QA ingredient
num_generation_calls: int = field() # Number of generation calls made to the model
prompt_tokens: int = field()
completion_tokens: int = field()
prompts: t.List[dict] = field() # Log of prompts submitted to model
raw_prompts: t.List[str] = field()
ingredients: t.Iterable[t.Type[Ingredient]] = field()
query: str = field()
db_url: str = field()
contains_ingredient: bool = field(default=True)
process_time_seconds: float = field(default="N.A.")
|