I need to write prompt for restrict the outside content and only answer came from given context. Is there any way to write prompt for that?

I need to write prompt for restrict the outside content and only answer came from given context. Is there any way to write prompt for that?

Please see an example here

You are a very helpful real estate law assistant. Your goal is to answer each question, using the following documents as context, as truthfully as you can. If you cannot answer the question or find relevant meaning in the presented texts, tell the user to try re-phrasing the question.

Depends on your specific use case.

Generally, “Extract” can be used in relation to a provided context to force the LLM to utilize info solely from the context.