|
| 1 | +<div align="center"> |
| 2 | + |
1 | 3 | # ContextBox |
2 | 4 |
|
3 | | -AI-powered context capture and organization tool for developers. |
| 5 | +**AI-powered context capture and organization for developers** |
4 | 6 |
|
5 | 7 | [](https://www.python.org/downloads/) |
6 | 8 | [](https://opensource.org/licenses/MIT) |
7 | | -[](https://jayhemnani9910.github.io/contextbox/) |
| 9 | +[](https://jayhemnani9910.github.io/contextbox/) |
| 10 | + |
| 11 | +[Documentation](https://jayhemnani9910.github.io/contextbox/) • [Installation](#installation) • [Quick Start](#quick-start) |
| 12 | + |
| 13 | +</div> |
| 14 | + |
| 15 | +--- |
8 | 16 |
|
9 | | -## Features |
| 17 | +## What is ContextBox? |
10 | 18 |
|
11 | | -- **Screenshot Capture** - Capture screenshots with automatic OCR text extraction |
12 | | -- **Web Content Extraction** - Extract content from web pages, Wikipedia, and YouTube |
13 | | -- **LLM-Powered Q&A** - Ask questions about your captured context using GitHub Models (free) |
14 | | -- **Intelligent Summarization** - Generate summaries of captured content |
15 | | -- **Semantic Search** - Search across all your captured contexts |
16 | | -- **Cross-Platform CLI** - Beautiful terminal interface with Rich formatting |
| 19 | +ContextBox captures, organizes, and queries your working context. Take screenshots, extract web content, and ask AI questions about everything you've captured. |
| 20 | + |
| 21 | +**Key Features:** |
| 22 | + |
| 23 | +| Feature | Description | |
| 24 | +|---------|-------------| |
| 25 | +| **Screenshot Capture** | Capture screen with automatic OCR text extraction | |
| 26 | +| **Web Extraction** | Pull content from web pages, Wikipedia, YouTube | |
| 27 | +| **AI Q&A** | Ask questions about your context (free via GitHub Models) | |
| 28 | +| **Smart Search** | Semantic search across all captured contexts | |
| 29 | +| **Cross-Platform** | Works on macOS, Linux, Windows | |
17 | 30 |
|
18 | 31 | ## Installation |
19 | 32 |
|
@@ -86,141 +99,57 @@ contextbox summarize --all-contexts |
86 | 99 | | `contextbox ask <question>` | Ask questions about context (AI) | |
87 | 100 | | `contextbox summarize` | Generate context summaries (AI) | |
88 | 101 | | `contextbox stats` | Show database statistics | |
89 | | -| `contextbox config` | Manage configuration | |
90 | 102 | | `contextbox export` | Export contexts to file | |
91 | 103 |
|
92 | | -### Capture Options |
93 | | - |
94 | | -```bash |
95 | | -contextbox capture --help |
96 | | - |
97 | | -Options: |
98 | | - -o, --output PATH Output file for results |
99 | | - -a, --artifact-dir PATH Directory for artifacts (default: artifacts) |
100 | | - --no-screenshot Skip taking screenshot |
101 | | - --extract-text Extract text content |
102 | | - --extract-urls Extract URLs from content |
103 | | -``` |
104 | | - |
105 | 104 | ## Configuration |
106 | 105 |
|
107 | 106 | ### GitHub Token (for AI features) |
108 | 107 |
|
109 | | -Set your GitHub token to enable AI-powered features: |
110 | | - |
111 | 108 | ```bash |
112 | 109 | export GITHUB_TOKEN="ghp_xxxxxxxxxxxx" |
113 | 110 | ``` |
114 | 111 |
|
115 | | -Or configure via CLI: |
| 112 | +### Supported AI Models |
116 | 113 |
|
117 | | -```bash |
118 | | -contextbox config --api-key |
119 | | -``` |
| 114 | +All models are free via [GitHub Models](https://github.com/marketplace/models): |
120 | 115 |
|
121 | | -### Supported LLM Models (via GitHub Models) |
122 | | - |
123 | | -| Model | Description | |
124 | | -|-------|-------------| |
125 | | -| `gpt-4o` | Most capable GPT-4 model | |
126 | | -| `gpt-4o-mini` | Fast and efficient (default) | |
127 | | -| `meta-llama-3.1-405b-instruct` | Meta's largest Llama | |
128 | | -| `meta-llama-3.1-70b-instruct` | Meta's Llama 70B | |
129 | | -| `mistral-large` | Mistral's flagship model | |
| 116 | +| Model | Best For | |
| 117 | +|-------|----------| |
| 118 | +| `gpt-4o-mini` | Fast responses (default) | |
| 119 | +| `gpt-4o` | Complex reasoning | |
| 120 | +| `meta-llama-3.1-70b-instruct` | Open-source alternative | |
130 | 121 |
|
131 | 122 | ## Python API |
132 | 123 |
|
133 | 124 | ```python |
134 | 125 | from contextbox import ContextBox |
135 | 126 |
|
136 | | -# Initialize |
137 | 127 | app = ContextBox() |
138 | 128 |
|
139 | | -# Capture context |
| 129 | +# Capture and store |
140 | 130 | context = app.capture() |
141 | | -print(f"Captured: {context['context_id']}") |
142 | | - |
143 | | -# Store and retrieve |
144 | 131 | context_id = app.store_context(context) |
145 | | -retrieved = app.get_context(context_id) |
146 | 132 |
|
147 | | -# Search |
| 133 | +# Search and retrieve |
148 | 134 | results = app.search("keyword") |
149 | 135 | ``` |
150 | 136 |
|
151 | | -### Using the LLM Backend |
152 | | - |
153 | | -```python |
154 | | -from contextbox.llm import create_github_models_backend, ChatRequest |
155 | | - |
156 | | -# Create backend |
157 | | -backend = create_github_models_backend() |
158 | | - |
159 | | -async def ask_question(): |
160 | | - async with backend: |
161 | | - request = ChatRequest.from_text( |
162 | | - text="Summarize this context", |
163 | | - model="gpt-4o-mini", |
164 | | - provider="github_models" |
165 | | - ) |
166 | | - response = await backend.chat_completion(request) |
167 | | - print(response.content) |
168 | | -``` |
169 | | - |
170 | | -## Project Structure |
171 | | - |
172 | | -``` |
173 | | -contextbox/ |
174 | | -├── contextbox/ # Python package |
175 | | -│ ├── cli.py # CLI interface (Click + Rich) |
176 | | -│ ├── main.py # Core ContextBox class |
177 | | -│ ├── capture.py # Screen capture functionality |
178 | | -│ ├── database.py # SQLite storage |
179 | | -│ ├── config.py # Configuration management |
180 | | -│ ├── extractors/ # Content extractors |
181 | | -│ │ ├── webpage.py # Web page extraction |
182 | | -│ │ ├── wikipedia.py # Wikipedia extraction |
183 | | -│ │ └── youtube.py # YouTube extraction |
184 | | -│ └── llm/ # LLM integration |
185 | | -│ ├── github_models.py # GitHub Models backend |
186 | | -│ ├── qa.py # Q&A system |
187 | | -│ └── summarization.py # Summarization |
188 | | -├── frontend/ # React + Vite documentation site |
189 | | -├── pyproject.toml # Package configuration |
190 | | -└── README.md |
191 | | -``` |
192 | | - |
193 | 137 | ## Requirements |
194 | 138 |
|
195 | | -- Python 3.9+ |
196 | | -- For screenshots: platform-specific tools |
197 | | - - macOS: Built-in `screencapture` |
198 | | - - Linux: `scrot`, `gnome-screenshot`, or `flameshot` |
199 | | - - Windows: `pyautogui` |
200 | | -- For OCR: Tesseract OCR engine |
| 139 | +| Platform | Screenshot Tool | OCR | |
| 140 | +|----------|----------------|-----| |
| 141 | +| macOS | Built-in | Tesseract | |
| 142 | +| Linux | scrot / flameshot | Tesseract | |
| 143 | +| Windows | pyautogui | Tesseract | |
201 | 144 |
|
202 | | -## Development |
203 | | - |
204 | | -```bash |
205 | | -# Clone and install dev dependencies |
206 | | -git clone https://github.com/jayhemnani9910/contextbox.git |
207 | | -cd contextbox |
208 | | -pip install -e ".[dev]" |
209 | | - |
210 | | -# Run tests |
211 | | -pytest |
| 145 | +## License |
212 | 146 |
|
213 | | -# Format code |
214 | | -black contextbox/ |
215 | | -ruff check contextbox/ |
216 | | -``` |
| 147 | +MIT License |
217 | 148 |
|
218 | | -## License |
| 149 | +--- |
219 | 150 |
|
220 | | -MIT License - see [LICENSE](LICENSE) for details. |
| 151 | +<div align="center"> |
221 | 152 |
|
222 | | -## Links |
| 153 | +[Documentation](https://jayhemnani9910.github.io/contextbox/) • [Issues](https://github.com/jayhemnani9910/contextbox/issues) • [Contribute](https://github.com/jayhemnani9910/contextbox) |
223 | 154 |
|
224 | | -- [Documentation](https://jayhemnani9910.github.io/contextbox) |
225 | | -- [GitHub Repository](https://github.com/jayhemnani9910/contextbox) |
226 | | -- [Issue Tracker](https://github.com/jayhemnani9910/contextbox/issues) |
| 155 | +</div> |
0 commit comments