References when building chatbot with documents
# 🤝help
b
Is there a way to turn the bot's knowledge base response into a variable so I can export it to a table?
n
It already is a variable: {{turn.KnowledgeAgent.response}}
It may not be exactly correct but its something along the lines of that
b
Thanks for coming back to me - any chacne you could help with how I could input that in this piece of code?

https://cdn.discordapp.com/attachments/1148074625880834129/1148082254111842374/image.png

Here is the original workflow.zapierSuccess = false const leadData = { question: workflow.UserQuestion, feedback: workflow.UserFeedback, } try { const response = await axios.post('https://hooks.zapier.com/hooks/catch/16408718/35p1j6g/', leadData) console.log(response.data) workflow.zapierSuccess = true } catch (error) { console.error(error) }
The issue is that I need to use the UserQuestion, UserFeedback, knowledgeResponse: turn.KnowledgeAgent.answer, knowledgeLocation: turn.KnowledgeAgent.citations, seperately. The user feedback comes after the other three. Is there a way to save the following as a variable for later use? knowledgeResponse: turn.KnowledgeAgent.answer, knowledgeLocation: turn.KnowledgeAgent.citations
n
the variable that youre looking for is simply turn.KnowledgeAgent.answer?
Not sure why you would need tk do it, but to answer your question yes you can. const variableName = { knowledgeResponse: turn.KnowledgeAgent.answer, knowledgeLocation: turn.KnowledgeAgent.citations }
Or if you want to access it in a later node you can just say workflow.variableName = { knowledgeResponse: turn.KnowledgeAgent.answer, knowledgeLocation: turn.KnowledgeAgent.citations } And access it via workflow.variableName.knowledgeResponse Or workflow.variableName.knowledgeLocation
hope that helps
3 Views