Skip to content

Commit 1e64bf8

Browse files
Merge remote-tracking branch 'origin/devops' into devops
2 parents 6439dde + 399118d commit 1e64bf8

File tree

23 files changed

+550
-401
lines changed

23 files changed

+550
-401
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
*.pdf
2+
13
# Byte-compiled / optimized / DLL files
24
__pycache__/
35
*.py[cod]

DocsManager/app/core/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Settings(BaseSettings):
3030
minio_secret_key: str
3131
minio_bucket: str = "documents"
3232
minio_use_ssl: bool = True
33+
minio_folder: str = "rag-docs" # Folder within bucket for RAG documents
3334

3435
# Database Configuration (for SQLAlchemy)
3536
database_url: str = ""

DocsManager/app/models/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Models package
1+
"""Models for the DocsManager application."""
2+
23
from app.models.document import Document
34
from app.models.document_chunks import DocumentChunk
4-
from app.models.chat_session import ChatSession
5-
from app.models.chat_message import ChatMessage
65

7-
__all__ = ["Document", "DocumentChunk", "ChatSession", "ChatMessage"]
6+
__all__ = ["Document", "DocumentChunk"]
87

DocsManager/app/services/chatMessage.py

Lines changed: 0 additions & 161 deletions
This file was deleted.

DocsManager/main.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import logging
22
from fastapi import FastAPI
3+
from fastapi.middleware.cors import CORSMiddleware
34

45
from app.api.routes import admin, base
5-
from app.api.routes.chatMessage import router as chat_router
66
from app.core.db_connection import init_db
7+
# Import models to ensure SQLAlchemy can resolve relationships
8+
from app.models import Document, DocumentChunk # noqa: F401
79

810
# Configure logging
911
logging.basicConfig(
@@ -13,10 +15,18 @@
1315

1416
app = FastAPI(title="Docs Manager API", version="0.1.0")
1517

18+
# Configure CORS - Allow any localhost or 127.0.0.1 with any port
19+
app.add_middleware(
20+
CORSMiddleware,
21+
allow_origin_regex=r"https?://(localhost|127\.0\.0\.1)(:\d+)?",
22+
allow_credentials=True,
23+
allow_methods=["*"], # Includes OPTIONS
24+
allow_headers=["*"],
25+
)
26+
1627
# Include routers
1728
app.include_router(base.router)
1829
app.include_router(admin.router)
19-
app.include_router(chat_router)
2030

2131
@app.on_event("startup")
2232
async def startup_event():

DocsManager/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ dependencies = [
1919
"pika>=1.3.0",
2020
"minio>=7.2.0",
2121
"python-multipart>=0.0.6",
22-
"ag-ui-protocol>=0.1.10",
2322
]
2423

2524
[project.scripts]

RAGManager/.dockerignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.venv
2+
__pycache__
3+
*.pyc
4+
*.pyo
5+
*.pyd
6+
.Python
7+
*.so
8+
*.egg
9+
*.egg-info
10+
dist
11+
build
12+
.git
13+
.gitignore
14+
.idea
15+
.vscode
16+
*.swp
17+
*.swo
18+
*~
19+
.DS_Store
20+
.env
21+
.env.local
22+
*.log
23+

RAGManager/Dockerfile

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,31 @@ COPY pyproject.toml uv.lock* ./
1919

2020
RUN uv sync --no-dev --no-cache
2121

22-
# Run the Guardrails configure command to create a .guardrailsrc file
23-
# Only configure if GUARDRAILS_API_KEY is provided
24-
RUN uv run guardrails configure --enable-metrics --enable-remote-inferencing --token "$GUARDRAILS_API_KEY"
25-
26-
# Install required guardrails validators
27-
RUN uv run guardrails hub install hub://guardrails/detect_jailbreak --no-install-local-models
28-
RUN uv run guardrails hub install hub://guardrails/detect_pii --no-install-local-models
29-
RUN uv run guardrails hub install hub://guardrails/toxic_language>=0.0.2 --no-install-local-models
30-
31-
# The ToxicLanguage Validator uses the punkt tokenizer, so we need to download that to a known directory
32-
# Set the directory for nltk data
33-
ENV NLTK_DATA=/opt/nltk_data
34-
35-
# Download punkt data
36-
RUN uv run python -m nltk.downloader -d /opt/nltk_data punkt_tab
22+
# Guardrails disabled for now to speed up builds
23+
# # Run the Guardrails configure command to create a .guardrailsrc file
24+
# # Only configure if GUARDRAILS_API_KEY is provided
25+
# RUN if [ -n "$GUARDRAILS_API_KEY" ]; then \
26+
# uv run guardrails configure --enable-metrics --enable-remote-inferencing --token "$GUARDRAILS_API_KEY"; \
27+
# else \
28+
# echo "Warning: GUARDRAILS_API_KEY not provided, skipping guardrails configuration"; \
29+
# fi
30+
31+
# # Install required guardrails validators
32+
# # Note: Removing --no-install-local-models to ensure Python packages are installed
33+
# RUN uv run guardrails hub install hub://guardrails/detect_jailbreak
34+
# RUN uv run guardrails hub install hub://guardrails/detect_pii
35+
# RUN uv run guardrails hub install hub://guardrails/toxic_language>=0.0.2
36+
37+
# # Verify packages are accessible (this will fail the build if they're not found)
38+
# RUN uv run python -c "from guardrails.hub import DetectJailbreak, DetectPII, ToxicLanguage; print('Guardrails validators imported successfully')"
39+
40+
# NLTK disabled - only needed for guardrails ToxicLanguage validator
41+
# # The ToxicLanguage Validator uses the punkt tokenizer, so we need to download that to a known directory
42+
# # Set the directory for nltk data
43+
# ENV NLTK_DATA=/opt/nltk_data
44+
#
45+
# # Download punkt data
46+
# RUN uv run python -m nltk.downloader -d /opt/nltk_data punkt_tab
3747

3848
COPY . .
3949

RAGManager/app/agents/nodes/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from app.agents.nodes.context_builder import context_builder
55
from app.agents.nodes.fallback_final import fallback_final
66
from app.agents.nodes.fallback_inicial import fallback_inicial
7-
from app.agents.nodes.generator import generator
87
from app.agents.nodes.guard_final import guard_final
98
from app.agents.nodes.guard_inicial import guard_inicial
109
from app.agents.nodes.parafraseo import parafraseo
@@ -15,6 +14,7 @@
1514
"guard_inicial",
1615
"guard_final",
1716
"fallback_inicial",
17+
"fallback_final",
1818
"parafraseo",
1919
"retriever",
2020
"context_builder",

RAGManager/app/agents/nodes/context_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def context_builder(state: AgentState) -> AgentState:
5555
logger.warning("No relevant chunks found for context building")
5656

5757
# Create enriched query combining paraphrased text and context
58-
enriched_query = f"""Pregunta del usuario: {paraphrased}
58+
enriched_query = f"""Pregunta del usuario: {paraphrased}
5959
6060
Contexto relevante de la base de conocimiento:
6161
{context_section}

0 commit comments

Comments
 (0)