#2008 made describe_data accept any narwhals frame, but it converts on entry at ai/utils.py:784 and the ~200 lines below it are pandas. The conversion was deliberately put in one place during that review so it could be lifted later, which is what this is.
Two smaller helpers in the same category still take pandas only:
format_exploration_result (ai/agents/sql.py:128), fed by BaseSQLSource.execute which is contracted to return pandas
sanitize_column_names (ai/utils.py:1769), used by the DeckGL agent
Moving these onto narwhals would let a polars or pyarrow source reach the LLM context without a copy. describe_data is the one worth doing first since it is on the hot path.
#2008 made
describe_dataaccept any narwhals frame, but it converts on entry atai/utils.py:784and the ~200 lines below it are pandas. The conversion was deliberately put in one place during that review so it could be lifted later, which is what this is.Two smaller helpers in the same category still take pandas only:
format_exploration_result(ai/agents/sql.py:128), fed byBaseSQLSource.executewhich is contracted to return pandassanitize_column_names(ai/utils.py:1769), used by the DeckGL agentMoving these onto narwhals would let a polars or pyarrow source reach the LLM context without a copy.
describe_datais the one worth doing first since it is on the hot path.