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

# Examples

> Real-world examples and tutorials to accelerate your development

Learn by building. These examples show you how to use Memvid in production scenarios.

<CardGroup cols={2}>
  <Card title="RAG Chatbot" icon="comments" href="/examples/chatbot-memory">
    Build a chatbot with persistent conversation memory
  </Card>

  <Card title="Document Q&A" icon="file-lines" href="/examples/document-qa">
    Create a document question-answering system
  </Card>

  <Card title="Knowledge Base" icon="book" href="/examples/knowledge-base">
    Build a searchable company knowledge base
  </Card>

  <Card title="Research Assistant" icon="flask" href="/examples/research-assistant">
    Create an AI research assistant for papers
  </Card>

  <Card title="Memvid Canvas" icon="palette" href="https://github.com/memvid/memvid">
    AI UI Kit. Build AI-powered apps in minutes.
  </Card>

  <Card title="Agents & Packages" icon="cubes" href="/examples/packages">
    Official tools and packages built with Memvid
  </Card>
</CardGroup>

***

## Quick Examples

### Semantic Search in 10 Lines

<Tabs>
  <Tab title="Node.js">
    ```typescript theme={null}
    import { use } from '@memvid/sdk';

    // Open or create memory
    const mem = await use('basic', 'knowledge.mv2', { mode: 'auto' });

    // Add some knowledge
    await mem.put({ title: 'AI Basics', label: 'docs', text: 'Artificial intelligence is...' });
    await mem.put({ title: 'ML Guide', label: 'docs', text: 'Machine learning enables...' });

    // Search semantically
    const results = await mem.find('how do computers learn?', { k: 5 });
    results.hits.forEach(hit => console.log(`${hit.title}: ${hit.snippet}`));
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from memvid_sdk import use

    # Open or create memory
    mem = use('basic', 'knowledge.mv2', mode='auto')

    # Add some knowledge
    mem.put({"title": "AI Basics", "label": "docs", "text": "Artificial intelligence is..."})
    mem.put({"title": "ML Guide", "label": "docs", "text": "Machine learning enables..."})

    # Search semantically
    results = mem.find("how do computers learn?", k=5)
    for hit in results.hits:
        print(f"{hit.title}: {hit.snippet}")
    ```
  </Tab>
</Tabs>

***

### LangChain RAG Pipeline

```python theme={null}
from memvid_sdk import use
from langchain_openai import ChatOpenAI
from langchain.chains import RetrievalQA

# Initialize with LangChain adapter
mem = use('langchain', 'knowledge.mv2')

# Create RAG chain
qa = RetrievalQA.from_chain_type(
    llm=ChatOpenAI(model="gpt-4o"),
    retriever=mem.as_retriever(k=5),
    return_source_documents=True
)

# Ask questions
result = qa.invoke("What are the main features?")
print(result['result'])
```

***

### Next.js API Route with Streaming

```typescript theme={null}
// app/api/chat/route.ts
import { use } from '@memvid/sdk';
import { openai } from '@ai-sdk/openai';
import { streamText } from 'ai';

const mem = await use('vercel-ai', 'knowledge.mv2');

export async function POST(req: Request) {
  const { messages } = await req.json();

  const result = await streamText({
    model: openai('gpt-4o'),
    system: 'You are a helpful assistant. Use the tools to search the knowledge base.',
    tools: mem.tools,
    messages,
    maxSteps: 5,
  });

  return result.toDataStreamResponse();
}
```

***

### Multi-Agent Research Team

```python theme={null}
from memvid_sdk import use
from autogen import AssistantAgent, UserProxyAgent

mem = use('autogen', 'research-papers.mv2')

# Create researcher agent with Memvid tools
researcher = AssistantAgent(
    name="researcher",
    llm_config={"tools": mem.tools},
    system_message="You research topics using the knowledge base."
)

# Create writer agent
writer = AssistantAgent(
    name="writer",
    system_message="You write summaries based on research findings."
)

# Create user proxy
user = UserProxyAgent(name="user", human_input_mode="NEVER")

# Start research task
user.initiate_chat(
    researcher,
    message="Research the latest advances in transformer architectures"
)
```

***

## Example Categories

### By Use Case

<AccordionGroup>
  <Accordion title="Chatbots & Assistants" icon="robot">
    * [Chatbot with Memory](/examples/chatbot-memory) - Persistent conversation context
  </Accordion>

  <Accordion title="Document Processing" icon="file-lines">
    * [Document Q\&A](/examples/document-qa) - Answer questions from PDFs
    * [Research Papers](/examples/research-assistant) - Analyze academic papers
  </Accordion>

  <Accordion title="Knowledge Management" icon="book">
    * [Company Wiki](/examples/knowledge-base) - Searchable internal docs
  </Accordion>
</AccordionGroup>

### By Framework

| Framework  | Integration Guide                                |
| ---------- | ------------------------------------------------ |
| LangChain  | [LangChain Integration](/frameworks/langchain)   |
| LlamaIndex | [LlamaIndex Integration](/frameworks/llamaindex) |
| Vercel AI  | [Vercel AI Integration](/frameworks/vercel-ai)   |
| OpenAI     | [OpenAI Integration](/frameworks/openai)         |
| Google ADK | [Google ADK Integration](/frameworks/google-adk) |

***

## Starter Templates

Get started quickly with our templates:

<CardGroup cols={3}>
  <Card title="Next.js + Memvid" icon="react" href="https://github.com/memvid/template-nextjs">
    Full-stack AI app template
  </Card>

  <Card title="Python FastAPI" icon="python" href="https://github.com/memvid/template-fastapi">
    REST API with RAG
  </Card>

  <Card title="CLI Tool" icon="terminal" href="https://github.com/memvid/template-cli">
    Command-line AI assistant
  </Card>
</CardGroup>

***

## Community Examples

Explore what others have built:

<Card title="Awesome Memvid" icon="star" href="https://github.com/memvid/awesome-memvid">
  Community-curated list of Memvid projects, tutorials, and resources
</Card>

### Featured Projects

| Project                                               | Description              | Author      |
| ----------------------------------------------------- | ------------------------ | ----------- |
| [DocuChat](https://github.com/example/docuchat)       | Chat with your documents | @developer1 |
| [ResearchGPT](https://github.com/example/researchgpt) | Academic paper assistant | @developer2 |
| [CodeSearch](https://github.com/example/codesearch)   | Semantic code search     | @developer3 |

***

## Submit Your Example

Built something cool? Share it with the community!

<Card title="Submit Example" icon="plus" href="https://github.com/memvid/memvid/issues/new?template=example_submission.md">
  Submit your example for inclusion in the docs
</Card>
