> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pawa-ai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge Base

> Pawa AI Knowledge Base capability offers a managed, scalable vectors document store with semantic indexing and retrieval. Upload files, search by meaning, and power your innovative RAG in minutes.

Pawa Knowledge Base is a managed content store that automatically indexes your documents for semantic search and retrieval-augmented generation (RAG). Upload files (PDF, DOCX, images, HTML, PPTX, XLSX, text) and query them with natural language in English or Swahili.

You can create and update your knowledge base at any time. Explore the full list of endpoint workflows in the [API reference](/api-reference/endpoint/storage/introduction).

Unlock the value of your documents by transforming them into **searchable, AI-ready knowledge**, enabling you to build grounded assistants that cite your own content.

You can knowledge base in :

* **Your agents chat request**.
* **Your RAG pipelines**.

> **Knowledge Base Example Using Pawa AI**

<img src="https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Document%20understanding-1.png?fit=max&auto=format&n=h3QvoufTX15l3Mnz&q=85&s=ebac84973a6bec733595bba9ca4b88db" alt="Document Parsing Example" className="w-full" width="1932" height="1216" data-path="images/Document understanding-1.png" />

## Use Cases of Knowledge Base

<div className="grid grid-cols-1 md:grid-cols-2 gap-4 my-6">
  <div className="rounded-xl border border-neutral-800 bg-neutral-900 p-4">
    <div className="text-lg">📚 <strong>Company Knowledge</strong></div>
    <p className="text-neutral-300 text-sm mt-1">Centralize policies, HR docs, and manuals for employees to query in natural language.</p>
  </div>

  <div className="rounded-xl border border-neutral-800 bg-neutral-900 p-4">
    <div className="text-lg">⚖️ <strong>Legal Document Search</strong></div>
    <p className="text-neutral-300 text-sm mt-1">Retrieve clauses, dates, and rules from contracts and compliance files instantly.</p>
  </div>

  <div className="rounded-xl border border-neutral-800 bg-neutral-900 p-4">
    <div className="text-lg">🏥 <strong>Healthcare Records</strong></div>
    <p className="text-neutral-300 text-sm mt-1">Index medical reports and prescriptions for secure semantic search in digital health systems.</p>
  </div>

  <div className="rounded-xl border border-neutral-800 bg-neutral-900 p-4">
    <div className="text-lg">📊 <strong>Research & Reports</strong></div>
    <p className="text-neutral-300 text-sm mt-1">Store and retrieve insights from research papers, presentations, and business reports.</p>
  </div>
</div>

### Supported Formats

Pawa AI can help build a knowledge base with a wide range of formats, including:

* **PDFs**
* **DOCX**
* **Excel (XLSX)**
* **PowerPoint (PPTX)**
* **Images (PNG)**
* **Audio files**
* **Web links / HTML**

***

## Pawa AI Knowledge Base Workflow

1. **Create a knowledge base container, with reference files**
2. **Query with natural language using semantic retrieval** to retrieve top-K passages
3. **Feed semantic results into chat** for grounded RAG answers.
4. **Out of the box RAG request**, just pass the `knowledge_base_id` as parameter.

***

### Create a Knowledge Base, With multiple files.

```bash theme={null}
curl --request POST \
  --url https://api.pawa-ai.com/v1/store/knowledge-base \
  --header "Authorization: Bearer $PAWA_AI_API_KEY" \
  --header 'Content-Type: multipart/form-data' \
  --form 'name=Pawa Knowledge Base' \
  --form 'description=This is a sample knowledge base for Pawa.' \
  --form knowledgeBase=@example-file
```

### The Example Response

```json theme={null}
{
  "success": true,
  "message": "Knowledge base created successfully",
  "data": {
    "id": 21,
    "name": "WCF Knowledge Base",
    "kbReferenceId": "kb-5d76835d-fe3e-4793-b0d6-f2e1a668eb5d",
    "description": "This is a knowledge base for WCF, it contains information about various concerns about Workers Compesation Fund., it is used to answer questions about WCF",
    "status": "ACTIVE",
    "createdAt": "2025-08-04T16:35:37.522Z",
    "updatedAt": "2025-08-04T16:35:37.522Z"
  }
}
```

After creating the knowledge base, now you can anything with it, such as performing semantic retrieval, or sending your out-of-the-box RAG chat request.

### Semantic retrieval on Knowledge Base

```bash theme={null}
  curl --request POST \
  --url https://api.pawa-ai.com/v1/store/knowledge-base/semantic-retrieval \
  --header "Authorization: Bearer $PAWA_AI_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "knowledge_base_id": "21",
  "question_asked_by_user": "When WCF got started?"
}'
```

### Grounded answers (RAG) on Knowledge Base

```bash theme={null}
curl --request POST \
     --url https://api.pawa-ai.com/v1/chat/request \
     --header "Authorization: Bearer $PAWA_AI_API_KEY" \  
     --header 'Content-Type: application/json' \
     --data '{
      "model": "pawa-v1-blaze-20250318",
                 "messages": [
                  {
                     "role": "user",
                     "content": [
                           {
                              "type": "text",
                              "text": "What was the last years sales of the company?"
                           }
                     ]
                  }]
               "knowledgeBase": {
                  "kbReferenceId": "kb-930d251e-8a8b-4ba9-bae1-5fceb47bd654",
                  "isMust": "True"
               }}'
```

### Troubleshooting

* Low relevance: rephrase query; ensure documents are properly parsed
* Missing files: confirm `knowledge_base_id` and upload success
* Slow retrieval: reduce `top_k` or filter by metadata
