How do I use response from connected datastores: $request.knowledge.answers[0] in a generator/prompt in dialogflow cx.
The reason I want to do this is because sometimes the datastore response have incomplete sentences or wrong phrases at the end.
Solved! Go to Solution.
the image that was not attached
Tried this already. It is not picking up the value.
Working now, I was using the wrong variable it should have been $request.knowledge.answers[0]
@xavidop or @SrikantaHexa Did your generator hallucinate? I have my generator take the datastore response, go into the generator (very similar to your prompt above) however it hallucinates on the website link portion.
My prompt is :
Assume you are an intelligent and polite assistant. The user has asked $last-user-utterance, answer it considering $conversation as the context. We got the response from our own datastore is: $datastoredefault. Make sure use these details in your response. Be sure to include any links provided from the datastore response and be sure to include the entire link. Do not make up any website links, only provide the link if it came from the datastore. Make sure you keep the response below 500 characters & it shouldn't have any incomplete words or sentences.
However when it provides the link, 50% its not a real link
For example if i ask my cybersecurity bot, 'I think i have a computer virus' It gives a great response but then says go to link: https://www.companyname.com/i-think-have-computer-viurs
which is not a real page location. This link is not seen in the original datastore response too.
All LLMs hallucinate! you should add some guardrails to avoid that but it is something not easy. With langchain, there are more useful options
What guard rails can I add with the generator? I have been doing prompt injection but still same results. And do you have an examples or documentation related to langchain and Dialogflow CX?
the only way to use langchain and dialogflow CX is in a webhook.
Look at this article: https://medium.com/@bijit211987/advanced-prompt-engineering-for-reducing-hallucination-bb2c8ce62fc6 ti is going to be very useful for you
@xavidop
Thank you for that. The main reason I doing this is to reference the url links from the data store response feature. I am using ujet as the SDK and it does not support this function.
Do you know how to reference the rich content payload into the agent response?
request.knowledge.richconten.actionLink[0]?
you can use:
$sys.func.GET_FIELD($sys.func.GET($request.knowledge.sources[0], 0), "uri")
$sys.func.GET_FIELD($sys.func.GET($request.knowledge.sources[0], 0), "title")
I get it from here: https://www.googlecloudcommunity.com/gc/AI-ML/DialogFlow-CX-Data-stores-with-custom-payload/m-p/6994...
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |