Is there a way to instantiate metadata filtering as part of the hybrid search? This cookbook (
https://docs.llamaindex.ai/en/stable/examples/vector_stores/Qdrant_metadata_filter/) requires specifying the filter ahead of time before instantiating the retriever so in production you're going to keep instantiating the query engine with different filters with each query. This tutorial on the other hand allows for instantiation of richer metadata (
https://docs.llamaindex.ai/en/stable/examples/metadata_extraction/MetadataExtraction_LLMSurvey/) and I'm currently using the LLMQuestionGenerator -> SubQuestionQueryEngine strategy to try and get it to look at the metadata:
from llama_index.core.question_gen import LLMQuestionGenerator
from llama_index.core.question_gen.prompts import (
DEFAULT_SUB_QUESTION_PROMPT_TMPL,
)
question_gen = LLMQuestionGenerator.from_defaults(
llm=llm,
prompt_template_str="""
Follow the example, but instead of giving a question, always prefix the question
with: 'By first identifying and quoting the most relevant sources, '.
"""
+ DEFAULT_SUB_QUESTION_PROMPT_TMPL,
)
But I was thinking if it was possible to have a triple hybrid search - dense, sparse embedding search and metadata search?