Spaces:
Running
Running
Ilyas KHIAT
commited on
Commit
•
d8b8d75
1
Parent(s):
6298afb
whatif
Browse files
main.py
CHANGED
@@ -137,8 +137,8 @@ async def generate(user_input: UserInput):
|
|
137 |
@app.post("/whatif")
|
138 |
async def generate_whatif(whatif_input: WhatifInput):
|
139 |
try:
|
140 |
-
print(whatif_input)
|
141 |
-
return generate_whatif_stream(whatif_input["question"],whatif_input["
|
142 |
except Exception as e:
|
143 |
return {"message": str(e)}
|
144 |
|
|
|
137 |
@app.post("/whatif")
|
138 |
async def generate_whatif(whatif_input: WhatifInput):
|
139 |
try:
|
140 |
+
print(f"whatif_input: {whatif_input}")
|
141 |
+
return generate_whatif_stream(whatif_input["question"],whatif_input["answer"])
|
142 |
except Exception as e:
|
143 |
return {"message": str(e)}
|
144 |
|
rag.py
CHANGED
@@ -174,7 +174,7 @@ def generate_stream(query:str,messages = [], model = "gpt-4o-mini", max_tokens =
|
|
174 |
print(e)
|
175 |
return False
|
176 |
|
177 |
-
def generate_whatif_stream(question:str,response:str, stream:bool =
|
178 |
try:
|
179 |
prompt = PromptTemplate.from_template(template_whatif)
|
180 |
llm_chain = prompt | llm | StrOutputParser()
|
|
|
174 |
print(e)
|
175 |
return False
|
176 |
|
177 |
+
def generate_whatif_stream(question:str,response:str, stream:bool = False) -> str:
|
178 |
try:
|
179 |
prompt = PromptTemplate.from_template(template_whatif)
|
180 |
llm_chain = prompt | llm | StrOutputParser()
|