diff --git a/app/core/config.py b/app/core/config.py index 3ba1998..5179151 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -78,6 +78,8 @@ class Settings(BaseSettings): GEMINI_API_KEY: str = "secret" + SYSTEM_PROMPT: str = "You are a helpful assistant that answers questions based on the provided context." + model_config = SettingsConfigDict( env_file=ENV_FILE, env_file_encoding="utf-8", diff --git a/app/services/rag_service.py b/app/services/rag_service.py index 05a5cd0..df6c965 100644 --- a/app/services/rag_service.py +++ b/app/services/rag_service.py @@ -8,8 +8,10 @@ from PyPDF2 import PdfReader from PyPDF2.errors import PyPdfError from structlog import get_logger +from app.core.config import settings from app.core.interfaces import EmbeddingModel, Reranker, VectorDB from app.core.utils import RecursiveCharacterTextSplitter +from app.schemas.enums import LLMModelName logger = get_logger() @@ -108,11 +110,11 @@ Answer:""" try: response = litellm.completion( - model="gemini/gemini-2.0-flash", + model=LLMModelName.GeminiFlash.value, messages=[ { "role": "system", - "content": "You are a helpful assistant that answers questions based on the provided context.", + "content": settings.SYSTEM_PROMPT, }, { "role": "user", @@ -157,11 +159,11 @@ Answer:""" try: response = litellm.completion( - model="gemini/gemini-2.0-flash", + model=LLMModelName.GeminiFlash.value, messages=[ { "role": "system", - "content": "You are a helpful assistant that answers questions based on the provided context.", + "content": settings.SYSTEM_PROMPT, }, { "role": "user", diff --git a/scripts/create_tables.py b/scripts/create_tables.py index a96ce71..81287c2 100644 --- a/scripts/create_tables.py +++ b/scripts/create_tables.py @@ -23,7 +23,6 @@ structlog.configure( structlog.processors.StackInfoRenderer(), structlog.dev.ConsoleRenderer(), ], - wrapper_class=structlog.make_filtering_bound_logger(structlog.INFO), context_class=dict, logger_factory=structlog.PrintLoggerFactory(), cache_logger_on_first_use=False,