# Complete Your First AI Q&A with Sample Data

Create a knowledge base from an English research paper, ask a question, and check the answer against its source. This tutorial uses *Scikit-learn: Machine Learning in Python*, a six-page paper publicly available from the Journal of Machine Learning Research (JMLR).

You do not need to understand machine learning or run the code in the paper. You will ask about one specific fact that you can verify in the original document.

## Before you begin

- Sign in to [MOI](https://moi.matrixorigin.cn/) and enter a workspace where you can import files and create knowledge bases.
- Use the language control in the top navigation to select **English**.
- Download the [sample paper from JMLR](https://jmlr.org/papers/volume12/pedregosa11a/pedregosa11a.pdf) and save it as `scikit-learn-machine-learning-in-python.pdf`.
- Import the PDF into a Catalog volume in your workspace before adding it to the knowledge base. Use **Import Tasks** under **Data Connection** for the local file import. See [Data Loading](../guides/ai-studio/data-sources/load-data.md) for configuration details. Confirm that the PDF appears in Catalog before continuing.

The screenshots use the following names. If you already imported the PDF elsewhere, use its actual Catalog location throughout.

| Resource | Name or location |
| --- | --- |
| Catalog | `the_first_tutorial` |
| Database | `pdf` |
| Volume | `scikit_learn_machine_learning_in_python` |
| File | `scikit-learn-machine-learning-in-python.pdf` |
| Knowledge base | `moi_first_knowledge` |

This tutorial uses a paper published in 2011. Its software versions and figures describe that paper, rather than the current scikit-learn release.

## 1. Create a knowledge base

1. Select **Data** in the top navigation and confirm that you are in the workspace containing the PDF.
2. Under **Resource Center** in the left navigation, select **Knowledge Base**.
3. Click **Create Knowledge Base**.
4. Enter `moi_first_knowledge` in **Knowledge Base Name**. You can leave **Remark** empty and keep **Advanced options** unchanged.
5. Click **Finish**.

```{image} ../assets/images/tutorials/moi-quickstart-knowledge-base.png
:alt: Create Knowledge Base dialog with moi_first_knowledge entered and the Finish button available
```

**Completion check:** The knowledge base has been created and is named `moi_first_knowledge`. Next, add the PDF as its data source.

## 2. Add the PDF from Catalog

1. Open `moi_first_knowledge` and click **Add Data**. If the **Select Data** window is already open, continue there.
2. In **Select Data**, browse to the Catalog, database, and volume containing your PDF. For the location used here, select:

   ```text
   the_first_tutorial / pdf / scikit_learn_machine_learning_in_python
   ```

3. Select `scikit-learn-machine-learning-in-python.pdf`. Confirm that the selection contains one file and no tables.
4. Click **Append** and wait for the file to appear on the **Data Source** tab.

```{image} ../assets/images/tutorials/moi-quickstart-catalog-source.png
:alt: Select Data window with the scikit-learn PDF selected from a Catalog volume
```

The knowledge base uses the PDF already stored in Catalog. You do not need to upload a second copy.

**Completion check:** The **Data Source** tab lists the PDF in `moi_first_knowledge`.

## 3. Wait for processing to complete

1. On the **Data Source** tab, find the PDF and check **Processing Status**.
2. Wait until its status becomes **Completed**.
3. Confirm that the knowledge base contains one unstructured file and that its Catalog path points to your sample PDF.

```{image} ../assets/images/tutorials/moi-quickstart-ready.png
:alt: The scikit-learn PDF listed as one unstructured file with Processing Status set to Completed
```

**Completion check:** The PDF shows **Completed**. If processing fails, resolve the error before starting the conversation.

## 4. Ask a question about the paper

1. Return to the **Knowledge Base** list.
2. On the `moi_first_knowledge` card, click **Chat**.

```{image} ../assets/images/tutorials/moi-quickstart-chat-entry.png
:alt: Knowledge Base list showing the moi_first_knowledge card and its Chat button
```

3. On the **Dialogue** tab, start a **New Session** if needed.
4. Confirm that `moi_first_knowledge` appears in the conversation's knowledge selection. If it is missing, use **Select Knowledge** to select it.
5. Use an available chat model in your workspace. The model name may differ from the screenshots.
6. Paste the following question and press **Enter**:

   ```text
   According to Section 2 of the paper "Scikit-learn: Machine Learning in Python", what unit-test coverage was reported for release 0.8, and which two static analysis tools were used?

   Answer in English using only the knowledge base, and cite the supporting passage.
   ```

7. Wait for the answer to finish.

```{image} ../assets/images/tutorials/moi-quickstart-answer.png
:alt: English question and answer reporting 81 percent test coverage for release 0.8 and naming pyflakes and pep8
```

**Completion check:** The answer reports **81%** test coverage for release **0.8** and identifies **pyflakes** and **pep8**. The wording may vary, but these facts should match the paper.

## 5. Verify the source

A correct-looking answer is only the first check. Use the reference to compare it with the original paper.

1. Scroll to **References** below the answer.
2. Find the reference to `scikit-learn-machine-learning-in-python.pdf`. For this question, the supporting passage is on **Page 3**.

```{image} ../assets/images/tutorials/moi-quickstart-citation.png
:alt: References below the answer showing the scikit-learn PDF and Page 3
```

3. Click the PDF reference to open the source. Locate **Section 2, Project Vision**, and the paragraph beginning **Code quality**. The PDF page number is **3**; the printed page number is **2827**.
4. Check that this paragraph supports all three details: **81%**, **pyflakes**, and **pep8**.

```{image} ../assets/images/tutorials/moi-quickstart-source-preview.png
:alt: Source PDF preview on page 3 of 6 with the Code quality paragraph highlighted, showing 81 percent coverage, pyflakes, and pep8
```

**Completion check:** You can open the source from the answer and locate the passage supporting its claims. A visible reference label alone does not complete this check.

## Tutorial complete

You have created a knowledge base from an English PDF, waited for processing to complete, asked a question, and checked the answer against the original source.

You can now ask another question about the same paper and use its references to verify the answer.

## Sample source

Fabian Pedregosa et al., *Scikit-learn: Machine Learning in Python*, Journal of Machine Learning Research, 12(85):2825–2830, 2011. [Publication page](https://jmlr.org/papers/v12/pedregosa11a.html).
