-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.cursorrules
More file actions
125 lines (96 loc) · 4.46 KB
/
.cursorrules
File metadata and controls
125 lines (96 loc) · 4.46 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Instructions
- use o3-mini as the default model.
- in generateObject, do not use min,max, default value in zod schema.
- use bun as the package manager.
During you interaction with the user, if you find anything reusable in this project (e.g. version of a library, model name), especially about a fix to a mistake you made or a correction you received, you should take note in the `Lessons` section in the `.cursorrules` file so you will not make the same mistake again.
You should also use the `.cursorrules` file as a scratchpad to organize your thoughts. Especially when you receive a new task, you should first review the content of the scratchpad, clear old different task if necessary, first explain the task, and plan the steps you need to take to complete the task. You can use todo markers to indicate the progress, e.g.
[X] Task 1
[ ] Task 2
Also update the progress of the task in the Scratchpad when you finish a subtask.
Especially when you finished a milestone, it will help to improve your depth of task accomplishment to use the scratchpad to reflect and plan.
The goal is to help you maintain a big picture as well as the progress of the task. Always refer to the Scratchpad when you plan the next step.
# Tools
Note all the tools are in python. So in the case you need to do batch processing, you can always consult the python files and write your own script.
## Screenshot Verification
The screenshot verification workflow allows you to capture screenshots of web pages and verify their appearance using LLMs. The following tools are available:
1. Screenshot Capture:
```bash
venv/bin/python tools/screenshot_utils.py URL [--output OUTPUT] [--width WIDTH] [--height HEIGHT]
```
2. LLM Verification with Images:
```bash
venv/bin/python tools/llm_api.py --prompt "Your verification question" --provider {openai|anthropic} --image path/to/screenshot.png
```
Example workflow:
```python
from screenshot_utils import take_screenshot_sync
from llm_api import query_llm
# Take a screenshot
screenshot_path = take_screenshot_sync('https://example.com', 'screenshot.png')
# Verify with LLM
response = query_llm(
"What is the background color and title of this webpage?",
provider="openai", # or "anthropic"
image_path=screenshot_path
)
print(response)
```
@
## LLM
You always have an LLM at your side to help you with the task. For simple tasks, you could invoke the LLM by running the following command:
```
venv/bin/python ./tools/llm_api.py --prompt "What is the capital of France?" --provider "anthropic"
```
The LLM API supports multiple providers:
- OpenAI (default, model: gpt-4o)
- Azure OpenAI (model: configured via AZURE_OPENAI_MODEL_DEPLOYMENT in .env file, defaults to gpt-4o-ms)
- DeepSeek (model: deepseek-chat)
- Anthropic (model: claude-3-sonnet-20240229)
- Gemini (model: gemini-pro)
- Local LLM (model: Qwen/Qwen2.5-32B-Instruct-AWQ)
But usually it's a better idea to check the content of the file and use the APIs in the `tools/llm_api.py` file to invoke the LLM if needed.
## Web browser
You could use the `tools/web_scraper.py` file to scrape the web.
```
venv/bin/python ./tools/web_scraper.py --max-concurrent 3 URL1 URL2 URL3
```
This will output the content of the web pages.
## Search engine
You could use the `tools/search_engine.py` file to search the web.
```
venv/bin/python ./tools/search_engine.py "your search keywords"
```
This will output the search results in the following format:
```
URL: https://example.com
Title: This is the title of the search result
Snippet: This is a snippet of the search result
```
If needed, you can further use the `web_scraper.py` file to scrape the web page content.
****# Scratchpad
## Current Task: Implement Orchestrator-Worker Architecture
Task Overview:
- Implement a flexible system for handling "where did I see X?" type queries
- Use orchestrator-worker pattern with LLM-powered components
- Follow project guidelines (o3-mini model, no defaults in Zod)
Components to Build:
[X] Base Worker Interface
[ ] Query Orchestrator
[ ] Core Workers:
[ ] Entity Resolution Worker
[ ] Time Range Worker
[ ] Search Worker
[ ] Ranking Worker
[ ] Summarization Worker
[ ] Pipeline Execution Logic
[ ] Integration with Existing System
Next Steps:
1. Fix linter errors in current files
2. Implement missing workers
3. Add proper pipeline execution
4. Add tests and error handling
# Lessons
- Use o3-mini as default model
- Don't use default values in Zod schemas
- Mark required fields in Zod schemas
- Keep track of worker state properly