Skip to content

Missing doc ID raises an exception in Llm::CompletionWorker

Problem

Looking at https://log.gprd.gitlab.net/app/r/s/YwGpA, it looks like the following error occurs in Llm::CompletionWorker:

undefined method `captures' for nil:NilClass ids = source_ids.match(CONTENT_ID_REGEX).captures.map(&:to_i) ^^^^^^^^^

One of the possibilities of this error is that the Anthropic failed to answer the user's question with the prompt with embedded documents. Therefore, CNT-IDX- is missing in the response and raised the exception above.

Proposal

If the CNT-IDX- is not found on the response, do not raise the exception.