Skip to content

Commit

Permalink
Ensure parallel data access does not lock up server (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored Nov 13, 2024
1 parent 6987b9a commit 9a16398
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions lumen/ai/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,14 +521,10 @@ async def _lookup_schemas(
cache: dict[str, dict] | None = None
) -> str:
cache = cache or {}
to_query, queries = [], []
for table in requested:
if table in provided or table in cache:
continue
to_query.append(table)
queries.append(get_schema(tables[table], table, limit=3))
for table, schema in zip(to_query, await asyncio.gather(*queries)):
cache[table] = schema
cache[table] = await get_schema(tables[table], table, limit=3)
schema_info = ''
for table in requested:
if table in provided:
Expand Down
2 changes: 1 addition & 1 deletion lumen/ai/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def make_plan_models(agent_names: list[str], tables: list[str]):
extras['tables'] = (
list[Literal[tuple(tables)]],
FieldInfo(
description="A list of tables you want to inspect before coming up with a plan."
description="A list of tables to load into memory before coming up with a plan. NOTE: Simple queries asking to list the tables/datasets do not require loading the tables."
)
)
reasoning = create_model(
Expand Down

0 comments on commit 9a16398

Please sign in to comment.