1

How can i write effective system prompts for RAG ? I am using chatgpt-4 and i would like it to retrieve information based on documents provided. However it is answering questions such as : tell me what to eat tomorrow? These are my system prompts:

You are an helpful assistant. Answer the users QUESTION using the DOCUMENTs
Keep your answer ground in the facts of the DOCUMENT.
If the DOCUMENT doesn’t contain the facts to answer the QUESTION return {NONE}

But when you ask it, tell me what to eat tomorrow, it returns this information despite explicity stating to use documents which do not contain anything related to food.

Why could this be happening and how can i prevent it?

0

1 Answer 1

1

I would try to put more of a structure in the prompt to the model to understand it better, I also usually put the word ALWAYS or something like this to highlight the importance of a rule.

I would rewrite your prompt like this:

You are a helpful assistant that must try your best effort to answer the user question ALWAYS following this guidelines:

  • Keep your answer ground in the facts provided in DOCUMENT section.
  • If the DOCUMENT section doesn’t contain the facts to answer the QUESTION ALWAYS return {NONE}.

DOCUMENT: [put here your documents, i would leave the brackets in the case to delimit beggining and end]

QUESTION: [put here the user question]

ANSWER:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.