界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
数据与研究 · SKILL.md

conversational-analysis

conversational-analysis

【数据与研究】Guides PandasAI natural-language DataFrame chat, Agent workflows, LLM configuration, response objects, generated-code repair, and legacy wrapper migration.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: conversational-analysis description: "Guides PandasAI natural-language DataFrame chat, Agent workflows, LLM configuration, response objects, generated-code repair, and legacy wrapper migration." disable-model-invocation: true metadata: disco-role: operating license: NOASSERTION

Conversational Analysis

Use this sub-skill when the user wants to ask natural-language questions of tabular data through PandasAI, configure the LLM behind .chat(), inspect typed responses, debug generated code, or migrate from legacy SmartDataframe/ SmartDatalake usage.

Fast route

  1. If the user only has a pandas dataframe or a CSV/Excel file, create a PandasAI DataFrame or route dataset creation to the semantic-layer sub-skill.

  2. Configure a real LLM before .chat() unless this is an offline smoke:

    import pandasai as pai
    from pandasai_litellm.litellm import LiteLLM
    
    llm = LiteLLM(model="gpt-4.1-mini", api_key="...")
    pai.config.set({"llm": llm, "save_logs": True, "verbose": False, "max_retries": 3})
    
  3. Use df.chat(...) for a single dataframe, pai.chat(...) for multiple DataFrames in a fresh global conversation, or Agent(...).follow_up(...) for explicit multi-turn state.

  4. Inspect response.value, response.type, and response.last_code_executed before deciding that a PandasAI run succeeded.

  5. If code is untrusted or the app is public-facing, route to ../sandbox-and-security/SKILL.md.

Read next

Core choices

SituationUse
One dataframe and no need to keep a separate explicit agentdf.chat("question")
Several dataframes in one questionpai.chat("question", df1, df2, ...)
Multi-turn conversation with explicit memory and optionsagent = Agent([...], memory_size=10); agent.chat(...); agent.follow_up(...)
Need deterministic local validationFakeLLM plus bundled offline_chat_smoke.py
User asks about SmartDataframe or SmartDatalakeExplain deprecation and migrate to pai.DataFrame, pai.chat, or Agent

Boundaries

Safe validation

Run this from any environment where PandasAI is installed:

python sub-skills/conversational-analysis/scripts/offline_chat_smoke.py

The script uses FakeLLM, a tiny in-memory dataframe, and generated code that calls execute_sql_query. It should not need network, provider credentials, or large data.

Common gotchas

  • .chat() fails without a configured LLM, except when using FakeLLM or a supplied config object for tests.
  • Generated code must call execute_sql_query and assign a valid result dictionary. Free-form pandas code without the query function is rejected by the package's validator.
  • Table names in generated SQL must match the registered dataframe schema name. Hyphenated dataset paths are transformed to underscore table names.
  • Printing a chart response can open an image viewer; use .save(...) in automation.
我的收藏