Find answers from the community

Updated 8 months ago

Hey gang, is there a way to use metadata

Hey gang, is there a way to use metadata with Qdrant vector stores & chat engine? There's no documentation about chat engines & metadata in general.
L
F
12 comments
Do you mean metadata filtering?
the retriever engine works, but this doesn't mention the implementation with a chat engine. is it possible for chat engines to use metadata?
It works fine with a chat engine

index.as_chat_engine(filters=filters, ...)
The filters kwarg just gets passed to the retriever for the index
which is actually using it
That's the thing, I don't think the chat_engine is getting the metadata thru.
Here's the query engine:
Attachment
image.png
And here's the chat engine:
Attachment
image.png
You'll see that chat response object doesn't contain a metadata property, and that the responses are vastly different (the query engine acknowledges that the topic passed thru the filter are outside the message's context, the chat engine doesn't even acknowledge that)
The metadata property on the response object is not really related.

If you check, both have a source_nodes attribute -- this contains the nodes used to generate a response. Both should have metadata that aligns with your filters.

As for the difference in responses, its pretty important to understand the difference between a query engine and chat engine

A query engine takes the query, retrieves, and then sends the retrieved context + query to the LLM, using a prompt template that asks the LLM to use only the context and answer the question

For your chat engine, since you didn't specify a chat mode, it defaults to an agent. This agent has a single tool, which is the query engine from your index. On every user message, the agent looks at the message + chat history + tools, and decides to invoke a tool or not. Here, it invoked the query engine, the query engine ran, and then it rewrites the query engine response in context with the chat history. (Optionally, it could decide to not call a tool, and response direclty)

Agent behaviour is largely controlled by system prompts, and tool names + descriptions
you're absolutely right, i completely forgot about the chat mode!!
Add a reply
Sign up and join the conversation on Discord