Update app.py
Browse files
app.py
CHANGED
|
@@ -306,17 +306,23 @@ def first_node(state: State) -> State:
|
|
| 306 |
query_reference = None
|
| 307 |
state["query_reference"] = query_reference
|
| 308 |
|
| 309 |
-
prompt = f'You are given a QUERY_TASK below and a set of available tools.
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
|
| 321 |
res = chat_model.invoke(prompt)
|
| 322 |
|
|
@@ -364,11 +370,13 @@ def parser_node(state: State) -> State:
|
|
| 364 |
props_string = state["props_string"]
|
| 365 |
query_task = state["query_task"]
|
| 366 |
|
| 367 |
-
prompt = f'Using only the information provided in the CONTEXT below,
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
|
|
|
|
|
|
| 372 |
|
| 373 |
res = chat_model.invoke(prompt)
|
| 374 |
return {"messages": res}
|
|
@@ -384,11 +392,19 @@ def reflect_node(state: State) -> State:
|
|
| 384 |
previous_answer = state["messages"][-1].content
|
| 385 |
props_string = state["props_string"]
|
| 386 |
|
| 387 |
-
prompt = f'You will revise the PREVIOUS ANSWER below
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
PREVIOUS ANSWER
|
| 391 |
-
TOOL RESULTS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
|
| 393 |
res = chat_model.invoke(prompt)
|
| 394 |
return {"messages": res}
|
|
|
|
| 306 |
query_reference = None
|
| 307 |
state["query_reference"] = query_reference
|
| 308 |
|
| 309 |
+
prompt = f'You are given a QUERY_TASK given below and a set of available tools. \
|
| 310 |
+
Your job is to determine which tool(S) if any can accomplish the QUERY_TASK.\n\n \
|
| 311 |
+
Choose only from the tool names listed below.\n \
|
| 312 |
+
If exactly one tool can preform the task, reply with the tool name followed by "#".\n \
|
| 313 |
+
If two toold are required together, reply with both tool names separated by a comma, \
|
| 314 |
+
in a single line followed by a "#".\n \
|
| 315 |
+
If none of the tools can perform the task, reply with "None #".\n \
|
| 316 |
+
Reply with ONLY the tool names followed by "#". Tools:\n \
|
| 317 |
+
lipinski_tool: Calculates the following moelcular properties: Quantitative \
|
| 318 |
+
Estimate of Drug-likeness (QED), Molecular weight, LogP (measures lipophilicity, higher is more lipophilic), \
|
| 319 |
+
HBA, HBD, Polar Surface Area, number of rotatable bonds, number of aromatic rings and Undesireable Moieties. \n \
|
| 320 |
+
substitution_tool: Generates structural analogues of the molecule by substituting \
|
| 321 |
+
different chemical groups on the original molecule. Outputs novel molecules and their \
|
| 322 |
+
QED score (1 is most drug-like, 0 is least drug-like). \n \
|
| 323 |
+
pharm_feature_tool: this tool compares the pharmacophore features of a query molecule against \
|
| 324 |
+
a reference molecule. Rreporting the shared pharmacophore features and similarity feature score. \
|
| 325 |
+
Does not report features unique to either moelcule.'
|
| 326 |
|
| 327 |
res = chat_model.invoke(prompt)
|
| 328 |
|
|
|
|
| 370 |
props_string = state["props_string"]
|
| 371 |
query_task = state["query_task"]
|
| 372 |
|
| 373 |
+
prompt = f'Using only the information provided in the CONTEXT below, \
|
| 374 |
+
answer the QUERY_TASK.\n \
|
| 375 |
+
Your answer must:\n Directly address the QUERY_TASK.\n \
|
| 376 |
+
Use only facts found in the CONTEXT (do not invent information).\n \
|
| 377 |
+
Be concise, precise and logically consistent.\n End your answer with a "#" \
|
| 378 |
+
QUERY_TASK: {query_task}.\n \
|
| 379 |
+
CONTEXT: {props_string}.\n '
|
| 380 |
|
| 381 |
res = chat_model.invoke(prompt)
|
| 382 |
return {"messages": res}
|
|
|
|
| 392 |
previous_answer = state["messages"][-1].content
|
| 393 |
props_string = state["props_string"]
|
| 394 |
|
| 395 |
+
prompt = f'You will revise the PREVIOUS ANSWER below using the tools results \
|
| 396 |
+
which you provided below \
|
| 397 |
+
INSTRUCTIONS:\n \
|
| 398 |
+
Retain all correct information from the PREVIOUS ANSWER. \
|
| 399 |
+
Incorporate only relevent information from the TOOL RESULTS. \
|
| 400 |
+
Add clarifying or enriching details. \
|
| 401 |
+
Do NOT invent or assume any information that is not present in the input. \
|
| 402 |
+
Improve clarity, precision, factual accuracy, and organisation. \
|
| 403 |
+
Provide a well-structured improved asnwer. \
|
| 404 |
+
End \
|
| 405 |
+
your new answer with a "#" \
|
| 406 |
+
PREVIOUS ANSWER: {previous_answer}.\n \
|
| 407 |
+
TOOL RESULTS: {props_string}. '
|
| 408 |
|
| 409 |
res = chat_model.invoke(prompt)
|
| 410 |
return {"messages": res}
|