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

# Knowledge Retrieval

> RAG-powered document search with vector embeddings and semantic search.

Knowledge Retrieval enables Retrieval-Augmented Generation (RAG) over your documents. Search using semantic understanding, not just keywords.

## Key Features

* **Vector Embeddings** - Semantic search over document content
* **RAG Integration** - Automatically augment prompts with relevant context
* **Multiple Sources** - Upload documents, web pages, structured data
* **Reranking** - LLM-based result ranking for quality
* **Citation Tracking** - Know which documents contributed to answers

## How to Enable

### For Agents

1. **Agents** > Select Agent > **Settings** > **Capabilities**
2. Attach **Knowledge Retrieval**
3. Link to a **Knowledge Base** you've created

### For MCP Gateways

1. **Gateways** > Select Gateway > **Capabilities**
2. Attach **Knowledge Retrieval**
3. Link to a **Knowledge Base**

## Creating a Knowledge Base

<Steps>
  <Step title="Create Knowledge Base">
    1. Go to **Knowledge** > **Create Knowledge Base**
    2. Enter name and description
    3. Click **Create**
  </Step>

  <Step title="Upload Documents">
    1. Open your knowledge base
    2. Click **Upload Documents**
    3. Choose files (PDF, DOCX, TXT, MD, JSON)
    4. Documents are processed automatically
  </Step>

  <Step title="Configure Search">
    1. Click **Settings**
    2. Choose embedding model
    3. Set reranking preferences
    4. Save configuration
  </Step>

  <Step title="Test Search">
    1. Click **Test Search**
    2. Try semantic queries
    3. Verify results quality
  </Step>
</Steps>

## How It Works

1. **Document Upload** - Documents processed into chunks with metadata
2. **Embeddings** - Each chunk converted to vector representation
3. **Storage** - Vectors stored in the vector database
4. **Query** - User query converted to vector
5. **Search** - Top matching documents retrieved via cosine similarity
6. **Reranking** (optional) - LLM reranks results for relevance
7. **Augmentation** - Top results injected into agent prompt

## Usage Examples

### Simple Search

Agent prompt:

```
"What are the main features of our product?"
```

Knowledge base automatically searched and top results injected into context.

### Complex Question

```
"How do I troubleshoot authentication errors in the API?"
```

Semantic search finds relevant troubleshooting guides, not keyword matches.

### Document Analysis

```
"Summarize key findings from our Q4 financial report"
```

Knowledge base finds Q4 report, summary extracted and provided.

## Configuration

### Search Settings

```json theme={null}
{
  "knowledge_retrieval": {
    "embedding_model": "text-embedding-3-small",
    "top_k": 5,
    "similarity_threshold": 0.7,
    "enable_reranking": true
  }
}
```

| Setting                | Default                | Effect                   |
| ---------------------- | ---------------------- | ------------------------ |
| `embedding_model`      | text-embedding-3-small | Model for embeddings     |
| `top_k`                | 5                      | Number of results        |
| `similarity_threshold` | 0.7                    | Minimum relevance score  |
| `enable_reranking`     | true                   | LLM reranking of results |

## Document Types Supported

| Format   | Support | Best For           |
| -------- | ------- | ------------------ |
| PDF      | ✓       | Documents, reports |
| DOCX     | ✓       | Word documents     |
| TXT      | ✓       | Text files         |
| Markdown | ✓       | Documentation      |
| JSON     | ✓       | Structured data    |
| XLSX     | ✓       | Spreadsheets       |
| HTML     | ✓       | Web pages          |

## Embedding Models

Choose the embedding model based on your needs:

| Model                  | Dimensions | Best For        |
| ---------------------- | ---------- | --------------- |
| text-embedding-3-small | 1536       | General use     |
| text-embedding-3-large | 3072       | Nuanced search  |
| custom                 | Variable   | Domain-specific |

## Search Examples

### Keyword vs Semantic

**Keyword search:**

```
"password reset"
→ Finds documents containing exact words
```

**Semantic search:**

```
"How do I change my login credentials?"
→ Finds documents about password changes, auth, account settings
```

### Multi-document

If knowledge base has multiple documents, search returns top matches across all:

```json theme={null}
{
  "results": [
    {
      "document": "User Guide.pdf",
      "chunk": "Page 42",
      "content": "...",
      "score": 0.95
    },
    {
      "document": "FAQ.md",
      "chunk": "Section 3",
      "content": "...",
      "score": 0.87
    }
  ]
}
```

## Reranking

Optional LLM-based reranking improves result quality:

* Retrieves top 20 results
* LLM evaluates each for relevance
* Reorders by actual relevance
* More accurate but slower

Enable in gateway specifications:

```json theme={null}
{
  "knowledge_retrieval": {
    "enable_reranking": true
  }
}
```

## Cost

For current pricing details, see [Pricing](https://noorle.com/pricing/).

Monitor in **Account** > **Usage** dashboard.

## Rate Limits

* **1000 searches per hour** per knowledge base
* **500 document uploads per day** per account
* **1M total embeddings** per account

## Best Practices

### Document Preparation

* Clean PDFs work better than scanned images
* Use clear document structure
* Include metadata and dates
* Break large documents into sections

### Search Queries

* Be specific and descriptive
* Use natural language
* Ask complete questions
* Avoid single-word searches

### Knowledge Base Organization

* Group related documents
* Use consistent naming
* Update documents regularly
* Remove outdated content

## Common Use Cases

### Product Documentation

Upload product manual, FAQ, API docs for instant search.

```
"How do I reset my password?"
→ Returns relevant FAQ section
```

### Internal Knowledge

Store company policies, procedures, guidelines.

```
"What's our refund policy?"
→ Returns policy document
```

### Research

Upload research papers, articles for analysis.

```
"What are recent findings on AI safety?"
→ Returns relevant paper sections
```

## Troubleshooting

### Poor Search Results

* Verify documents uploaded correctly
* Try more specific queries
* Enable reranking for better results
* Check similarity threshold

### Slow Search

* Reduce `top_k` value
* Disable reranking for speed
* Use smaller embedding model

### Upload Failed

* Check file format is supported
* Verify file is valid (not corrupted)
* Try smaller file size
* Check account storage limit

## Next Steps

* [Create Knowledge Base](/docs/use/knowledge/overview)
* [Upload Documents](/docs/use/knowledge/uploading-documents)
* [Vector Search](/docs/use/knowledge/vector-search)
* [Reranking](/docs/use/knowledge/reranking)
