Skip to content

Commit 967dd6c

Browse files
authored
Merge pull request #28 from asapdiscovery/stricter_endpoints
Make LLM a bit stricter on endpoints
2 parents b73bbff + 31cfe61 commit 967dd6c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

falcbot/falcbot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,12 @@ def make_pic50_pred(event, say, context, logger):
8080
say(f"Invalid SMILES {smiles}, unable to proceed")
8181
return
8282

83+
targets = ASAPMLModelRegistry.get_targets_with_models()
84+
# filter out None values
85+
targets = [t for t in targets if t is not None]
8386
if not target in ASAPMLModelRegistry.get_targets_with_models():
8487
say(
85-
f"Invalid target {target}, not in: {ASAPMLModelRegistry.get_targets_with_models()}; unable to proceed"
88+
f"Invalid target {target}, not in: {targets}; unable to proceed"
8689
)
8790
return
8891

falcbot/llm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ class IsMLQuery(BaseModel):
2727
def _and_join(lst):
2828
return " and ".join(lst)
2929

30-
_base_ml_prompt_template = "You are an expert scientist, parse the following making sure all SMILES strings are represented exactly as in the input: Be very careful and use only SMILES already in the prompt. Allowed variables for target are {targets} and for property are {properties} : {query}"
30+
_base_ml_prompt_template = "You are an expert scientist, parse the following making sure all SMILES strings are represented exactly as in the input: Be very careful and use only SMILES already in the prompt. Allowed variables for target are {targets} and for property are {properties}. If properties do not appear close to the allowed values, use None. For targets you can be more generous: {query}"
3131

3232
def _make_ml_prompt_template() -> PromptTemplate:
3333
"""
3434
Create a prompt template for the ASAPMLModelQuery model
3535
"""
3636
# join to make a string with "and" between each
3737
targets_w_models = ASAPMLModelRegistry.get_targets_with_models()
38-
# filter out None values
39-
targets_w_models = [t for t in targets_w_models if t is not None]
38+
targets_w_models = [t for t in targets_w_models if t is not None] + ["None"]
39+
properties = ASAPMLModelRegistry.get_endpoints() + ["None"]
4040
target_str = _and_join(targets_w_models)
41-
properties = _and_join(ASAPMLModelRegistry.get_endpoints())
41+
properties = _and_join(properties)
4242
pt = PromptTemplate(_base_ml_prompt_template)
4343
formatted = pt.partial_format(targets=target_str, properties=properties)
4444
return formatted

0 commit comments

Comments
 (0)