Access to metadata from vector store tool

The idea is:

I think we need to be able to access the metadata from the vector store tool. It is very limiting that we cannot do this at the moment.

My use case:

To provide the references for the documents retrieved from the vector store.

I think it would be beneficial to add this because:

Basic functionality, important for compliance with attribution standards.

Any resources to support this?

n/a

Are you willing to work on this?

I probably dont have the skills, but happy to assist in whatever way I can.

I’d support that as well. I currently have workflows using a second tool-node for fetching the metadata from the vector-storage but it feels crippled and massively slows down the workflow (which is the biggest drawback)

being able to access (and use) metadata coming from the vector-storage would be a huge plus, especially since the data is already there when looking at the outputs:
Bildschirmfoto 2025-01-16 um 10.48.13

2 Likes

Hey nabossha!

I saw your post about using the workflowGetMetadata . I’m dealing with the same issue and would love to know how you set it up. Any chance you could share how you got it working?

sure, I use a code-node after the Agent-Node which looks for available metadata in the Agents intermediate steps. if is is available I parse in the metadata needed for example to create a Link to the source documents.
As already mentioned, this approach is just a nasty workaround since it involves using an Agent-Tool to call for the metadata which consumes additional time and tokens.
here’s the JavaScript I coded with Claude to achieve this:

// First check if we can access the last input
const lastInput = $input.last();
if (!lastInput?.json?.intermediateSteps) {
    return {
        json: {
            output: $input.last().json.output
        }
    };
}

// Check if intermediateSteps is an array and has elements
const intermediateSteps = lastInput.json.intermediateSteps;
if (!Array.isArray(intermediateSteps) || intermediateSteps.length === 0) {
    return {
        json: {
            output: $input.last().json.output
        }
    };
}

// Now safely get the observation from the last step
const observation = intermediateSteps[intermediateSteps.length - 1]?.observation;
let sourceLink = '';

if (observation) {
    try {
        const parsedData = JSON.parse(observation);
        if (parsedData?.document?.metadata?.file_url) {
            sourceLink = `[Quelle](https://www.yourdomai.com${parsedData.document.metadata.file_url})`;
        }
    } catch (error) {
        // If parsing fails, keep sourceLink empty
    }
}

return {
    json: {
        output: $input.last().json.output,
        source: sourceLink
    }
};

If we would have a possibility to access metadata directly in the Agent-Node and use it in instructions, this would really be a game-changer.

1 Like