-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathtable_mobject.py
More file actions
33 lines (25 loc) · 841 Bytes
/
table_mobject.py
File metadata and controls
33 lines (25 loc) · 841 Bytes
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
# pytest: ollama, e2e
from io import StringIO
import pandas
import mellea
from mellea.stdlib.components.mify import MifiedProtocol, mify
@mify(fields_include={"table"}, template="{{ table }}")
class MyCompanyDatabase:
table: str = """| Store | Sales |
| ---------- | ------- |
| Northeast | $250 |
| Southeast | $80 |
| Midwest | $420 |"""
def transpose(self):
pandas.read_csv(
StringIO(self.table),
sep="|",
skipinitialspace=True,
header=0,
index_col=False,
)
m = mellea.start_session()
db = MyCompanyDatabase()
assert isinstance(db, MifiedProtocol)
answer = m.query(db, "What were sales for the Northeast branch this month?")
print(str(answer))