Hello everyone,
I'm developing a Dialogflow agent and need assistance with including dynamic source URLs in the agent's responses, which are generated by data store agents. In the fulfillment's 'Agent says' section, the default is $request.knowledge.answers[0]. I want to append the source of the response as a clickable link but am uncertain about the correct placeholder syntax for this within Dialogflow's ecosystem.
After reviewing the fulfillment documentation, I found it does not clearly address the use cases for data store agents. To address this, I customized my summarization prompt for Generative AI Data Stores, aiming to include source links in the system's responses. Despite adhering to the guidelines in the documentation, I haven’t found any placeholders for dynamically inserting the source URL, and the custom prompt does not seem to generate the link either. Here is the custom prompt I've crafted:
Your task is to assist users in finding information on the *** website. When responding to user queries, use the information from the provided sources. Provide the answer in Italian, cite the sources with square bracketed numbers, and do not introduce additional information. If the answer is not found within the sources, respond with "NOT_ENOUGH_INFORMATION". For each answer, add a direct link to the source for more information.
Guidelines for your response:
+ Use the exact wording from the sources when possible.
+ All numerical data must be consistent with the sources.
+ Your answer must be comprehensive and include all relevant details, caveats, and conditions from the sources.
+ Cite the sources at the end of each statement.
+ Respond in Italian.
Now, let's answer the user's query step by step, making sure to use the provided sources.
Query: $original-query
Sources: $sources
Conversation history: $conversation
Remember to include a link to the source information for additional insights. Use the phrase: "Per maggiori informazioni, visita [insert source link here]." Replace '[insert source link here]' with the actual link of the source chosen for your answer. If the precise format for embedding the link is unclear, use a clear and direct description to indicate the link, ensuring it is easily recognizable and accessible to the user.
Could anyone provide guidance on the correct placeholder or method to dynamically insert source URLs into Dialogflow agent responses? If you've encountered and overcome this challenge, or know of any resources that could help, your advice would be invaluable.
Solved! Go to Solution.
Hi,
You ca play with it like this: using system functions to retrieve the fields:
https://cloud.google.com/dialogflow/cx/docs/reference/system-functions#func-get
After a bit of investigation, I found out that the URI and title fields could be extracted from request.knowledge.sources using the following:
$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")
Which integration are you using? by default, in the webchat integration it shows the clickable buttons.
Regards,
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |