https://discord.gg/botpress logo
#🤝help
Need More Info About How to Guide the AI Task to Quality Answers
# 🤝help
r

rich-oxygen-43707

07/03/2023, 7:54 PM
I need to know better how to guide the AI task. I have a flow where a KnowledgeAgent answer returns an address that comes from a KB. The whole subject is a trip that is being planned. (1) When asked about closest airport, the logic branches to an AI fallback (answer is not in KB) and GPT answers correctly. (It knows where the house is.) But when asked how far the airport is from the house, GPT seems to not know. (2) When asked "what is there to do nearby" GPT answers with several reasonable suggestions including local restaurants in town. But when I then ask "list three restaurants near the house" answer is "I'm not sure." The AI Task Input is Knowledgebase: (I wasn't sure how to link to it so for now it is blank but it may not be needed anyway) Chat history: {{JSON.stringify(workflow.chatHistory)}} User question: {{event.preview}} Is that the correct way to pass conversation history to GPT? I just don't know what is being done behind the scenes in botpress for an AI Task. What else can I do to improve this?
Hope it is ok to bump...
a

acceptable-kangaroo-64719

07/05/2023, 10:52 AM
Hey @rich-oxygen-43707, thanks for the bump. We've got a whole section about this in our documentaton here https://botpress.com/docs/cloud/generative-ai/best-practices/
r

rich-oxygen-43707

07/05/2023, 11:07 AM
Thanks @acceptable-kangaroo-64719. I found that after posting my question here but I'm still unclear on some things. For example, the doc suggests to use an Execute code to append everything for context but doesn't show code for how to do that. I had gotten " {{JSON.stringify(workflow.chatHistory)}}" from one of the vids or from a post here, don't remember where. I was assuming that workflow.chatHistory would contain the history. Does it, or do I need to write code to append history to that variable?
I took a shot at generating the code but this gets an error.
a

acceptable-kangaroo-64719

07/05/2023, 5:57 PM
Since that video was released, the Summary Agent keeps a better running transctipt. You can access it in
conversation.SummaryAgent.transcript
I think
7 Views