Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM python:3.12-slim AS requirements-stage
ARG PYTHON_VERSION=3.14

FROM python:${PYTHON_VERSION}-slim AS requirements-stage
WORKDIR /tmp

RUN pip install poetry==1.8.2
Expand All @@ -12,7 +14,7 @@ COPY ./pyproject.toml ./poetry.lock* /tmp/

RUN poetry export -f requirements.txt --output requirements.txt --without-hashes --with dev --without metrics

FROM python:3.12-slim AS build-stage
FROM python:${PYTHON_VERSION}-slim AS build-stage
WORKDIR /app
RUN apt update && apt install -y --no-install-recommends make

Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
services:
web:
container_name: welearn-api
build: .
build:
context: .
args:
PYTHON_VERSION: ${PYTHON_VERSION:-3.14}
command: uvicorn src.main:app --host 0.0.0.0
network_mode: host
volumes:
Expand Down
7,111 changes: 3,474 additions & 3,637 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
python = ">=3.12,<3.15"
azure-core = "^1.38.0"
backoff = "^2.2.1"
ecologits = "^0.5.2"
Expand All @@ -25,14 +25,14 @@ requests = "^2.32.4"
scikit-learn = "^1.5.1"
sqlalchemy = "^2.0.35"
transformers="^4.50.0"
torch = {version = "^2.2.2+cpu", source = "pytorch_cpu"}
torchvision = {version = "^0.17.2+cpu", source = "pytorch_cpu"}
torch = {version = "2.9.1+cpu", source = "pytorch_cpu"}
torchvision = {version = "0.24.1+cpu", source = "pytorch_cpu"}
uvicorn = {extras = ["standard"], version = "^0.29.0"}
autogen-core = "^0.5.7"
autogen-ext = "^0.5.7"
autogen-agentchat = "^0.5.7"
pypdf = "^6.6.0"
numpy = "^1.26.4"
numpy = "^2.1.0"
python-docx = "^1.1.2"
langchain-core = "^1.3.2"
langgraph-checkpoint-postgres = "^2.0.23"
Expand All @@ -51,7 +51,7 @@ langchain-mistralai = "^1.1.2"
langchain-azure-ai = "^1.2.3"
langgraph = "^1.1.10"
mistralai = "^2.4.3"
langsmith = "^0.9.3"
langsmith = "^0.10.11"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.0"
Expand Down
5 changes: 3 additions & 2 deletions src/app/services/sql_db/sql_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ def _create_session(self):
return Session


wl_sql = WL_SQL()
session_maker = wl_sql.session_maker
def session_maker():
# Defer DB engine creation until a session is actually needed.
return WL_SQL().session_maker()
1 change: 0 additions & 1 deletion src/app/shared/infra/tracing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from enum import Enum


TRACE_RUN_TYPE_LLM = "llm"


Expand Down
5 changes: 3 additions & 2 deletions src/app/tests/services/test_abst_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ async def test_get_new_questions(self):
with mock.patch.object(
self.chat, "_detect_language", new_callable=mock.AsyncMock
) as mock_detect_lang:
mock_detect_lang.return_value = {"ISO_CODE": "en"}
self.chat.chat_client.completion = mock.AsyncMock(
return_value="%%Question 1?%% Question 2?%%",
)
Expand All @@ -145,7 +146,7 @@ async def test_get_new_questions(self):

async def test_rephrase_message_stream_false(self):
self.chat.chat_client.completion = mock.AsyncMock()
self.chat.chat_client.completion_stream = mock.AsyncMock()
self.chat.chat_client.completion_stream = mock.Mock()
await self.chat.rephrase_message(
message="this is the user query", history=[], docs=[], subject="default"
)
Expand All @@ -154,7 +155,7 @@ async def test_rephrase_message_stream_false(self):

async def test_rephrase_message_stream_true(self):
self.chat.chat_client.completion = mock.AsyncMock()
self.chat.chat_client.completion_stream = mock.AsyncMock()
self.chat.chat_client.completion_stream = mock.AsyncMock(return_value=iter(()))
await self.chat.rephrase_message(
message="this is the user query",
history=[],
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/services/test_pdf_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TestPDFExtractorAsync(unittest.IsolatedAsyncioTestCase):
async def test_send_pdf_to_tika(self, mock_get_client):
# Mock du client HTTPX asynchrone
mock_client = AsyncMock()
mock_response = AsyncMock()
mock_response = Mock()
mock_response.json = Mock(
return_value={"X-TIKA:content": "<html>Mock Content</html>"}
)
Expand Down
Loading