Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -385,9 +385,7 @@ class DocumentRAG:
|
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
def generate_story_node(self, state: StoryState):
|
| 391 |
context = "\n\n".join(state.reranked_docs)
|
| 392 |
topic = state.story_topic
|
| 393 |
|
|
@@ -395,6 +393,7 @@ class DocumentRAG:
|
|
| 395 |
Suppose you're a brilliant science storyteller.
|
| 396 |
You write stories that help middle schoolers understand complex science topics with fun and clarity.
|
| 397 |
Add subtle humor and make it engaging.
|
|
|
|
| 398 |
"""
|
| 399 |
prompt = f"""
|
| 400 |
Use the following context to write a fun and simple story explaining **{topic}** to a middle schooler:\n
|
|
@@ -404,7 +403,6 @@ class DocumentRAG:
|
|
| 404 |
|
| 405 |
msg = self.llm.invoke([SystemMessage(system_message), HumanMessage(prompt)])
|
| 406 |
return {"stories": msg}
|
| 407 |
-
|
| 408 |
|
| 409 |
|
| 410 |
|
|
|
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
+
def generate_story_node(self, state: StoryState, language="English"):
|
|
|
|
|
|
|
| 389 |
context = "\n\n".join(state.reranked_docs)
|
| 390 |
topic = state.story_topic
|
| 391 |
|
|
|
|
| 393 |
Suppose you're a brilliant science storyteller.
|
| 394 |
You write stories that help middle schoolers understand complex science topics with fun and clarity.
|
| 395 |
Add subtle humor and make it engaging.
|
| 396 |
+
Write the story in {language}.
|
| 397 |
"""
|
| 398 |
prompt = f"""
|
| 399 |
Use the following context to write a fun and simple story explaining **{topic}** to a middle schooler:\n
|
|
|
|
| 403 |
|
| 404 |
msg = self.llm.invoke([SystemMessage(system_message), HumanMessage(prompt)])
|
| 405 |
return {"stories": msg}
|
|
|
|
| 406 |
|
| 407 |
|
| 408 |
|