Skip to content

Commit cfaf887

Browse files
Merge pull request #250 from MantisAI/fix/demo-result-access
Fix demo API compatibility with sieves Result schemas
2 parents 9cc677e + 6cfb7ca commit cfaf887

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

demos/demo_chatcontrol.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
"""Chat Control demo for Marimo."""
2+
23
import marimo
34

4-
__generated_with = "0.18.3"
5-
app = marimo.App(
6-
width="full",
7-
layout_file="layouts/demo_chatcontrol.slides.json",
8-
)
5+
__generated_with = "0.18.4"
6+
app = marimo.App(width="full")
97

108
with app.setup:
11-
# Initialization code that runs before all other cells
12-
pass
9+
from dotenv import load_dotenv
10+
load_dotenv()
1311

1412

1513
@app.cell(hide_code=True)
@@ -25,7 +23,6 @@ def _(mo):
2523
@app.cell
2624
def _():
2725
import marimo as mo
28-
2926
return (mo,)
3027

3128

@@ -146,7 +143,6 @@ class RelatedLiterature(pydantic.BaseModel, frozen=True):
146143

147144
topic: str = pydantic.Field(description="Topic or title of the article on this.")
148145
link: str = pydantic.Field(description="Link to the article.")
149-
150146
return (RelatedLiterature,)
151147

152148

@@ -207,7 +203,7 @@ def _(mo):
207203

208204
@app.cell
209205
def _(pprint, result):
210-
pprint(result["QuestionAnswering"][0])
206+
pprint(result["QuestionAnswering"].qa_pairs[0])
211207
return
212208

213209

@@ -221,7 +217,7 @@ def _(mo):
221217

222218
@app.cell
223219
def _(pprint, result):
224-
pprint(result["QuestionAnswering"][1])
220+
pprint(result["QuestionAnswering"].qa_pairs[1])
225221
return
226222

227223

@@ -249,7 +245,7 @@ def _(mo):
249245

250246
@app.cell
251247
def _(result):
252-
for article in result["InformationExtraction"]:
248+
for article in result["InformationExtraction"].entities:
253249
print(article.topic)
254250
print(f"{article.link}")
255251
print("#######")

0 commit comments

Comments
 (0)