Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/agentlab/agents/hint_use_agent/generic_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ def _init_hints_index(self):
"""Initialize the block."""
try:
if self.flags.hint_type == "docs":
if self.flags.hint_index_type == "direct":
print(
"WARNING: Hint index type 'direct' is not supported for docs. Using 'sparse' instead."
)
self.flags.hint_index_type = "sparse"
if self.flags.hint_index_type == "sparse":
import bm25s

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

if self.flags.hint_type == "docs":
if self.flags.hint_index_type == "direct":
print(
"WARNING: Hint index type 'direct' is not supported for docs. Using 'sparse' instead."
)
self.flags.hint_index_type = "sparse"
if not hasattr(self, "hint_index"):
print("Initializing hint index new time")
# @patricebechard It seems _.init() method is missing do we still need it?
# self._init()
print("WARNING: Hint index not initialized. Initializing now.")
self._init_hints_index()
if self.flags.hint_query_type == "goal":
query = self.obs_history[-1]["goal_object"][0]["text"]
elif self.flags.hint_query_type == "llm":
queries, _ = self._get_queries()
# HACK: only 1 query supported
query = queries[0]
else:
# @patricebechard: This raises an error with the default value 'direct'
raise ValueError(f"Unknown hint query type: {self.flags.hint_query_type}")

print(f"Query: {query}")
Expand Down
Loading