Skip to content

Elsai NLI

Package: elsai-nli  v0.1.0

Ask natural language questions directly over structured CSV data. CSVAgentHandler uses an LLM-powered agent to interpret questions, query the CSV, and return results without writing any SQL or pandas code.

Installation

bash
pip install --extra-index-url https://core-packages.elsai.ai/root/elsai-nli/ elsai-nli==0.1.0

Requirements: Python >= 3.9


CSVAgentHandler

Wraps one or more CSV files with an LLM agent that translates natural language questions into structured data operations.

python
from elsai_nli.natural_language_interface import CSVAgentHandler

agent = CSVAgentHandler(
    csv_files="path/to/sales_data.csv",
    model="your_llm_model",
    agent_type="openai-functions",
    verbose=True,
)

response = agent.ask_question("What is the total sales amount for each product?")
print(response)

Multiple CSV files:

python
agent = CSVAgentHandler(
    csv_files=["path/to/orders.csv", "path/to/customers.csv"],
    model="your_llm_model",
    agent_type="openai-functions",
    verbose=False,
)

response = agent.ask_question("How many orders did each customer place last month?")
print(response)

Constructor parameters:

ParameterTypeRequiredDescription
csv_filesstr or listYesPath to a single CSV file, or a list of paths for multi-file queries
modelstr or instanceYesLLM model identifier or instance to use for query generation
agent_typestrYesAgent backend type (e.g. "openai-functions")
verboseboolNoEnables debug output during processing. Defaults to False

Methods:

MethodDescription
ask_question(question)Converts a natural language question into operations over the CSV data and returns the result

Copyright © 2026 Elsai Foundry.