# Estructura del Proyecto Pipeline ## βœ… Carpetas y Archivos Copiados ``` pipeline/ β”œβ”€β”€ πŸ“„ pyproject.toml # ConfiguraciΓ³n principal del proyecto β”œβ”€β”€ πŸ“„ config.yaml # ConfiguraciΓ³n de GCP (del original) β”œβ”€β”€ πŸ“„ config.example.yaml # Plantilla de configuraciΓ³n β”œβ”€β”€ πŸ“„ .python-version # Python 3.12 β”œβ”€β”€ πŸ“„ .gitignore # Archivos a ignorar β”œβ”€β”€ πŸ“„ README.md # DocumentaciΓ³n completa β”‚ β”œβ”€β”€ πŸ“ packages/ # LibrerΓ­as reutilizables β”‚ β”œβ”€β”€ chunker/ # ⭐ CHUNKING β”‚ β”‚ β”œβ”€β”€ pyproject.toml β”‚ β”‚ └── src/chunker/ β”‚ β”‚ β”œβ”€β”€ base_chunker.py β”‚ β”‚ β”œβ”€β”€ recursive_chunker.py β”‚ β”‚ β”œβ”€β”€ contextual_chunker.py β”‚ β”‚ └── llm_chunker.py β”‚ β”‚ β”‚ β”œβ”€β”€ embedder/ # ⭐ EMBEDDINGS β”‚ β”‚ β”œβ”€β”€ pyproject.toml β”‚ β”‚ └── src/embedder/ β”‚ β”‚ β”œβ”€β”€ base.py β”‚ β”‚ └── vertex_ai.py β”‚ β”‚ β”‚ β”œβ”€β”€ file-storage/ # ⭐ ALMACENAMIENTO GCS β”‚ β”‚ β”œβ”€β”€ pyproject.toml β”‚ β”‚ └── src/file_storage/ β”‚ β”‚ β”œβ”€β”€ base.py β”‚ β”‚ β”œβ”€β”€ google_cloud.py β”‚ β”‚ └── cli.py β”‚ β”‚ β”‚ β”œβ”€β”€ vector-search/ # ⭐ ÍNDICE VECTORIAL β”‚ β”‚ β”œβ”€β”€ pyproject.toml β”‚ β”‚ └── src/vector_search/ β”‚ β”‚ β”œβ”€β”€ base.py β”‚ β”‚ β”œβ”€β”€ vertex_ai.py β”‚ β”‚ └── cli/ β”‚ β”‚ β”œβ”€β”€ create.py β”‚ β”‚ β”œβ”€β”€ query.py β”‚ β”‚ β”œβ”€β”€ delete.py β”‚ β”‚ └── generate.py β”‚ β”‚ β”‚ β”œβ”€β”€ llm/ # Cliente LLM β”‚ β”‚ β”œβ”€β”€ pyproject.toml β”‚ β”‚ └── src/llm/ β”‚ β”‚ β”œβ”€β”€ base.py β”‚ β”‚ └── vertex_ai.py β”‚ β”‚ β”‚ β”œβ”€β”€ document-converter/ # ConversiΓ³n PDFβ†’Markdown β”‚ β”‚ β”œβ”€β”€ pyproject.toml β”‚ β”‚ └── src/document_converter/ β”‚ β”‚ β”œβ”€β”€ base.py β”‚ β”‚ └── markdown.py β”‚ β”‚ β”‚ └── utils/ # Utilidades β”‚ β”œβ”€β”€ pyproject.toml β”‚ └── src/utils/ β”‚ └── normalize_filenames.py β”‚ β”œβ”€β”€ πŸ“ apps/ # Aplicaciones β”‚ └── index-gen/ # ⭐ PIPELINE PRINCIPAL β”‚ β”œβ”€β”€ pyproject.toml β”‚ └── src/index_gen/ β”‚ β”œβ”€β”€ cli.py β”‚ └── main.py # Pipeline KFP completo β”‚ └── πŸ“ src/ # CΓ³digo fuente principal └── rag_eval/ β”œβ”€β”€ __init__.py └── config.py # ConfiguraciΓ³n centralizada ``` ## πŸ“Š Resumen de Componentes ### Packages Core (7) 1. βœ… **chunker** - 3 estrategias de chunking (Recursive, Contextual, LLM) 2. βœ… **embedder** - GeneraciΓ³n de embeddings con Vertex AI 3. βœ… **file-storage** - Almacenamiento en Google Cloud Storage 4. βœ… **vector-search** - Índices vectoriales en Vertex AI 5. βœ… **llm** - Cliente para modelos Gemini/Vertex AI 6. βœ… **document-converter** - ConversiΓ³n de documentos 7. βœ… **utils** - Utilidades varias ### Aplicaciones (1) 1. βœ… **index-gen** - Pipeline completo de procesamiento ### ConfiguraciΓ³n (1) 1. βœ… **rag_eval** - ConfiguraciΓ³n centralizada ## πŸ”§ Archivos de ConfiguraciΓ³n - βœ… `pyproject.toml` - Dependencias y scripts CLI - βœ… `config.yaml` - ConfiguraciΓ³n de GCP - βœ… `config.example.yaml` - Plantilla - βœ… `.python-version` - VersiΓ³n de Python - βœ… `.gitignore` - Archivos ignorados ## πŸ“ DocumentaciΓ³n - βœ… `README.md` - DocumentaciΓ³n completa con ejemplos - βœ… `STRUCTURE.md` - Este archivo ## 🎯 Funcionalidades Disponibles ### CLI Scripts ```bash # Chunking recursive-chunker input.txt output/ contextual-chunker input.txt output/ --max-chunk-size 800 llm-chunker documento.pdf output/ --model gemini-2.0-flash # Document conversion convert-md documento.pdf # File storage file-storage upload local.md remote/path.md file-storage list remote/ file-storage download remote/path.md # Vector search vector-search create index-name gs://bucket/vectors/ --dimensions 768 vector-search query deployed-id "query text" --limit 5 vector-search delete index-name # Utils normalize-filenames input_dir/ ``` ### Python API Todas las clases estΓ‘n disponibles para importaciΓ³n directa: ```python from chunker.contextual_chunker import ContextualChunker from embedder.vertex_ai import VertexAIEmbedder from file_storage.google_cloud import GoogleCloudFileStorage from vector_search.vertex_ai import GoogleCloudVectorSearch from llm.vertex_ai import VertexAILLM ``` ## πŸš€ PrΓ³ximos Pasos 1. **Instalar dependencias**: ```bash cd /home/coder/sigma-chat/pipeline uv sync ``` 2. **Configurar GCP**: - Editar `config.yaml` con tus credenciales - Ejecutar `gcloud auth application-default login` 3. **Probar chunking**: ```bash echo "Texto de prueba" > test.txt recursive-chunker test.txt output/ ``` 4. **Ver documentaciΓ³n completa**: ```bash cat README.md ``` --- **Total de archivos Python copiados**: ~30+ archivos **Total de packages**: 8 (7 packages + 1 app) **Listo para usar**: βœ