Skip to content

Commit 04eddfe

Browse files
Fix incorrect references for docs retrieval hinter agent (#313)
* address comments * format
1 parent a46ddc6 commit 04eddfe

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/agentlab/agents/hint_use_agent/generic_agent.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@ def _init_hints_index(self):
271271
"""Initialize the block."""
272272
try:
273273
if self.flags.hint_type == "docs":
274+
if self.flags.hint_index_type == "direct":
275+
print(
276+
"WARNING: Hint index type 'direct' is not supported for docs. Using 'sparse' instead."
277+
)
278+
self.flags.hint_index_type = "sparse"
274279
if self.flags.hint_index_type == "sparse":
275280
import bm25s
276281

@@ -323,18 +328,21 @@ def _get_task_hints(self) -> list[str]:
323328
return []
324329

325330
if self.flags.hint_type == "docs":
331+
if self.flags.hint_index_type == "direct":
332+
print(
333+
"WARNING: Hint index type 'direct' is not supported for docs. Using 'sparse' instead."
334+
)
335+
self.flags.hint_index_type = "sparse"
326336
if not hasattr(self, "hint_index"):
327-
print("Initializing hint index new time")
328-
# @patricebechard It seems _.init() method is missing do we still need it?
329-
# self._init()
337+
print("WARNING: Hint index not initialized. Initializing now.")
338+
self._init_hints_index()
330339
if self.flags.hint_query_type == "goal":
331340
query = self.obs_history[-1]["goal_object"][0]["text"]
332341
elif self.flags.hint_query_type == "llm":
333342
queries, _ = self._get_queries()
334343
# HACK: only 1 query supported
335344
query = queries[0]
336345
else:
337-
# @patricebechard: This raises an error with the default value 'direct'
338346
raise ValueError(f"Unknown hint query type: {self.flags.hint_query_type}")
339347

340348
print(f"Query: {query}")

0 commit comments

Comments
 (0)