It’s easy to create a knowledge base from documents stored in Digital Ocean Spaces and then to create an Agent with access to the knowledge base. The Agent can cite file names it relies on to provide answers.
What would be the best way to build a front end for the Agent that can hyperlink back to the original file sources in the Spaces Bucket?
This should be easy enough to accomplish many different ways except for the fact that my knowledge base contains duplicate file names spread across multiple sources.
The data is PDFs stored in a single bucket in multiple folders such as /2010, /2011, /2012 and some of the filenames are duplicated across folders (different versions of the same file).
What I want to do is have a web front end for my agent where any time the agent mentions a specific file, the filename will be hyperlinked to the file the agent used to generate the answer.
Related question here: https://www.digitalocean.com/community/questions/how-to-make-an-agent-aware-of-multiple-knowledge-base-sources
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey @setec 👋
EDIT: if you pass
include_retrieval_info=True
in the API call, the response does include full paths like[bucket]/[directory]/[filename]
, which makes it much easier to generate accurate links to the original sources. Thanks @setec for digging into this!I believe that you’re right, the agent can reference filenames, but since you have duplicates across multiple folders, hyperlinking directly to the correct file is tricky unless the agent knows the full path.
As far as I can see right now, the GenAI platform doesn’t expose folder-level paths in citations, it only shows filenames. So if you want to build a front end that links back to exact files, you’ll need to work around this by embedding the full path or a unique identifier into the document content itself (for example, at the top of each PDF: “Source: /2012/report.pdf”). This way, when the agent generates its response, it includes that full path, which your frontend can then turn into a hyperlink to the file in your Space.
It’s a great use case, and I’d recommend dropping this idea on the DigitalOcean Ideas Board and also pinging support to flag the need for more structured citation data (like full object paths).
- Bobby
This comment has been deleted