Challenge of Prompt Engineering

I have a problem in making a prompt.
Prompt contains context from vector database.
Context includes several documents which have metadata.
I want prompt not to consider some doc of context based on metadata.
How to do it?

Hi Harry,

Thanks for reaching out with your prompt engineering challenge. I understand you’re trying to exclude certain documents based on their metadata. Here’s a suggestion on how you might approach this:

Firstly, it’s important to provide some worked examples after your initial prompt. This will help the AI understand the kind of responses you’re looking for. For instance, if you want the AI to ignore documents with a certain metadata tag, you could provide an example where such a document is presented but not considered in the response.

Secondly, you might want to consider using a pre-processing prompt to perform this specific task before passing the information to the main prompt. This could involve creating a prompt that filters out the documents you don’t want based on their metadata, and then passing the remaining documents to your main prompt.

I hope this helps! If you have any further questions, feel free to ask.

I may be misunderstanding your goal here. Do you want to exclude retrieved documents based on metadata? Or have the model exclude portions of a single retrieved doc based on metadata? Such as, exclude the portion of this doc about Fish, but include the rest of it?

If it’s the former, then it sounds like you should be excluding those documents from the vector retrieval json before passing it on as context to the LLM, no?

If it’s the latter, then there’s possibly a lot of different approaches to try, but I wouldn’t have good suggestions without knowing more about the particular use case.