Skip to content

Commit 7e55cd7

Browse files
(wip) clean up prompt file
1 parent c86873b commit 7e55cd7

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

src/agentlab/agents/generic_agent_hinter/generic_agent_prompt.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ def __init__(
352352
self.llm = llm
353353
self.hint_level: Literal["episode", "step"] = hint_level
354354
self.queries: list[str] | None = queries
355-
self._init()
356355

357356
_prompt = "" # Task hints are added dynamically in MainPrompt
358357

@@ -369,50 +368,6 @@ def __init__(
369368
</task_hint>
370369
"""
371370

372-
def _init(self):
373-
"""Initialize the block."""
374-
try:
375-
if self.hint_type == "docs":
376-
if self.hint_index_type == "sparse":
377-
import bm25s
378-
self.hint_index = bm25s.BM25.load(self.hint_index_path, load_corpus=True)
379-
elif self.hint_index_type == "dense":
380-
from datasets import load_from_disk
381-
from sentence_transformers import SentenceTransformer
382-
self.hint_index = load_from_disk(self.hint_index_path)
383-
self.hint_index.load_faiss_index("embeddings", self.hint_index_path.removesuffix("/") + ".faiss")
384-
self.hint_retriever = SentenceTransformer(self.hint_retriever_path)
385-
else:
386-
raise ValueError(f"Unknown hint index type: {self.hint_index_type}")
387-
else:
388-
# Use external path if provided, otherwise fall back to relative path
389-
if self.hint_db_path and Path(self.hint_db_path).exists():
390-
hint_db_path = Path(self.hint_db_path)
391-
else:
392-
hint_db_path = Path(__file__).parent / self.hint_db_rel_path
393-
394-
if hint_db_path.exists():
395-
self.hint_db = pd.read_csv(hint_db_path, header=0, index_col=None, dtype=str)
396-
# Verify the expected columns exist
397-
if "task_name" not in self.hint_db.columns or "hint" not in self.hint_db.columns:
398-
print(
399-
f"Warning: Hint database missing expected columns. Found: {list(self.hint_db.columns)}"
400-
)
401-
self.hint_db = pd.DataFrame(columns=["task_name", "hint"])
402-
else:
403-
print(f"Warning: Hint database not found at {hint_db_path}")
404-
self.hint_db = pd.DataFrame(columns=["task_name", "hint"])
405-
406-
self.hints_source = HintsSource(
407-
hint_db_path=hint_db_path.as_posix(),
408-
hint_retrieval_mode=self.hint_retrieval_mode,
409-
skip_hints_for_current_task=self.skip_hints_for_current_task,
410-
)
411-
except Exception as e:
412-
# Fallback to empty database on any error
413-
print(f"Warning: Could not load hint database: {e}")
414-
self.hint_db = pd.DataFrame(columns=["task_name", "hint"])
415-
416371
def get_hints_for_task(self, task_name: str) -> str:
417372
"""Get hints for a specific task."""
418373
if not self.use_task_hint:
@@ -450,10 +405,6 @@ def get_hints_for_task(self, task_name: str) -> str:
450405
)
451406
return hints_str
452407

453-
# Ensure hint_db is initialized
454-
if not hasattr(self, "hint_db"):
455-
self._init()
456-
457408
# Check if hint_db has the expected structure
458409
if (
459410
self.hint_db.empty

0 commit comments

Comments
 (0)