Skip to content

Commit 5fbe346

Browse files
authored
Merge pull request #9 from Acuspeedster/main
Update README.m
2 parents 0ad9754 + 815c5a3 commit 5fbe346

File tree

1 file changed

+74
-18
lines changed

1 file changed

+74
-18
lines changed

README.md

Lines changed: 74 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ API and MCP services that generate fully functional Rust projects from natural l
1111
- **Vector Search** 🔍 - Search for similar projects and errors.
1212
- **Docker Containerization** 🐳 - Easy deployment with Docker.
1313
- **Asynchronous Processing** ⏳ - Handle long-running operations efficiently.
14+
- **Multiple Service Interfaces** 🔄 - REST API and MCP (Model-Compiler-Processor) interface.
1415

1516
---
1617

@@ -24,14 +25,15 @@ Or, if you want to run the services directly on your own computer:
2425

2526
- **Python 3.8+** 🐍
2627
- **Rust Compiler and cargo tools** 🦀
28+
- **Rust Compiler and cargo tools** 🦀
2729

2830
---
2931

3032
## 📦 Install
3133

3234
```bash
33-
git clone <repository-url>
34-
cd Rust_coder_lfx
35+
git clone https://github.com/WasmEdge/Rust_coder
36+
cd Rust_coder
3537
```
3638

3739
## 🚀 Configure and run
@@ -65,15 +67,15 @@ docker-compose stop
6567
By default, you will need a [Qdrant server](https://qdrant.tech/documentation/quickstart/) running on `localhost` port `6333`. You also need a [local Gaia node](https://github.com/GaiaNet-AI/node-configs/tree/main/qwen-2.5-coder-3b-instruct-gte). Set the following environment variables in your terminal to point to the Qdrant and Gaia instances, as well as your Rust compiler tools.
6668

6769
```
68-
QDRANT_HOST
69-
QDRANT_PORT
70-
LLM_API_BASE
71-
LLM_MODEL
72-
LLM_EMBED_MODEL
73-
LLM_API_KEY
74-
LLM_EMBED_SIZE
75-
CARGO_PATH
76-
RUST_COMPILER_PATH
70+
QDRANT_HOST=localhost
71+
QDRANT_PORT=6333
72+
LLM_API_BASE=http://localhost:8080/v1
73+
LLM_MODEL=Qwen2.5-Coder-3B-Instruct
74+
LLM_EMBED_MODEL=nomic-embed
75+
LLM_API_KEY=your_api_key
76+
LLM_EMBED_SIZE=768
77+
CARGO_PATH=/path/to/cargo
78+
RUST_COMPILER_PATH=/path/to/rustc
7779
```
7880

7981
Start the services.
@@ -114,9 +116,18 @@ The API provides the following endpoints:
114116

115117
```
116118
[filename: Cargo.toml]
119+
[package]
120+
name = "calculator"
121+
version = "0.1.0"
122+
edition = "2021"
123+
124+
[dependencies]
117125
... ...
118126
119127
[filename: src/main.rs]
128+
fn main() {
129+
// Calculator implementation
130+
}
120131
... ...
121132
```
122133

@@ -352,23 +363,32 @@ Rust_coder_lfx/
352363
├── app/ # Application code
353364
│ ├── compiler.py # Rust compilation handling
354365
│ ├── llm_client.py # LLM API client
355-
│ ├── main.py # FastAPI application
366+
│ ├── llm_tools.py # Tools for LLM interactions
367+
│ ├── load_data.py # Data loading utilities
368+
│ ├── main.py # FastAPI application & endpoints
369+
│ ├── mcp_server.py # MCP server implementation
356370
│ ├── mcp_service.py # Model-Compiler-Processor service
371+
│ ├── mcp_tools.py # MCP-specific tools
357372
│ ├── prompt_generator.py # LLM prompt generation
358373
│ ├── response_parser.py # Parse LLM responses into files
359-
│ ├── vector_store.py # Vector database interface
360-
│ └── ...
374+
│ ├── utils.py # Utility functions
375+
│ └── vector_store.py # Vector database interface
361376
├── data/ # Data storage
362377
│ ├── error_examples/ # Error examples for vector search
363378
│ └── project_examples/ # Project examples for vector search
364379
├── docker-compose.yml # Docker Compose configuration
365380
├── Dockerfile # Docker configuration
366381
├── examples/ # Example scripts for using the API
367-
├── output/ # Generated project output
382+
│ ├── compile_endpoint.txt # Example for compile endpoint
383+
│ ├── compile_and_fix_endpoint.txt # Example for compile-and-fix endpoint
384+
│ ├── mcp_client_example.py # Example MCP client usage
385+
│ └── run_mcp_server.py # Example for running MCP server
386+
├── templates/ # Prompt templates
387+
│ └── project_prompts.txt # Templates for project generation
388+
├── mcp-proxy-config.json # MCP proxy configuration
368389
├── parse_and_save_qna.py # Q&A parsing utility
369-
├── qdrant_data/ # Vector database storage
370390
├── requirements.txt # Python dependencies
371-
└── templates/ # API templates
391+
└── .env # Environment variables
372392
```
373393

374394
---
@@ -384,10 +404,46 @@ Compilation Feedback Loop: Automatically compiles, detects errors, and fixes the
384404

385405
File Parsing: Converts LLM responses into project files with `response_parser.py`.
386406

407+
#### Architecture
408+
409+
REST API Interface (app/main.py): FastAPI application exposing HTTP endpoints for project generation, compilation, and error fixing.
410+
411+
MCP Interface (mcp_server.py, app/mcp_service.py): Server-Sent Events interface for the same functionality.
412+
413+
Vector Database (app/vector_store.py): Qdrant is used for storing and searching similar projects and error examples.
414+
415+
LLM Integration (app/llm_client.py): Communicates with LLM APIs (like Gaia nodes) for code generation and error fixing.
416+
417+
Compilation Pipeline (app/compiler.py): Handles Rust code compilation, error detection, and provides feedback for fixing.
418+
419+
#### Process Flow
420+
421+
Project Generation:
422+
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
428+
429+
Error Fixing:
430+
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
436+
387437
---
388438

389439
## 🤝 Contributing
390-
Contributions are welcome! Feel free to submit a Pull Request. 🚀
440+
Contributions are welcome! Feel free to submit a Pull Request.
441+
442+
Fork the repository
443+
Create your feature branch (git checkout -b feature/amazing-feature)
444+
Commit your changes (git commit -m 'Add some amazing feature')
445+
Push to the branch (git push origin feature/amazing-feature)
446+
Open a Pull Request
391447

392448
---
393449

0 commit comments

Comments
 (0)