Find answers from the community

Updated 3 months ago

Memory

hello if there any memory chat function on subquestion query?
L
d
7 comments
You can create a chat engine or agent for this πŸ‘
hi @Logan M, so there are no option for using previous memory to answer new query on subquestion query? One more question, can I make a instruction or dictionary about csv coloumn context using pandasquery? so the pandas script dont get a wrong coloumn #❓py-issues-and-help
i use instruction_str option on pandas query but the output not send to subquestion output. it just outputing the instruction, here the output:

Generated 1 sub questions.
[Forecast Data pax on CGK] Q: What is the forecasted passenger data for today at CGK Airport
Pandas Instructions:
Plain Text
import pandas as pd
from datetime import datetime, timedelta

# Convert the 'DATE' column to datetime format
df['DATE'] = pd.to_datetime(df['DATE'])

# Get today's date
today = datetime.now().date()

# Filter the dataframe for today's date and CGK Airport
filtered_df = df[(df['DATE'].dt.date == today) & (df['AIRPORT'] == 'CGK')]

# Filter the dataframe for forecasted data
forecasted_df = filtered_df[filtered_df['forecast_or_real'] == 'FORECAST']

# Get the forecasted passenger data
forecasted_passenger_data = forecasted_df['passanger'].sum()

# Print the forecasted passenger data
print(forecasted_passenger_data)

print(forecasted_passenger_data)
149588.0
Pandas Output: None
[Forecast Data pax on CGK] A: None
please help me @Logan M
Yea you create the sub question query engine, and then use the query engine to initialize a chat engine or agent. This will use the chat history like you described πŸ™‚
Hmm, your instruction was this entire code block? Maybe take a look at the default instruction string, and modify it from there
https://github.com/jerryjliu/llama_index/blob/8ba9b69f311f911fa78b001cc5645caa7e8601e6/llama_index/query_engine/pandas_query_engine.py#L28
Thankyouu it works πŸ‘
Add a reply
Sign up and join the conversation on Discord