I'm working on a chatbot that reads some PDF files through documents uploaded directly to the Generative AI part. At the beginning of the tests, it brought the citations with the links, but it stopped linking. Now it only displays the information as: "Item name [1]" but without any link.
The links normally appear in the Copilot Test.
I tested some solutions listed here, like "https://powerusers.microsoft.com/t5/Building-Copilot-Studio-Chatbots/Citations-references-not-showing-in-the-chat-in-Teams-but/ m-p/2445958#M1435" and "https://powerusers.microsoft.com/t5/Building-Copilot-Studio-Chatbots/Citations-for-SharePoint-links-not-working-for-Teams-bot-but/m-p /2504586#M1564" but I was unable to apply them successfully.
I've tried this approach. I am sending the citations as a part of a different adaptive card. Almost all citations are showing correctly but there's one reference with title : "FAQs". Copilot studio identifies it as a citation and again moves it to the dropdown and hence that one link does not show in teams.
mah I tested both codes and in both cases I get the error you can see attached: the adaptive card doesn't have a valid OutputType but it doesn't seem a thing I can adjust.
Anyway my target would be to intercept the answer generated and remove the links to the file I gave to copilot as data source (I would leave the links to the public websites and remove the others)
looks like solution is here Solved: Re: Citations / references not showing in the chat... - Page 2 - Power Platform Community (microsoft.com): "
The last thing you want to do is to update the condition to catch blank answers.
Otherwise, blank answers are not exactly outputting as a blank record, but {}.
Instead of the Topic.Answer variable, change it to the Topic.Answer.Text one:
"
@HenryJammesWell I changed the variable Answer from Local to Global and made it including complete format.
Now I've an error in formula "The 'If' function has invalid arguments." referred to if(IsBlank(Url))
I'd like to do the same on my chatbot but it seems I have another interface: are you using Copilot Studio to do that?
May you explain to me how can I change the Answer in a globalVariable??
ok solved
Hi @AnithaBM
A prerequisite to access the full answer and its citations is to save it in a "complete" format:
when I add Global.Answer as suggested in the post and try to edit the json formula. I get an error saying "invalid use of ."
Global.Answer selection
Json formula
I got something similar working by accessing the generated answer citation text.
E.g.: when both content from public website and document is retrieved:
When clicking on the citation that doesn't have a URL, I display the full source citation:
This also works over the Teams channel:
Assuming you are saving the generated answer with a complete format (in my example below, I stored it as a global variable, referenced by Global.Answer) this is the Power Fx formula I've used for the adaptive card.
{
type: "AdaptiveCard",
'$schema': "http://adaptivecards.io/schemas/adaptive-card.json",
version: "1.5",
body: [
{
type: "Container",
items: [
{
type: "TextBlock",
// Generated answer text
text: Global.Answer.Text.Content,
wrap: true
}
]
},
{
type: "Container",
items: ForAll(Global.Answer.Text.CitationSources,
// If the citation doesn't have a URL, display the source text snippet when the source is clicked
If(IsBlank(Url),
{
type: "Container",
items: [
{
type: "TextBlock",
text: "[" & Id & "] " & Name & " (click to see citation)",
wrap: true,
size: "Small",
weight: "Lighter"
},
{
type: "TextBlock",
text: Text,
wrap: true,
isVisible: false,
id: "citationText" & Id,
size: "Small",
isSubtle: true
}
],
selectAction: {
type: "Action.ToggleVisibility",
targetElements: [ "citationText" & Id ]
}
},
// If the citation has a URL, make the citation clickable and open the source URL.
{
type: "TextBlock",
text: "[" & Id &"]: [" & Name & "](" & Url & ")",
wrap: true,
size: "Small",
weight: "Lighter"
}
)
)
},
{
type: "Container",
items: [
{
type: "ColumnSet",
columns: [
{
type: "Column",
width: "90",
items: [
{
type: "TextBlock",
text: "AI-generated answer. Please rate it",
wrap: true,
size: "Small",
color: "Accent"
}
]
},
{
type: "Column",
width: "5",
items: [
{
type: "TextBlock",
text: "",
wrap: true,
size: "Small",
color: "Light"
}
],
selectAction: {
type: "Action.Submit",
data: "This generated answer wasn't useful"
}
},
{
type: "Column",
width: "5",
items: [
{
type: "TextBlock",
text: "",
wrap: true,
size: "Small",
color: "Light"
}
],
selectAction: {
type: "Action.Submit",
data: "This generated answer was useful"
}
}
]
}
]
}
]
}
Note: I don't believe the thumbs up/down buttons would work in Teams as it expects a specific format for actions (Add card actions in a bot - Teams | Microsoft Learn), so you should perhaps remove them.
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional