How does the LLM know the action types in SQL query generation Lab?

In the ungraded lab for SQL QUERY generation we pass the table schema which only has column name and column data type. But the code generated by LLM has this where condition action = ‘sale‘. I tried asking for the product with most price updates and it generated the code with where condition action = ‘price_update‘. My question is how does the LLM know what are the values in the column action it should check for? Since we only gave it info about the column name and its type..

did you you check the metadata, when a prompt is given to an LLM, it use the tool function to read, response, review and refine the data to give you the final output, when you go further in module 3, it is explained about how tools read these prompts.

There’s a generate_sql functions which takes 3 parameters- question, schema & model name. The schema passed to that function is a string as below

schema = """
Table name: transactions
id (INTEGER)
product_id (INTEGER)
product_name (TEXT)
brand (TEXT)
category (TEXT)
color (TEXT)
action (TEXT)
qty_delta (INTEGER)
unit_price (REAL)
notes (TEXT)
ts (DATETIME)
"""

I don’t see any metadata being passed here. Still the model generates the correct query with action=’sale’. Is the tool call that is fetching the metadata hidden in the implementation of aisuite module? Is that what you are trying to say?

not here, check in the utils.py file. you will find this in file==>Open section, but remember these schema is actually important as it has segregated information from the document used or provided, as these schema will be used by the tool call function to get the information based on the prompt asked or fed

1 Like