How to provide correct document link to AUTORAG ai search?

The aisearch() response takes the document.name as the link of actual document caused broken/invalid link reference in the response markdown, while I have provided the valid link in the content as well in the customMetadata mentioned in the docs

await env.R2.put(pathname, content, {
          customMetadata: {
            context: `Document Link: ${item.url}`,
          },
        });


But it doesn't seems that the context is provided to the AI as per the AI gateway logs.

Example logs ids -
01JYNY0QAK3R8GTQM669PC7SBF
01JYNSY6FCVZ7KF507EDAKP931


How to remove document name provided in the context, or add the correct context given in customMetadata?

https://developers.cloudflare.com/autorag/configuration/metadata/#add-context-field-to-guide-ai-search
image.png
Cloudflare Docs
Use metadata to filter documents before retrieval and provide context to guide AI responses. This page covers how to apply filters and attach optional context metadata to your files.
Metadata
Was this page helpful?