# Generated Knowledge

> Explore the technique of generated knowledge in AI prompting to enhance accuracy in answering questions.

[Generated Knowledge](https://learnprompting.org/docs/intermediate/generated_knowledge) is a prompting technique where one first asks the LLM a question to generate facts, then uses the generated answer to answer a question correctly.

* *knownledge generation*, the LLM is asked to generate a set of facts about the question.
* *knownledge integration*, the LLM is asked a question augmented by the knowledge generated

This technique can be acheived by using [runPrompt](/genaiscript/reference/scripts/inline-prompts) to execute an LLM request and use it in the final prompt.

## Example

[Section titled “Example”](#example)

This example demanstrates this technique to generate a blog post.

```js
script({
    title: "blog using generated knowledge",
    model: "small",
    group: "mcp",
    description:
        "Using Generated Knowledge technique. More at https://learnprompting.org/docs/intermediate/generated_knowledge",
    tests: {
        files: "src/rag/markdown.md",
        keywords: ["markdown"],
    },
})


// first prompt LLM to generate facts
const { text } = await runPrompt((_) => {
    _.def("FILE", env.files)
    _.$`Generate 5 facts about the content of FILE.`
})


// then use the facts to generate a blog
def("FACTS", text)
$`Use the above facts to write a one paragraph blog post`
```