Skip to content

Commit

Permalink
fix unformatted strings (MERGE BEFORE RELEASE) (#867)
Browse files Browse the repository at this point in the history
ahuang11 authored Dec 14, 2024
1 parent 04fc98e commit 81e9dc0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lumen/ai/tools.py
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ def __init__(self, **params):
def _update_vector_store(self, _, __, sources):
for source in sources:
for table in source.get_tables():
source_table = f'{source.name}SOURCE_TABLE_SEPARATOR{table}'
source_table = f'{source.name}{SOURCE_TABLE_SEPARATOR}{table}'
if not self.vector_store.query(source_table, threshold=1):
self.vector_store.add([{"text": source_table}])

@@ -121,8 +121,11 @@ async def respond(self, messages: list[Message], **kwargs: dict[str, Any]) -> st
threshold=self.min_similarity,
)
for result in results:
table_name = result["text"].split(SOURCE_TABLE_SEPARATOR, 1)[1]
closest_tables.append(table_name)
if SOURCE_TABLE_SEPARATOR not in result["text"]:
closest_tables.append(result["text"])
else:
table_name = result["text"].split(SOURCE_TABLE_SEPARATOR, 1)[1]
closest_tables.append(table_name)

if not closest_tables:
message = "No relevant tables found, but here are some other tables:\n"

0 comments on commit 81e9dc0

Please sign in to comment.