Skip to content

Commit be9e771

Browse files
Fixed bug in run folder naming and added link to FutureHouse trajectory in output files (#5)
1 parent 2b2858f commit be9e771

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ coverage.xml
100100
.hypothesis/
101101
.tox/
102102
htmlcov/
103+
scratchpad.ipynb
103104

104105
# Documentation
105106
docs/_build/

robin/configuration.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ def get_default_llm_config():
5959
return copy.deepcopy(_DEFAULT_LLM_CONFIG_DATA)
6060

6161

62-
DEFAULT_DISEASE_NAME = "dry age-related macular degeneration"
63-
DEFAULT_FOLDER_NAME = f"{DEFAULT_DISEASE_NAME[:70].replace(" ", "_")}_{datetime.now().strftime("%Y-%m-%d_%H-%M")}"
64-
65-
6662
def _get_prompt_args(template_string: str) -> set[str]:
6763
"""
6864
Extracts root variable names from f-string like placeholders (e.g., {variable})
@@ -276,20 +272,31 @@ class Config:
276272
default=5, description="Number of candidates to generate for each query."
277273
)
278274
disease_name: str = Field(
279-
default=DEFAULT_DISEASE_NAME, description="Name of the disease to focus on."
275+
default="input_disease", description="Name of the disease to focus on."
280276
)
281-
run_folder_name: str = Field(
282-
default=DEFAULT_FOLDER_NAME,
283-
description="Name of the folder where results will be stored.",
277+
run_folder_name: str | None = Field(
278+
default=None,
279+
description=(
280+
"Name of the folder where results will be stored. "
281+
"If not provided or None, it will be auto-generated "
282+
"using the disease_name and the timestamp."
283+
),
284284
)
285-
286285
futurehouse_api_key: str = "insert_futurehouse_api_key_here"
287286
llm_name: str = "o4-mini"
288287
llm_config: dict | None = Field(default_factory=get_default_llm_config)
289288
agent_settings: AgentConfig = Field(default_factory=AgentConfig)
290289
_fh_client: FutureHouseClient | None = PrivateAttr(default=None)
291290
_llm_client: LiteLLMModel | None = PrivateAttr(default=None)
292291

292+
@model_validator(mode="after")
293+
def set_run_folder_name_default(self) -> "RobinConfiguration":
294+
if self.run_folder_name is None:
295+
disease_part = self.disease_name[:70].replace(" ", "_")
296+
timestamp_part = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
297+
self.run_folder_name = f"{disease_part}_{timestamp_part}"
298+
return self
299+
293300
@property
294301
def fh_client(self) -> FutureHouseClient:
295302
if self._fh_client is None:

robin/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def save_crow_files(
251251
query_text = item.get("query", "").strip()
252252
answer_text = item.get("answer", "").strip()
253253
sources_text = item.get("sources", "").strip()
254+
task_id_text = item.get("task_run_id", "").strip()
254255

255256
file_number = i + 1
256257

@@ -274,6 +275,7 @@ def save_crow_files(
274275
content = f"Hypothesis: {hypothesis_text}\n\n"
275276
content += f"Query: {query_text}\n\n"
276277
content += f"{answer_text}\n\n"
278+
content += f"Full trajectory link: https://platform.futurehouse.org/trajectories/{task_id_text}\n\n"
277279
content += f"References:\n{sources_text}\n"
278280

279281
try:
@@ -297,6 +299,7 @@ def save_falcon_files(
297299
for i, item in enumerate(data_list):
298300
hypothesis_text = item.get("hypothesis", "").strip()
299301
formatted_output_text = item.get("formatted_output", "").strip()
302+
task_id_text = item.get("task_run_id", "").strip()
300303

301304
file_number = i + 1
302305

@@ -316,7 +319,8 @@ def save_falcon_files(
316319
filepath = run_dir_path / filename
317320

318321
content = f"Proposal for {hypothesis_text}\n\n"
319-
content += f"{formatted_output_text}"
322+
content += f"{formatted_output_text}\n\n"
323+
content += f"Full trajectory link: https://platform.futurehouse.org/trajectories/{task_id_text}\n"
320324

321325
try:
322326
filepath.write_text(content, encoding="utf-8")

0 commit comments

Comments
 (0)