Skip to content

Commit

Permalink
Automatically resolve table requested by TableListAgent (#690)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Aug 22, 2024
1 parent 97e686c commit 56bb843
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lumen/ai/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ async def answer(self, messages: list | str):
tables_schema_str = ""

tables = tuple(tables_to_source)
if len(tables) == 1:
if messages and messages[-1]["content"].startswith("Show the table: '"):
# Handle the case where the TableListAgent explicitly requested a table
table = messages[-1]["content"].replace("Show the table: '", "")[:-1]
elif len(tables) == 1:
table = tables[0]
else:
with self.interface.add_step(title="Choosing the most relevant table...") as step:
Expand Down

0 comments on commit 56bb843

Please sign in to comment.