How do I enforce that an LLM only cites chunk IDs from the retrieved set, when the IDs come back as free text?
I'm building a RAG app with LangChain. Retrieval returns a list of chunks, each with an ID such as doc_3. The model answers with citations like [doc_3], but sometimes it cites an ID that was never retrieved. I already check every cited ID against the retrieved list in code and reject unknown IDs. That catches invented IDs, but it does not catch a real ID attached to a claim the chunk does not support, and it fails when the model paraphrases instead of quoting. What is the robust way to close those two gaps in code? Specifically: (1) constrain the model's citation output to an enum of the retri
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.