# Generate questions from a given context

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgenerate-questions-from-a-given-context%2F59132%3E%5C
**Category:** Beginners\
**Created:** [October 19, 2023, 1:38pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgenerate-questions-from-a-given-context%2F59132 "2023-10-19T13:38:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sancelot](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@sancelot](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsancelot)%5C
**Post date:** [October 19, 2023, 1:38pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgenerate-questions-from-a-given-context%2F59132%2F1 "2023-10-19T13:38:05Z")

</div>

Hi,  
I am trying to generate questions from a given context

Unfortunately I obtain hallucinating answers .

Is there a way to do it accurately using hf ecosystem ?

I obtained inaccurate answers from this program, I want it to create 4 questions related to the given content :

```auto
from llama_cpp import Llama
LLM = Llama(model_path="../../../../llama-2-7b.Q5_K_M.gguf", n_ctx=512)
context = """
Nous sommes dans les Yvelines
Il fait beau
Nous sommes a quelques km d'un joli lac
le boulanger est sympatique
Il y a également une boucherie
"""
prompt = """
You are a Teacher/ Professor. Your task is to setup
4 questions for an upcoming
quiz/examination. The questions should be diverse in nature
across the document. Restrict the questions to the
context provided.
Context is provided below :
%s
""" % context
print(prompt)
output = LLM(prompt, max_tokens=0)
print(output["choices"])
print("---------------")
print(output

```

)
