init

init(
    data_source,
    table_name,
    greeting=None,
    data_description=None,
    extra_instructions=None,
    create_chat_callback=None,
    system_prompt_override=None,
)

Initialize querychat with any compliant data source.

Parameters

Name Type Description Default
data_source IntoFrame | sqlalchemy.Engine Either a Narwhals-compatible data frame (e.g., Polars or Pandas) or a SQLAlchemy engine containing the table to query against. required
table_name str If a data_source is a data frame, a name to use to refer to the table in SQL queries (usually the variable name of the data frame, but it doesn’t have to be). If a data_source is a SQLAlchemy engine, the table_name is the name of the table in the database to query against. required
greeting str A string in Markdown format, containing the initial message None
data_description str Description of the data in plain text or Markdown None
extra_instructions str Additional instructions for the chat model None
create_chat_callback CreateChatCallback A function that creates a chat object None
system_prompt_override str A custom system prompt to use instead of the default None

Returns

Name Type Description
QueryChatConfig A QueryChatConfig object that can be passed to server()