How do I terminate the processing and respond with custom response if there are no matching nodes in vector db. Currently it still makes call to LLM and gets some out of context response. Are there any hooks / node post processor I can inject ?
Hmmm. You'd have to separate out the retrieval and synthesis steps.
See here. Instead of constructing the query engine object, you can run the retriever, pass the nodes to a node postprocessor (if any), and then pass to a response synthesizer