Find answers from the community

Updated 2 months ago

Sub question

Hello , currently im using sub question query, can I save the generate sub question and the answer into variable in realtime? Thank you πŸ™
L
d
V
7 comments
Hmm, you'd have to write and use a custom callback handler for this.

Our callback handler logs both event starts and event ends

On the sub question event end, We log each QA pair here https://github.com/jerryjliu/llama_index/blob/ac5141e548f4ff8ff1347d495e3e020a5cb3e3bd/llama_index/query_engine/sub_question_query_engine.py#L157
Oke thankyou @Logan M i will try it.
Oiya, how to make query understand date of "today" "tomorrow"?
It always give a wrong date. I have try make a custom prompt but not always working.
Im using subquestion query inside chat engine btw.
@Logan M #❓py-issues-and-help
I was going to say a prompt may help. What did you attempt look like?
At begininng I initate today variable using python date and then pass it to prompt string

Prompt_str ='''
Today date is {today} \
'''
Prompt_template = Prompt(Prompt_str)

And then it pass to chat agent params.
Is that correct? Or maybe there are alternative?
Try passing it in as a system prompt maybe?

chat_engine = index.as_chat_engine(system_prompt=f"Today's date is {variable_holding_todays_date}")
Hi @davong, have you made any progress in solving the issue regarding date calculations? I'm facing a similar problem. I'm utilizing customized data that includes a sequence of events along with their respective dates. Then, I put today's date into the prompt. However, my chatbot seems to struggle with accurately responding to queries like "Could you inform me about the events scheduled for next month?" or "What events are planned for September?" and similar questions. Your insights would be greatly appreciated.
Add a reply
Sign up and join the conversation on Discord