256 lines
4.9 KiB
Markdown
256 lines
4.9 KiB
Markdown
---
|
||
type: Note
|
||
---
|
||
# PROMPT: generowanie projektu Generative AI (LLM + RAG)
|
||
|
||
Jasne — przygotuję Ci **gotowy, produkcyjny prompt**, który możesz wrzucić do **Claude Code / Copilot / dowolnego agenta**, żeby **automatycznie wygenerował projekt** w tej architekturze.
|
||
|
||
Dam Ci wersję:
|
||
|
||
- ✅ deterministyczną (minimalne „halucynacje”)
|
||
- ✅ zgodną z Twoim stylem (DBA + SOP + operacyjność)
|
||
- ✅ gotową do użycia w CLI (`claude -p`)
|
||
|
||
***
|
||
|
||
# ✅ PROMPT: generowanie projektu Generative AI (LLM + RAG)
|
||
|
||
```text
|
||
You are a senior software architect and platform engineer.
|
||
|
||
Your task is to generate a complete, production-ready Generative AI project based on the following requirements.
|
||
|
||
# CONTEXT
|
||
The project must implement:
|
||
- LLM abstraction (support OpenAI, Claude, local models)
|
||
- Retrieval-Augmented Generation (RAG)
|
||
- Data processing pipeline (chunking, tokenization, preprocessing)
|
||
- Prompt management system
|
||
- Inference engine
|
||
- Testing and automation scripts
|
||
- Container-ready (Docker)
|
||
|
||
The system must be structured, maintainable, and suitable for enterprise environments.
|
||
|
||
# REQUIREMENTS
|
||
|
||
## 1. Project structure
|
||
Create a full file tree exactly in this format:
|
||
|
||
generative_ai_project/
|
||
config/
|
||
data/
|
||
src/
|
||
core/
|
||
prompts/
|
||
rag/
|
||
processing/
|
||
inference/
|
||
tests/
|
||
unit/
|
||
integration/
|
||
scripts/
|
||
|
||
Include all files and implement real code (not placeholders).
|
||
|
||
---
|
||
|
||
## 2. Core architecture
|
||
|
||
### src/core/
|
||
Implement:
|
||
- base_llm.py → abstract interface (send, generate, stream)
|
||
- gpt_client.py → OpenAI client
|
||
- claude_client.py → Claude client
|
||
- local_llm.py → local model stub
|
||
- model_factory.py → dynamic model selection based on config
|
||
|
||
Requirements:
|
||
- retries
|
||
- timeout handling
|
||
- structured logging
|
||
|
||
---
|
||
|
||
## 3. Prompt layer (src/prompts/)
|
||
- templates.py → prompt templates (Jinja-like)
|
||
- chain.py → multi-step chaining
|
||
|
||
Requirements:
|
||
- reusable prompt structure
|
||
- system + user + context separation
|
||
|
||
---
|
||
|
||
## 4. RAG module (src/rag/)
|
||
Implement:
|
||
- embedder.py → embedding generation
|
||
- retriever.py → similarity search (top-k)
|
||
- vector_store.py → wrapper (FAISS or simple in-memory version)
|
||
- indexer.py → indexing pipeline
|
||
|
||
Requirements:
|
||
- deterministic chunking
|
||
- metadata support
|
||
- clear interfaces between components
|
||
|
||
---
|
||
|
||
## 5. Data processing (src/processing/)
|
||
Implement:
|
||
- chunking.py → configurable chunk size + overlap
|
||
- tokenizer.py → basic tokenizer abstraction
|
||
- preprocessor.py → cleaning pipeline
|
||
|
||
---
|
||
|
||
## 6. Inference (src/inference/)
|
||
Implement:
|
||
- inference_engine.py → orchestration:
|
||
user_query → retriever → prompt → LLM → response parser
|
||
- response_parser.py → structured output (JSON-safe)
|
||
|
||
---
|
||
|
||
## 7. Config (config/)
|
||
Create:
|
||
- model_config.yaml
|
||
- logging_config.yaml
|
||
|
||
Requirements:
|
||
- environment-aware (dev/prod)
|
||
- no hardcoded secrets
|
||
|
||
---
|
||
|
||
## 8. Scripts (scripts/)
|
||
Create:
|
||
- setup_env.sh
|
||
- run_tests.sh
|
||
- build_embeddings.py
|
||
- cleanup.py
|
||
|
||
---
|
||
|
||
## 9. Tests (tests/)
|
||
Create:
|
||
- unit tests for LLM clients and prompts
|
||
- integration test for full RAG + inference flow
|
||
|
||
---
|
||
|
||
## 10. Operational requirements
|
||
All code must:
|
||
- include logging
|
||
- include error handling
|
||
- support debugging
|
||
- avoid global state
|
||
|
||
---
|
||
|
||
## 11. Output format
|
||
Return:
|
||
1. Full directory tree
|
||
2. Full code for each file
|
||
3. Example config files
|
||
4. Example usage (CLI or script)
|
||
|
||
Do not skip files. Do not leave TODOs.
|
||
|
||
---
|
||
|
||
# CONSTRAINTS
|
||
- Code must be Python
|
||
- Clean architecture (separation of concerns)
|
||
- No unnecessary dependencies
|
||
- Ready to run locally
|
||
|
||
---
|
||
|
||
# BONUS
|
||
If possible:
|
||
- add simple CLI entrypoint
|
||
- add example dataset
|
||
- include README structure
|
||
|
||
# GOAL
|
||
The result must be a working skeleton that can be extended into production.
|
||
|
||
Start now.
|
||
```
|
||
|
||
***
|
||
|
||
# ✅ Jak tego użyć (praktycznie)
|
||
|
||
## Claude Code (najlepsza opcja)
|
||
|
||
```bash
|
||
claude --bare -p "$(cat prompt.txt)"
|
||
```
|
||
|
||
albo:
|
||
|
||
```bash
|
||
claude --bare -p "<<<tu wklej prompt>>>"
|
||
```
|
||
|
||
***
|
||
|
||
## 🔥 PRO TIP (dla Ciebie – advanced)
|
||
|
||
Jeśli chcesz mieć **100% powtarzalności (bardzo w Twoim stylu)**:
|
||
|
||
Dodaj do prompta:
|
||
|
||
```text
|
||
Use deterministic behavior:
|
||
- avoid random examples
|
||
- use fixed sample data
|
||
- keep outputs stable
|
||
```
|
||
|
||
***
|
||
|
||
# ✅ Wersja rozszerzona (dla Twojego systemu – OpenClaw / agents)
|
||
|
||
Możesz to też użyć jako **skill/mission prompt**:
|
||
|
||
```text
|
||
MISSION: generate-genai-project
|
||
|
||
INPUT:
|
||
- project_name
|
||
- llm_provider (gpt/claude/local)
|
||
- use_rag (true/false)
|
||
|
||
OUTPUT:
|
||
- full repo structure
|
||
- working code
|
||
- scripts + tests
|
||
|
||
CONSTRAINTS:
|
||
- deterministic output
|
||
- no placeholders
|
||
- production-ready
|
||
```
|
||
|
||
***
|
||
|
||
# Jeśli chcesz dalej
|
||
|
||
Mogę Ci zrobić kolejne poziomy:
|
||
|
||
✅ prompt do:
|
||
|
||
- generowania **tylko RAG pipeline**
|
||
- generowania **tylko inference engine**
|
||
- generowania **runbooków + monitoring + alerts**
|
||
|
||
✅ albo:
|
||
|
||
- wersję pod **Twoje realne środowisko (Proxmox / on-prem / DB-backed RAG)**
|
||
- integrację z **Splunk / ServiceNow / Agentami (MCC/APOLLO)**
|
||
|
||
Powiedz kierunek → zrobię Ci to już pod konkretne wdrożenie 👍
|