# Simple QA using Open Source Large Language Models

### Step 1: Define your prompt

Every Large Language Model requires a well-crafted prompt template to guide its actions effectively. For the creation of a Q\&A chatbot, a Prompt Template is essential to provide clear instructions to the Large Language Model on its tasks. This component is invaluable as it ensures that the model understands the desired task and generates accurate responses based on the provided instructions.

Click on Prompt Template, and edit the template with your prompt:

Know more about Prompts: <https://docs.aiplanet.com/components/prompts>

### Step 2: Define your LLM - Open Source LLM

To enhance the intelligence of the responses, we require a Large Language Model capable of understanding instructions and generating corresponding responses. In this context, we utilize an Open Source Large Language Model due to its accessibility and cost-effectiveness. By leveraging the HuggingFace Hub Large Language Models, users can input their Access token and model name.&#x20;

Notably, this approach offers the advantage of accessing 7B Large Language Models without the need for manual loading.

<figure><img src="https://lh7-us.googleusercontent.com/tscTBkfgMBEUkqFXBVwO0hWBWsdjR5-hYC8vH5WJ1st0uP6cIPwKG1P5AnVymIo6sr5yDVhvP3kf5cGamD1jILJx4BkyDGzpVNi4jnanVEsxVTuMZYUg3XiJXzCVkbow_cebEJ3knNTXcyEcQ5FTbIQ" alt=""><figcaption></figcaption></figure>

Know more about LLM: <https://docs.aiplanet.com/components/large-language-models>

### Step 3: Build Chain

To link the prompt with the Large Language Model (LLM), we use a tool called LLMChain. Just connect your Prompt Template and LLM directly to the LLM Chain, and you can optionally include a memory component if needed. The LLM Chain helps the LLM learn from your prompt, making it better at giving sensible responses.

<figure><img src="https://lh7-us.googleusercontent.com/FqyRZQTufbUniwP7yhkSWtYn8bsaYI_h5F_8kJA5wYdh95_JieiTx3Y4sCC6ES000Qn7QqU-fSKlVsX-xiruiKjyAb8jtLueaIVKIGPnLapaAuFJEMPdl3AdNQw-dia4XopDRQowAVI6DNcLIet7Ao8" alt=""><figcaption><p>flow</p></figcaption></figure>

Know more about Chains: <https://docs.aiplanet.com/components/chains>

Once the chain is complete click on the build icon in the bottom right corner of the page.

<figure><img src="/files/pfb3w6eBWVuFdOWzUYPX" alt=""><figcaption><p>icons</p></figcaption></figure>

### Step 4: Testing

Once the build is complete you can click on the chat icon to test the flow.

<figure><img src="https://lh7-us.googleusercontent.com/IO563zCCNS_8iIkCZYVPVhAv_kr_1Gd7BWHxVAeBctuDBxUg5UJ3yzAFTxzO2GNppij-vd41ZbVjzL38xSGz5mBQroAaOBteZTkBLWMDKMeodkLVL0jhysAv1D51qo3YaisSnw8gc45mxxXptc_jC88" alt=""><figcaption><p>chat interface</p></figcaption></figure>

If you're able to get the response then the flow is running successfully & now you can deploy the flow to share it with others.

Check out how to use Chat Interface: <https://docs.aiplanet.com/quickstart/chat-interface-genai-stack-chat>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aiplanet.com/genai-stack-1/usecases/simple-qa-using-open-source-large-language-models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
