Skip to content

Commit bbbb771

Browse files
authored
fix: remove deprecated method from documentation (#1842)
* fix: remove deprecated method from documentation * add migration guide
1 parent aca26cd commit bbbb771

File tree

5 files changed

+96
-734
lines changed

5 files changed

+96
-734
lines changed

‎docs/v3/agent.mdx‎

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,38 +34,21 @@ agent.chat('And which one has the most deals?')
3434
# Output: United States has the most deals
3535
```
3636

37-
### Clarification questions
37+
### Follow-up Questions
3838

39-
An agent will also be able to ask clarification questions if it does not have enough information to answer the query. For example:
39+
An agent can handle follow-up questions that continue the existing conversation without starting a new chat. This maintains the conversation context. For example:
4040

4141
```python
42-
agent.clarification_questions('What is the GDP of the United States?')
43-
```
44-
45-
This will return up to 3 clarification questions that the agent can ask the user to get more information to answer the query.
46-
47-
### Explanation
48-
49-
An agent will also be able to explain the answer given to the user. For example:
42+
# Start a new conversation
43+
response = agent.chat('What is the total sales?')
44+
print("First response:", response)
5045

51-
```python
52-
response = agent.chat('What is the GDP of the United States?')
53-
explanation = agent.explain()
54-
55-
print("The answer is", response)
56-
print("The explanation is", explanation)
46+
# Continue the conversation without clearing memory
47+
follow_up_response = agent.follow_up('What about last year?')
48+
print("Follow-up response:", follow_up_response)
5749
```
5850

59-
### Rephrase Question
60-
61-
Rephrase question to get accurate and comprehensive response from the model. For example:
62-
63-
```python
64-
rephrased_query = agent.rephrase_query('What is the GDP of the United States?')
65-
66-
print("The rephrased query is", rephrased_query)
67-
68-
```
51+
The `follow_up` method works just like `chat` but doesn't clear the conversation memory, allowing the agent to understand context from previous messages.
6952

7053
## Using the Agent in a Sandbox Environment
7154

@@ -124,10 +107,12 @@ sandbox = DockerSandbox(
124107
## Training the Agent with local Vector stores
125108

126109
<Note>
127-
Training agents with local vector stores requires a PandasAI Enterprise license. See [Enterprise Features](/v3/enterprise-features) for more details or [contact us](https://pandas-ai.com/) for production use.
110+
Training agents with local vector stores requires a PandasAI Enterprise
111+
license. See [Enterprise Features](/v3/enterprise-features) for more details
112+
or [contact us](https://pandas-ai.com/) for production use.
128113
</Note>
129114

130-
It is possible also to use PandasAI with a few-shot learning agent, thanks to the "train with local vector store" enterprise feature (requiring an enterprise license).
115+
It is possible also to use PandasAI with a few-shot learning agent, thanks to the "train with local vector store" enterprise feature (requiring an enterprise license).
131116

132117
If you want to train the agent with a local vector store, you can use the local `ChromaDB`, `Qdrant` or `Pinecone` vector stores. Here's how to do it:
133118
An enterprise license is required for using the vector stores locally. See [Enterprise Features](/v3/enterprise-features) for licensing information.
@@ -174,4 +159,4 @@ agent.train(queries=[query], codes=[response])
174159
response = agent.chat("What is the total sales for the last fiscal year?")
175160
print(response)
176161
# The model will use the information provided in the training to generate a response
177-
```
162+
```

‎docs/v3/migration-backwards-compatibility.mdx‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ description: "Using v2 classes in PandasAI v3"
44
---
55

66
<Note>
7-
PandasAI v3 maintains backward compatibility for `SmartDataframe`, `SmartDatalake`, and `Agent`. However, we recommend migrating to the new `pai.DataFrame()` and `pai.chat()` methods for better performance and features.
7+
PandasAI v3 maintains backward compatibility for `SmartDataframe`,
8+
`SmartDatalake`, and `Agent`. However, we recommend migrating to the new
9+
`pai.DataFrame()` and `pai.chat()` methods for better performance and
10+
features.
811
</Note>
912

1013
## SmartDataframe
@@ -54,6 +57,7 @@ response = df.chat("What are the top countries by sales?")
5457
```
5558

5659
**Benefits of pai.DataFrame():**
60+
5761
- Better integration with semantic layer
5862
- Improved context management
5963
- Enhanced performance
@@ -114,6 +118,7 @@ response = pai.chat("Who gets paid the most?", employees, salaries)
114118
```
115119

116120
**Benefits of pai.chat():**
121+
117122
- No need to instantiate `SmartDatalake`
118123
- Cleaner, more intuitive API
119124
- Better performance
@@ -122,7 +127,7 @@ response = pai.chat("Who gets paid the most?", employees, salaries)
122127

123128
## Agent
124129

125-
The `Agent` class works the same way in v3 as it did in v2. The only requirement is to configure the LLM globally.
130+
The `Agent` class works mostly the same way in v3 as it did in v2, but some methods have been removed. The main requirement is to configure the LLM globally.
126131

127132
```python
128133
from pandasai import Agent
@@ -143,4 +148,24 @@ response = agent.chat("Analyze the data and provide insights")
143148

144149
**Key Change:** Configure LLM globally with `pai.config.set()` instead of passing it per-agent.
145150

146-
For detailed information about Agent usage, see the [Agent documentation](/v3/agent). For information about using Skills with Agent, see the [Skills documentation](/v3/skills).
151+
### New Agent Methods in v3
152+
153+
PandasAI v3 introduces new Agent methods that enhance conversational capabilities:
154+
155+
- **`follow_up(query)`**: Continue conversations without clearing memory (maintains context)
156+
157+
```python
158+
agent = Agent([df1, df2])
159+
160+
# Start conversation
161+
response = agent.chat('What is the total revenue?')
162+
163+
# Follow up without losing context
164+
follow_up = agent.follow_up('What about last quarter?')
165+
```
166+
167+
**Note:** The `clarification_questions()`, `explain()` and `rephrase_query()` methods have been removed in v3.
168+
169+
These methods provide enhanced conversational capabilities not available in v2.
170+
171+
For detailed information about Agent usage, see the [Agent documentation](/v3/agent). For information about using Skills with Agent, see the [Skills documentation](/v3/skills).

‎docs/v3/migration-guide.mdx‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,41 @@ agent = Agent([df])
197197

198198
**More details:** See [Skills](/v3/skills) for detailed usage and examples.
199199

200+
### Agent
201+
202+
Agent class works mostly the same, but some methods have been removed in v3.
203+
204+
**Removed methods:** `clarification_questions()`, `rephrase_query()`, `explain()`
205+
206+
**v2:**
207+
208+
```python
209+
from pandasai import Agent
210+
211+
agent = Agent(df)
212+
clarifications = agent.clarification_questions('What is the GDP?')
213+
rephrased = agent.rephrase_query('What is the GDP?')
214+
explanation = agent.explain()
215+
```
216+
217+
**v3:**
218+
219+
```python
220+
from pandasai import Agent
221+
222+
agent = Agent(df)
223+
# ❌ These methods are removed in v3
224+
# Use chat() and follow_up() instead
225+
response = agent.chat('What is the GDP?')
226+
follow_up = agent.follow_up('What about last year?') # New: maintains context
227+
```
228+
229+
**Key Changes:**
230+
231+
- `clarification_questions()`, `rephrase_query()`, and `explain()` have been removed
232+
- New `follow_up()` method maintains conversation context
233+
- Global LLM configuration required
234+
200235
### Training
201236

202237
<Note title="Enterprise Feature">

‎docs/v3/migration-troubleshooting.mdx‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ description: "Common issues and solutions when migrating from v2 to v3"
44
---
55

66
<Note>
7-
This guide covers common issues encountered during migration. For breaking changes and migration steps, see the [Migration Guide](/v3/migration-guide).
7+
This guide covers common issues encountered during migration. For breaking
8+
changes and migration steps, see the [Migration Guide](/v3/migration-guide).
89
</Note>
910

1011
## Common Issues and Solutions
@@ -55,6 +56,23 @@ pai.config.set(config)
5556
df = pai.DataFrame(data)
5657
```
5758

59+
### Issue: Agent Methods Not Found
60+
61+
**Problem**: `AttributeError: 'Agent' object has no attribute 'clarification_questions'` (or `rephrase_query`, `explain`)
62+
63+
**Solution**: These methods have been removed in v3. Use alternatives:
64+
65+
```python
66+
# v2 - These methods are removed
67+
agent.clarification_questions('What is the GDP?')
68+
agent.rephrase_query('What is the GDP?')
69+
agent.explain()
70+
71+
# v3 - Use these instead
72+
response = agent.chat('What is the GDP?')
73+
follow_up = agent.follow_up('What about last year?') # Maintains context
74+
```
75+
5876
## Get Support
5977

6078
### Community Support

0 commit comments

Comments
 (0)