-
Notifications
You must be signed in to change notification settings - Fork 653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add clinical trials search tool #777
base: main
Are you sure you want to change the base?
Conversation
@@ -33,8 +39,20 @@ | |||
|
|||
POPULATE_FROM_SETTINGS = None | |||
|
|||
DEFAULT_TOOL_NAMES: list[str] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, nice.
What do you think of moving this to be co-located with AVAILABLE_TOOL_NAME_TO_CLASS
in tools
?
class ClinicalTrialsSearch(NamedTool): | ||
TOOL_FN_NAME = "clinical_trials_search" | ||
|
||
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why arbitrary_types_allowed=True
? I don't think we need it (may be wrong here tho)
""" | ||
) | ||
|
||
async def clinical_trials_search(self, query: str, state: EnvironmentState): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async def clinical_trials_search(self, query: str, state: EnvironmentState): | |
async def clinical_trials_search(self, query: str, state: EnvironmentState) -> str: |
Even though we don't use return type now, it's still nice to have for IDE usage
settings: Settings = Field(default_factory=Settings) | ||
|
||
# Gather evidence tool must be modified to understand the new evidence | ||
GATHER_EVIDENCE_TOOL_PROMPT_OVERRIDE: ClassVar[str] = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try print
ing this? I think it will have extra spaces unless you do """Gather evidence...
}, | ||
) as response: | ||
if response.status == MALFORMATTED_QUERY_STATUS: | ||
# the 400s from clinicaltrials.gov are not JSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind moving this comment to live with MALFORMATTED_QUERY_STATUS
, or renaming MALFORMATTED_QUERY_STATUS
to be CLINICAL_TRIALS_DIDNT_GIVE_JSON = 400
Returns: | ||
tuple[int, int, str | None]: | ||
Total number of trials found, number of trials added, and error message if any. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
# SEE: https://regex101.com/r/L0L5MH/1 | ||
CLINICAL_STATUS_SEARCH_REGEX_PATTERN: str = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you co-locate this with the status generation code? Makes sense to have next to each other in the code
This upstreams FutureHouse's clinical trials search tool to make it open source. The tool is not turned on by default, but I'm going to make more docs on how to use the tool as well.
I also found many typing regressions -- I've added those back in where necessary.