Skip to content

[BUG] Incorrect memory_size for SmartDataFrame #1789

@jamie0725

Description

@jamie0725

System Info

pandasai 2.3.0

🐛 Describe the bug

Hi! I've discovered a bug in pandasai v2 where there's a discrepancy between the documented behavior and actual implementation.

According to the documentation, SmartDataFrame should have a memory_size of 1 by default (designed for single-round conversations). However, the current implementation sets memory_size to 10 by default in the Agent class constructor.

class SmartDataframe:
    def __init__(
        self,
        df: Union[DataFrameType, BaseConnector],
        name: str = None,
        description: str = None,
        custom_head: pd.DataFrame = None,
        config: Config = None,
    ):
        # ... other code ...
        self._agent = Agent([df], config=config)  # No memory_size override

class Agent(BaseAgent):
    def __init__(
        self,
        # ... other params ...
        memory_size: Optional[int] = 10,  # Should be 1 for SmartDataFrame
        # ... other params ...
    ):

This inconsistency affects users who expect SmartDataFrame to handle single-round conversations as documented, but instead get multi-round conversation behavior due to the higher memory size.

Questions:

Is there a current workaround to explicitly set memory_size=1 when using SmartDataFrame?
Is there a fix planned for an upcoming release?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions