zeeshan391 commited on
Commit
bed1a2d
1 Parent(s): dad3a96
Files changed (1) hide show
  1. app.py +9 -2
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