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

# Knowledge Base CLI

> CLI commands for knowledge base in PraisonAI TypeScript

The `praisonai-ts` CLI provides commands for managing knowledge bases.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    User([User]) --> CLI[CLI]
    CLI --> Svc[Knowledge Base]

    classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
    classDef tool fill:#189AB4,stroke:#7C90A0,color:#fff

    class Svc agent
    class User,CLI tool
    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff

```

## Quick Start

**1. Simple Usage**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai-ts knowledge add document.pdf
```

**2. With Configuration**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai-ts knowledge search "query" --json
```

## Add Knowledge

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Add a document
praisonai-ts knowledge add document.pdf

# Add text content
praisonai-ts knowledge add "Your text content here"

# Add from URL
praisonai-ts knowledge add https://example.com/article
```

## Search Knowledge

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Search the knowledge base
praisonai-ts knowledge search "query"

# Get JSON output
praisonai-ts knowledge search "query" --json
```

## List Knowledge

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# List all knowledge entries
praisonai-ts knowledge list
```

## SDK Usage

For programmatic knowledge management:

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { Knowledge } from 'praisonai';

const kb = new Knowledge();

// Add text content
await kb.store('Your document content...', { userId: 'me' });

// Add a file
await kb.add('document.pdf', { userId: 'me' });

// Search
const found = await kb.search('query', { userId: 'me', limit: 5 });
console.log(found.results.map(r => r.text));
```

For more details, see the [Knowledge Base SDK documentation](https://praison.ai/docs/js/knowledge-base.md).

## Related

> [card] [Knowledge Base](https://praison.ai/docs/js/knowledge-base.md)
>
> Knowledge Base overview

> [card] [RAG Agent](https://praison.ai/docs/js/rag-agent.md)
>
> RAG Agent overview


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.