diff --git a/rag-metrics.py b/rag-metrics.py index 01e091c..bd21877 100644 --- a/rag-metrics.py +++ b/rag-metrics.py @@ -26,7 +26,7 @@ ResponseRelevancy, ) -from src.app.api.dependencies import get_settings +from src.app.shared.utils.dependencies import get_settings from src.app.services.abst_chat import AbstractChat logger = logging.getLogger(__name__) diff --git a/src/app/api/api_v1/endpoints/chat.py b/src/app/api/api_v1/endpoints/chat.py index 7d30733..33de1f8 100644 --- a/src/app/api/api_v1/endpoints/chat.py +++ b/src/app/api/api_v1/endpoints/chat.py @@ -11,7 +11,7 @@ from psycopg.rows import dict_row from pydantic import BaseModel -from src.app.api.dependencies import get_settings +from src.app.shared.utils.dependencies import get_settings from src.app.models import chat as models from src.app.services.abst_chat import get_chat_service from src.app.services.constants import subjects as subjectsDict diff --git a/src/app/api/api_v1/endpoints/metric.py b/src/app/api/api_v1/endpoints/metric.py index 5968b81..b52fa61 100644 --- a/src/app/api/api_v1/endpoints/metric.py +++ b/src/app/api/api_v1/endpoints/metric.py @@ -2,7 +2,7 @@ from pydantic import ValidationError from starlette.concurrency import run_in_threadpool -from src.app.api.dependencies import get_settings +from src.app.shared.utils.dependencies import get_settings from src.app.models.metric import DocumentClickUpdateResponse, RowCorpusQtyDocInfo from src.app.services.data_collection import get_data_collection_service from src.app.services.sql_db.queries import get_document_qty_table_info_sync diff --git a/src/app/api/api_v1/endpoints/tutor.py b/src/app/api/api_v1/endpoints/tutor.py index a8a6325..d51a44e 100644 --- a/src/app/api/api_v1/endpoints/tutor.py +++ b/src/app/api/api_v1/endpoints/tutor.py @@ -11,7 +11,7 @@ UploadFile, ) -from src.app.api.dependencies import get_settings +from src.app.shared.utils.dependencies import get_settings from src.app.core.config import Settings from src.app.models.search import EnhancedSearchQuery from src.app.services.abst_chat import get_chat_service diff --git a/src/app/api/shared/__init__.py b/src/app/api/api_v1/tutor/__init__.py similarity index 100% rename from src/app/api/shared/__init__.py rename to src/app/api/api_v1/tutor/__init__.py diff --git a/src/app/core/config.py b/src/app/core/config.py index 3a22d6e..b1194b8 100644 --- a/src/app/core/config.py +++ b/src/app/core/config.py @@ -22,10 +22,10 @@ class Settings(BaseSettings): BACKEND_CORS_ORIGINS_REGEX: str = CLIENT_ORIGINS_REGEX DATA_COLLECTION_ORIGIN_PREFIX: str - def get_api_version(self, cls): + def get_api_version(self) -> dict: return { - "title": cls.PROJECT_NAME, - "api_version": cls.API_V1_STR, + "title": self.PROJECT_NAME, + "api_version": self.API_V1_STR, "semver": "0.1.0", } diff --git a/src/app/core/lifespan.py b/src/app/core/lifespan.py index 2118c58..1521d61 100644 --- a/src/app/core/lifespan.py +++ b/src/app/core/lifespan.py @@ -5,7 +5,7 @@ from fastapi import FastAPI from qdrant_client import AsyncQdrantClient -from src.app.api.dependencies import get_settings +from src.app.shared.utils.dependencies import get_settings from src.app.services.llm_proxy import LLMProxy diff --git a/src/app/services/abst_chat.py b/src/app/services/abst_chat.py index dbaa38d..225f681 100644 --- a/src/app/services/abst_chat.py +++ b/src/app/services/abst_chat.py @@ -26,7 +26,7 @@ from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver # type: ignore from langgraph.prebuilt import create_react_agent # type: ignore -from src.app.api.dependencies import get_settings +from src.app.shared.utils.dependencies import get_settings from src.app.models.chat import ReformulatedQueryResponse from src.app.models.documents import Document from src.app.services import prompts diff --git a/src/app/services/data_collection.py b/src/app/services/data_collection.py index 506589f..96609a2 100644 --- a/src/app/services/data_collection.py +++ b/src/app/services/data_collection.py @@ -8,7 +8,7 @@ from fastapi.concurrency import run_in_threadpool from qdrant_client.models import ScoredPoint -from src.app.api.dependencies import get_settings +from src.app.shared.utils.dependencies import get_settings from src.app.models.documents import Document from src.app.services.sql_db.queries import ( get_current_data_collection_campaign, diff --git a/src/app/services/sql_db/sql_service.py b/src/app/services/sql_db/sql_service.py index d897e8a..e1adc80 100644 --- a/src/app/services/sql_db/sql_service.py +++ b/src/app/services/sql_db/sql_service.py @@ -3,7 +3,7 @@ from sqlalchemy import URL, create_engine from sqlalchemy.orm import sessionmaker -from src.app.api.dependencies import get_settings +from src.app.shared.utils.dependencies import get_settings from src.app.utils.decorators import singleton settings = get_settings() diff --git a/src/app/services/tutor/utils.py b/src/app/services/tutor/utils.py index 2563ef5..4cc0407 100644 --- a/src/app/services/tutor/utils.py +++ b/src/app/services/tutor/utils.py @@ -5,7 +5,7 @@ from pypdf import PdfReader from qdrant_client.models import ScoredPoint -from src.app.api.dependencies import get_settings +from src.app.shared.utils.dependencies import get_settings from src.app.services.pdf_extractor import extract_txt_from_pdf_with_tika from src.app.utils.decorators import log_time_and_error_sync diff --git a/src/app/api/shared/enpoints/__init__.py b/src/app/shared/__init__.py similarity index 100% rename from src/app/api/shared/enpoints/__init__.py rename to src/app/shared/__init__.py diff --git a/src/app/shared/api/__init__.py b/src/app/shared/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/app/api/shared/enpoints/health.py b/src/app/shared/api/health.py similarity index 97% rename from src/app/api/shared/enpoints/health.py rename to src/app/shared/api/health.py index 959822b..36d556c 100644 --- a/src/app/api/shared/enpoints/health.py +++ b/src/app/shared/api/health.py @@ -4,7 +4,7 @@ from fastapi import APIRouter, HTTPException, status from pydantic import BaseModel -from src.app.api.dependencies import ConfigDepend +from src.app.shared.utils.dependencies import ConfigDepend router = APIRouter() diff --git a/src/app/shared/utils/__init__.py b/src/app/shared/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/app/api/dependencies.py b/src/app/shared/utils/dependencies.py similarity index 100% rename from src/app/api/dependencies.py rename to src/app/shared/utils/dependencies.py diff --git a/src/main.py b/src/main.py index a7e9dcb..cfe1e37 100644 --- a/src/main.py +++ b/src/main.py @@ -12,7 +12,7 @@ from starlette.exceptions import HTTPException as StarletteHTTPException from src.app.api.api_v1.api import api_router, api_tags_metadata -from src.app.api.shared.enpoints import health +from src.app.shared.api import health from src.app.core.config import settings from src.app.core.lifespan import lifespan from src.app.middleware.monitor_requests import MonitorRequestsMiddleware