File size: 2,085 Bytes
837d0b8
b27eb78
 
 
837d0b8
 
b27eb78
837d0b8
 
b27eb78
837d0b8
 
b27eb78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: Second Brain AI Assistant
emoji: 🧠
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: "5.12.0"
app_file: app.py
pinned: false
license: mit
---

# Second Brain AI Assistant

A production-ready AI assistant that can answer questions about your documents using RAG (Retrieval-Augmented Generation).

## Features

- **Document Q&A**: Ask questions about your documents
- **Source Attribution**: See which documents were used for each answer
- **Clean UI**: Professional interface with proper formatting
- **Real-time Processing**: Get answers instantly
- **Tool Usage Display**: See which tools were used to generate responses

## Usage

1. Enter your question in the text box
2. Click "Ask" to get an AI-powered answer
3. View sources and tools used in the response
4. Use the debug section to see raw responses

## Example Queries

- "What pricing objections have been raised?"
- "What messaging is resonating with prospects?"
- "What concerns have prospects raised with regards to product?"
- "What has resonated with prospects based on the meeting transcripts?"

## Configuration

This space uses the following environment variables:
- `OPENAI_API_KEY`: Your OpenAI API key
- `MONGODB_URI`: MongoDB connection string
- `MONGODB_DATABASE_NAME`: Database name (default: second_brain_course)
- `MONGODB_COLLECTION_NAME`: Collection name (default: rag)
- `COMET_API_KEY`: Comet ML API key for tracking
- `COMET_PROJECT`: Project name (default: second_brain_course)
- `RETRIEVER_CONFIG_PATH`: Path to retriever config (default: configs/compute_rag_vector_index_openai_contextual_simple.yaml)

## Architecture

- **RAG Pipeline**: Uses MongoDB for document storage and retrieval
- **Embeddings**: OpenAI text-embedding-3-small for document embeddings
- **LLM**: GPT-4o-mini for response generation
- **UI**: Custom Gradio interface with enhanced formatting
- **Tools**: MongoDB retriever and final answer tools

## Local Development

```bash
# Install dependencies
uv sync

# Run the agent
make run_agent_app

# Or run directly
python app.py
```

## License

MIT License