diff --git a/.gitignore b/.gitignore index b48e65c..fce4a63 100644 --- a/.gitignore +++ b/.gitignore @@ -100,6 +100,7 @@ coverage.xml .hypothesis/ .tox/ htmlcov/ +scratchpad.ipynb # Documentation docs/_build/ diff --git a/robin/configuration.py b/robin/configuration.py index 8c078c5..6ab9bab 100644 --- a/robin/configuration.py +++ b/robin/configuration.py @@ -59,10 +59,6 @@ def get_default_llm_config(): return copy.deepcopy(_DEFAULT_LLM_CONFIG_DATA) -DEFAULT_DISEASE_NAME = "dry age-related macular degeneration" -DEFAULT_FOLDER_NAME = f"{DEFAULT_DISEASE_NAME[:70].replace(" ", "_")}_{datetime.now().strftime("%Y-%m-%d_%H-%M")}" - - def _get_prompt_args(template_string: str) -> set[str]: """ Extracts root variable names from f-string like placeholders (e.g., {variable}) @@ -276,13 +272,16 @@ class Config: default=5, description="Number of candidates to generate for each query." ) disease_name: str = Field( - default=DEFAULT_DISEASE_NAME, description="Name of the disease to focus on." + default="input_disease", description="Name of the disease to focus on." ) - run_folder_name: str = Field( - default=DEFAULT_FOLDER_NAME, - description="Name of the folder where results will be stored.", + run_folder_name: str | None = Field( + default=None, + description=( + "Name of the folder where results will be stored. " + "If not provided or None, it will be auto-generated " + "using the disease_name and the timestamp." + ), ) - futurehouse_api_key: str = "insert_futurehouse_api_key_here" llm_name: str = "o4-mini" llm_config: dict | None = Field(default_factory=get_default_llm_config) @@ -290,6 +289,14 @@ class Config: _fh_client: FutureHouseClient | None = PrivateAttr(default=None) _llm_client: LiteLLMModel | None = PrivateAttr(default=None) + @model_validator(mode="after") + def set_run_folder_name_default(self) -> "RobinConfiguration": + if self.run_folder_name is None: + disease_part = self.disease_name[:70].replace(" ", "_") + timestamp_part = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") + self.run_folder_name = f"{disease_part}_{timestamp_part}" + return self + @property def fh_client(self) -> FutureHouseClient: if self._fh_client is None: diff --git a/robin/utils.py b/robin/utils.py index 1e0f419..bffa3e7 100644 --- a/robin/utils.py +++ b/robin/utils.py @@ -251,6 +251,7 @@ def save_crow_files( query_text = item.get("query", "").strip() answer_text = item.get("answer", "").strip() sources_text = item.get("sources", "").strip() + task_id_text = item.get("task_run_id", "").strip() file_number = i + 1 @@ -274,6 +275,7 @@ def save_crow_files( content = f"Hypothesis: {hypothesis_text}\n\n" content += f"Query: {query_text}\n\n" content += f"{answer_text}\n\n" + content += f"Full trajectory link: https://platform.futurehouse.org/trajectories/{task_id_text}\n\n" content += f"References:\n{sources_text}\n" try: @@ -297,6 +299,7 @@ def save_falcon_files( for i, item in enumerate(data_list): hypothesis_text = item.get("hypothesis", "").strip() formatted_output_text = item.get("formatted_output", "").strip() + task_id_text = item.get("task_run_id", "").strip() file_number = i + 1 @@ -316,7 +319,8 @@ def save_falcon_files( filepath = run_dir_path / filename content = f"Proposal for {hypothesis_text}\n\n" - content += f"{formatted_output_text}" + content += f"{formatted_output_text}\n\n" + content += f"Full trajectory link: https://platform.futurehouse.org/trajectories/{task_id_text}\n" try: filepath.write_text(content, encoding="utf-8")