Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzy table matching part 2 #552

Merged
merged 17 commits into from
May 14, 2024
Merged

Fuzzy table matching part 2 #552

merged 17 commits into from
May 14, 2024

Conversation

ahuang11
Copy link
Contributor

No description provided.

@@ -213,6 +214,8 @@ async def _invalidate_memory(self, messages):
invalid_key = validity.invalid_key
if invalid_key == "table":
memory.pop("current_table", None)
memory.pop("current_data", None)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pop out stale data

@@ -182,8 +182,9 @@ def use_suggestion(event):
async def _invalidate_memory(self, messages):
table = memory.get("current_table")
sql = memory.get("current_sql")
if not sql:
if not table and not sql:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be sure to invalidate table too.

Comment on lines -335 to -345
source = memory.get("current_source")
tables = source.get_tables() if source else []
if len(tables) > FUZZY_TABLE_LENGTH:
closest_tables = await self._get_closest_tables(messages, tables, n=5)
if len(closest_tables) == 0:
# if no tables are found, ask the user to select ones and load it
tables = await self._select_table(tables)
return self.requires + ['current_table']
elif len(closest_tables) == 1:
return self.requires + ['current_table']

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed with better logic in invalidating and checks.

return tuple(closest_tables)
if len(closest_tables) == 0:
# if no tables are found, ask the user to select ones and load it
tables = await self._select_table(tables)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only select if unavailable to auto select.

@ahuang11 ahuang11 requested a review from philippjfr May 13, 2024 19:32
@philippjfr philippjfr merged commit b7a728d into lumen_ai May 14, 2024
0 of 11 checks passed
@philippjfr philippjfr deleted the fuzzy_table_matching branch May 14, 2024 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants