Spaces:
Sleeping
Sleeping
updated
Browse files
app.py
CHANGED
@@ -91,7 +91,7 @@ prompt = ChatPromptTemplate.from_messages(
|
|
91 |
@app.post("/generate_story/")
|
92 |
async def generate_story(story_request: StoryRequest):
|
93 |
|
94 |
-
chain = prompt | llm
|
95 |
|
96 |
story = f"""here are the inputs from user:
|
97 |
- **Mood:** {story_request.mood}
|
@@ -100,7 +100,14 @@ async def generate_story(story_request: StoryRequest):
|
|
100 |
- **Details Provided:** {story_request.txt}
|
101 |
"""
|
102 |
|
103 |
-
response = chain.invoke({"messages": [HumanMessage(content=story)]})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
# final_prompt = prompt_template.format(text=story)
|
106 |
|
|
|
91 |
@app.post("/generate_story/")
|
92 |
async def generate_story(story_request: StoryRequest):
|
93 |
|
94 |
+
# chain = prompt | llm
|
95 |
|
96 |
story = f"""here are the inputs from user:
|
97 |
- **Mood:** {story_request.mood}
|
|
|
100 |
- **Details Provided:** {story_request.txt}
|
101 |
"""
|
102 |
|
103 |
+
# response = chain.invoke({"messages": [HumanMessage(content=story)]})
|
104 |
+
|
105 |
+
formatted_prompt = prompt.format(messages=[HumanMessage(content=story)])
|
106 |
+
|
107 |
+
# Extract the raw string from the `ChatPromptValue`
|
108 |
+
formatted_text = formatted_prompt.to_string()
|
109 |
+
|
110 |
+
response = llm(formatted_text)
|
111 |
|
112 |
# final_prompt = prompt_template.format(text=story)
|
113 |
|