Skip to content
Discussion options

You must be logged in to vote

The limit in SemanticLayerSchema controls query results, not what goes in the prompt. For prompt row limiting, you need to configure the agent directly.

Solution 1: Sample before passing to agent

import pandas as pd
from pandasai import Agent

df = pd.read_csv("large_data.csv")

# Sample for the prompt (full data still accessible for execution)
agent = Agent(
    dfs=[df.head(100)],  # Only 100 rows in prompt
    config={"verbose": True}
)

Solution 2: Use config max_rows

agent = Agent(
    dfs=[df],
    config={
        "max_rows_to_show": 50,  # Limits rows shown in prompt
    }
)

Solution 3: Custom description instead of rows

from pandasai import SmartDataframe

sdf = SmartDataframe(
    

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@oreiiikin
Comment options

Answer selected by oreiiikin
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants