IterativeTableLookup#

class lumen.ai.tools.IterativeTableLookup(*, max_selection_iterations, table_similarity_threshold, _ready, enable_select_columns, enable_table_validation, include_columns, include_metadata, include_misc, max_concurrent, sync_sources, enable_query_refinement, max_refinement_iterations, min_refinement_improvement, min_similarity, n, refinement_similarity_threshold, vector_store, always_use, interface, llm, memory, prompts, template_overrides, purpose, name)#

Extended version of TableLookup that performs an iterative table selection process. This tool uses an LLM to select tables in multiple passes, examining schemas in detail.


Parameters#

enable_query_refinement

type: bool
default: True
Whether to enable query refinement for improving search results.

enable_select_columns

type: bool
default: True
Whether to enable column subsetting to filter out irrelevant columns.

enable_table_validation

type: bool
default: True
Whether to enable validation of tables between queries to determineif the full TableLookup process needs to be rerun.

include_columns

type: bool
default: True
Whether to include column names and descriptions in the embeddings.

include_metadata

type: bool
default: True
Whether to include table descriptions in the embeddings and responses.

include_misc

type: bool
default: False
Whether to include miscellaneous metadata in the embeddings,besides table and column descriptions.

max_concurrent

type: int
default: 1
bounds: None
Maximum number of concurrent metadata fetch operations.

max_refinement_iterations

type: int
default: 3
bounds: (1, 10)
Maximum number of refinement iterations to perform.

max_selection_iterations

type: int
default: 3
bounds: None
Maximum number of iterations for the iterative table selection process.

min_refinement_improvement

type: Number
default: 0.05
bounds: (0, 1)
Minimum improvement in similarity score required to keep refining.

min_similarity

type: Number
default: 0.05
bounds: None
The minimum similarity to include a document.

n

type: int
default: 10
bounds: (1, None)
The number of document results to return.

refinement_similarity_threshold

type: Number
default: 0.3
bounds: (0, 1)
Similarity threshold below which query refinement is triggered.

sync_sources

type: bool
default: True
Whether to automatically sync newly added data sources to the vector store.

table_similarity_threshold

type: Number
default: 0.5
bounds: None
If any tables have a similarity score above this threshold,those tables will be automatically selected and there will not be aniterative table selection process.

vector_store

type: lumen.ai.vector_store.VectorStore
default: None
Vector store object which is queried to provide additional contextbefore responding.


Methods#

async IterativeTableLookup.requirements(messages: list[Message]) list[str]#
async IterativeTableLookup.respond(messages: list[Message], **kwargs: dict[str, Any]) str#

Fetches tables based on the user query, selects relevant columns, and returns formatted context.