> ## 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.

# Vector Store

> Give your agents long-term knowledge with vector database integrations

Vector stores give agents the ability to store and retrieve knowledge from large document collections — enabling RAG (Retrieval Augmented Generation) where agents answer questions grounded in your data.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    subgraph "Vector Store"
        D[📄 Documents] --> E[🧠 Embed]
        E --> VS[(💾 Vector Store)]
        Q[❓ Query] --> QE[🧠 Embed]
        QE --> VS
        VS --> R[✅ Top Results]
        R --> A[🤖 Agent]
    end

    classDef input fill:#6366F1,stroke:#7C90A0,color:#fff
    classDef process fill:#F59E0B,stroke:#7C90A0,color:#fff
    classDef store fill:#189AB4,stroke:#7C90A0,color:#fff
    classDef output fill:#10B981,stroke:#7C90A0,color:#fff

    class D,Q input
    class E,QE process
    class VS store
    class R,A output
    classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
    classDef tool fill:#189AB4,stroke:#7C90A0,color:#fff
    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff
```

## Quick Start

**1. Simple Usage**

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

const agent = new Agent({
  name: 'Knowledge Assistant',
  instructions: 'Answer questions using the provided knowledge base.',
  knowledge: ['./docs/', './manuals/product.pdf']
});

const response = await agent.chat('What is our refund policy?');
console.log(response);
```

**2. With Configuration**

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

const vectorStore = createPineconeStore({
  apiKey: process.env.PINECONE_API_KEY
});

const agent = new Agent({
  name: 'Research Assistant',
  instructions: 'Search the knowledge base and answer accurately.',
  knowledge: {
    vectorStore,
    indexName: 'company-docs'
  }
});

await agent.chat('Find information about our pricing plans');
```

**3. In-Memory Store (Testing)**

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

const vectorStore = createMemoryVectorStore();

const agent = new Agent({
  instructions: 'Answer questions from the knowledge base.',
  knowledge: { vectorStore, indexName: 'test-docs' }
});
```

***

## How It Works

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
sequenceDiagram
    participant User
    participant Agent
    participant Embedder
    participant VS as Vector Store

    User->>Agent: "What is our refund policy?"
    Agent->>Embedder: Embed question
    Embedder-->>Agent: Query vector
    Agent->>VS: Search top_k=5
    VS-->>Agent: Relevant documents
    Agent->>Agent: Generate answer with context
    Agent-->>User: Grounded response
```

***

## Supported Vector Stores

| Store | Use Case |
| - | - |
| **Pinecone** | Production, large-scale |
| **Weaviate** | Hybrid search, self-hosted |
| **Qdrant** | High performance, self-hosted |
| **Chroma** | Development, local |
| **Memory** | Testing, ephemeral |

***

## Configuration Options

> [card] [Vector Store API Reference](https://praison.ai/docs/sdk/reference/typescript/modules/tools.md)
>
> TypeScript vector store configuration options

***

## Common Patterns

### Agent with Search Tool

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

const vectorStore = createPineconeStore({
  apiKey: process.env.PINECONE_API_KEY
});

const searchDocs = createTool({
  name: 'search_docs',
  description: 'Search the knowledge base for relevant information',
  parameters: {
    type: 'object',
    properties: {
      query: { type: 'string', description: 'Search query' }
    },
    required: ['query']
  },
  execute: async ({ query }) => {
    const results = await vectorStore.query({
      indexName: 'documents',
      queryText: query,
      topK: 5
    });
    return results.map(r => r.content).join('\n\n');
  }
});

const agent = new Agent({
  name: 'Research Assistant',
  instructions: 'Use the search tool to find accurate information.',
  tools: [searchDocs]
});
```

### Multi-Agent with Shared Knowledge

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

const sharedStore = createPineconeStore({
  apiKey: process.env.PINECONE_API_KEY
});

const researcher = new Agent({
  name: 'Researcher',
  instructions: 'Find relevant information from the knowledge base.',
  knowledge: { vectorStore: sharedStore, indexName: 'docs' }
});

const writer = new Agent({
  name: 'Writer',
  instructions: 'Write clear responses based on the research.',
  knowledge: { vectorStore: sharedStore, indexName: 'docs' }
});
```

### Setup Pinecone Index

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

const pinecone = createPineconeStore({
  apiKey: process.env.PINECONE_API_KEY
});

await pinecone.createIndex({
  indexName: 'agent-knowledge',
  dimension: 1536,
  metric: 'cosine'
});
```

***

## Best Practices

> [accordion] Use memory store for development
>
> `createMemoryVectorStore()` requires no external dependencies. Switch to Pinecone or Qdrant before going to production.

> [accordion] Chunk large documents
>
> Split large documents into 500–1000 token chunks before indexing. Smaller chunks retrieve more precisely.

> [accordion] Set top\_k carefully
>
> A `top_k` of 3–5 gives the agent focused context. Higher values can dilute relevance.

> [accordion] Keep embeddings consistent
>
> Use the same embedding model for indexing and querying. Mixing models produces incorrect similarity scores.

***

## Related

> [card] [Knowledge Base](https://praison.ai/docs/js/knowledge-base.md)
>
> Higher-level RAG for agents

> [card] [Embeddings](https://praison.ai/docs/js/embeddings.md)
>
> Create and manage embeddings


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