You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compilation Pipeline (app/compiler.py): Handles Rust code compilation, error detection, and provides feedback for fixing.
418
406
419
-
####Process Flow
407
+
### Process Flow
420
408
421
409
Project Generation:
422
410
423
-
User provides a description and requirements
424
-
System creates a prompt using templates (templates/project_prompts.txt)
425
-
LLM generates a complete Rust project
426
-
Response is parsed into individual files (app/response_parser.py)
427
-
Project is compiled to verify correctness
411
+
*User provides a description and requirements
412
+
*System creates a prompt using templates
413
+
*LLM generates a complete Rust project
414
+
*Response is parsed into individual files (`app/response_parser.py`)
415
+
*Project is compiled to verify correctness
428
416
429
417
Error Fixing:
430
418
431
-
System attempts to compile the provided code
432
-
If errors occur, they're extracted and analyzed
433
-
Vector search may find similar past errors
434
-
LLM receives the errors and original code to generate fixes
435
-
Process repeats until successful or max attempts reached
419
+
*System attempts to compile the provided code
420
+
*If errors occur, they're extracted and analyzed
421
+
*Vector search may find similar past errors
422
+
*LLM receives the errors and original code to generate fixes
423
+
*Process repeats until successful or max attempts reached
436
424
437
425
---
438
426
439
-
## 📊 Adding to the Vector Database
427
+
## 📊 Enhancing Performance with Vector Search
440
428
441
429
The system uses vector embeddings to find similar projects and error examples, which helps improve code generation quality. Here's how to add your own examples:
442
430
443
431
### 🔧 Creating Vector Collections
444
432
445
-
First, you need to create the necessary collections in Qdrant using these curl commands:
433
+
First, you need to create the necessary collections in Qdrant using these `curl` commands:
446
434
447
435
```bash
448
-
# Create project_examples collection with 1536 dimensions (default)
436
+
# Create project_examples collection with 768 dimensions (default)
449
437
curl -X PUT "http://localhost:6333/collections/project_examples" \
450
438
-H "Content-Type: application/json" \
451
439
-d '{
452
440
"vectors": {
453
-
"size": 1536,
441
+
"size": 768,
454
442
"distance": "Cosine"
455
443
}
456
444
}'
457
445
458
-
# Create error_examples collection with 1536 dimensions (default)
446
+
# Create error_examples collection with 768 dimensions (default)
459
447
curl -X PUT "http://localhost:6333/collections/error_examples" \
460
448
-H "Content-Type: application/json" \
461
449
-d '{
462
450
"vectors": {
463
-
"size": 1536,
451
+
"size": 768,
464
452
"distance": "Cosine"
465
453
}
466
454
}'
467
455
```
468
-
Note: If you've configured a different embedding size via ```LLM_EMBED_SIZE``` environment variable, replace 1536 with that value.
469
456
470
-
### Method 1: Using Python API Directly
457
+
> Note: If you've configured a different embedding size via `LLM_EMBED_SIZE` environment variable, replace 768 with that value.
458
+
459
+
### 🗂️ Adding Data to Vector Collections
460
+
461
+
#### Method 1: Using Python API Directly
462
+
463
+
For Project Examples
471
464
472
-
#### For Project Examples
473
465
```python
474
466
from app.llm_client import LlamaEdgeClient
475
467
from app.vector_store import QdrantStore
@@ -503,6 +495,7 @@ vector_store.add_item(
503
495
```
504
496
505
497
For Error Examples:
498
+
506
499
```python
507
500
from app.llm_client import LlamaEdgeClient
508
501
from app.vector_store import QdrantStore
@@ -533,12 +526,15 @@ vector_store.add_item(
533
526
)
534
527
```
535
528
536
-
### Method 2: Adding Multiple Examples from JSON Files
529
+
#### Method 2: Adding Multiple Examples from JSON Files
530
+
537
531
Place JSON files in the appropriate directories:
538
532
539
-
Project examples: ```project_examples```
540
-
Error examples: ```error_examples```
541
-
Format for project examples (with optional project_files field):
533
+
* Project examples: `data/project_examples`
534
+
* Error examples: `data/error_examples`
535
+
536
+
Format for project examples (with optional `project_files` field):
537
+
542
538
```json
543
539
{
544
540
"query": "Description of the project",
@@ -549,7 +545,9 @@ Format for project examples (with optional project_files field):
549
545
}
550
546
}
551
547
```
548
+
552
549
Format for error examples:
550
+
553
551
```
554
552
{
555
553
"error": "Rust compiler error message",
@@ -558,46 +556,51 @@ Format for error examples:
558
556
"example": "// Code example showing the fix (optional)"
*`SKIP_VECTOR_SEARCH=false` (or not set) - Enables vector search
584
+
585
+
By default, vector search is disabled. To enable it:
586
+
587
+
- Change to `SKIP_VECTOR_SEARCH=false` in your `.env` file
587
588
- Ensure you have a running Qdrant instance (via Docker Compose or standalone)
588
589
- Create the collections as shown above
589
590
590
591
## 🤝 Contributing
592
+
591
593
Contributions are welcome! This project uses the Developer Certificate of Origin (DCO) to certify that contributors have the right to submit their code. Follow these steps:
592
594
593
-
Fork the repository
594
-
Create your feature branch (git checkout -b feature/amazing-feature)
595
-
Make your changes
596
-
Commit your changes with a sign-off (git commit -s -m 'Add some amazing feature')
597
-
Push to the branch (git push origin feature/amazing-feature)
598
-
Open a Pull Request
595
+
* Fork the repository
596
+
* Create your feature branch `git checkout -b feature/amazing-feature`
597
+
* Make your changes
598
+
* Commit your changes with a sign-off `git commit -s -m 'Add some amazing feature'`
599
+
* Push to the branch `git push origin feature/amazing-feature`
600
+
* Open a Pull Request
601
+
602
+
The `-s` flag will automatically add a signed-off-by line to your commit message:
599
603
600
-
The -s flag will automatically add a signed-off-by line to your commit message:
0 commit comments