Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update dependencies (python, fastapi, langchain, openai) #15

Merged
merged 6 commits into from
Aug 21, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
cache: 'pip'
- run: pip install -r requirements.txt
- run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.9-slim
FROM python:3.12.3-slim

RUN useradd -s /bin/bash python

Expand Down
35 changes: 18 additions & 17 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dnspython==2.6.1
docker==7.0.0
email_validator==2.1.1
exceptiongroup==1.2.0
fastapi==0.110.1
fastapi==0.112.1
filelock==3.13.4
fonttools==4.51.0
frozenlist==1.4.1
Expand All @@ -41,19 +41,19 @@ inflect==5.6.2
iniconfig==2.0.0
isort==5.13.2
Jinja2==3.1.4
jiter==0.5.0
jsonpatch==1.33
jsonpointer==2.4
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
kiwisolver==1.4.5
langchain==0.1.16
langchain-community==0.0.33
langchain-core==0.1.44
langchain-experimental==0.0.57
langchain-mongodb==0.1.3
langchain-openai==0.1.1
langchain-text-splitters==0.0.1
langsmith==0.1.39
langchain==0.2.14
langchain-community==0.2.12
langchain-core==0.2.33
langchain-experimental==0.0.64
langchain-openai==0.1.22
langchain-text-splitters==0.2.2
langsmith==0.1.99
MarkupSafe==2.1.5
marshmallow==3.21.1
matplotlib==3.8.4
Expand All @@ -62,21 +62,21 @@ multidict==6.0.5
mypy-extensions==1.0.0
nodeenv==1.8.0
numpy==1.26.4
openai==1.16.1
openai==1.41.1
orjson==3.10.0
packaging==23.2
pathspec==0.12.1
pillow==10.3.0
platformdirs==4.2.0
pluggy==1.4.0
pluggy==1.5.0
pre-commit==3.7.0
prometheus_client==0.20.0
pydantic==2.6.4
pydantic_core==2.16.3
pydantic==2.8.2
pydantic_core==2.20.1
pylint==3.1.0
pymongo==4.6.3
pymongo==4.8.0
pyparsing==3.1.2
pytest==8.1.1
pytest==8.3.2
pytest-asyncio==0.23.6
pytest-cov==5.0.0
pytest-snapshot==0.9.0
Expand All @@ -90,19 +90,20 @@ requests==2.32.0
responses==0.25.0
respx==0.21.1
rpds-py==0.18.0
setuptools==73.0.0
six==1.16.0
sniffio==1.3.1
SQLAlchemy==2.0.29
starlette==0.37.2
tavily-python==0.3.3
tenacity==8.2.3
testcontainers==4.4.0
tiktoken==0.6.0
tiktoken==0.7.0
tomli==2.0.1
tomlkit==0.12.4
tqdm==4.66.3
typing-inspect==0.9.0
typing_extensions==4.10.0
typing_extensions==4.12.2
urllib3==2.2.1
uvicorn==0.29.0
virtualenv==20.25.1
Expand Down
1 change: 0 additions & 1 deletion src/application/assistance/chains/assistant_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,3 @@ def _process_chat_history(self, chat_history: List[str]) -> str:
"""

return ""

2 changes: 1 addition & 1 deletion src/application/assistance/chains/retriever_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from langchain_core.callbacks import CallbackManagerForChainRun
from langchain_core.embeddings import Embeddings
from langchain_core.runnables import RunnableConfig
from langchain_mongodb import MongoDBAtlasVectorSearch
from langchain_community.vectorstores.mongodb_atlas import MongoDBAtlasVectorSearch
from pydantic import BaseModel, create_model

from src.context import AppContext
Expand Down
6 changes: 3 additions & 3 deletions tests/src/application/assistance/assistance_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_init_with_db_name_from_uri(app_context):
pytest.fail("Creating instance of AssistantService failed")

@patch(
'langchain_mongodb.MongoDBAtlasVectorSearch._similarity_search_with_score',
'langchain_community.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch._similarity_search_with_score',
)
def test_chat_completion(
similarity_search_with_score,
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_chat_completion(
assert result.response == chat_completion_reply_mock['choices'][0]['message']['content']

@patch(
'langchain_mongodb.MongoDBAtlasVectorSearch._similarity_search_with_score',
'langchain_community.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch._similarity_search_with_score',
)
def test_chat_completion_with_custom_template(
similarity_search_with_score,
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_chat_completion_with_custom_template(
assert result.response == chat_completion_reply_mock['choices'][0]['message']['content']

@patch(
'langchain_mongodb.MongoDBAtlasVectorSearch._similarity_search_with_score',
'langchain_community.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch._similarity_search_with_score',
)
def test_chat_completion_with_prompts_from_file(
similarity_search_with_score,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def setup_test(
return mock_similar_documents, inputs, chain

@patch(
'langchain_mongodb.MongoDBAtlasVectorSearch._similarity_search_with_score',
'langchain_community.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch._similarity_search_with_score',
)
def test_call(
similarity_search_with_score,
Expand All @@ -89,7 +89,7 @@ def test_call(
assert doc.metadata['score'] == 0.5

@patch(
'langchain_mongodb.MongoDBAtlasVectorSearch._similarity_search_with_score',
'langchain_community.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch._similarity_search_with_score',
)
def test_call_with_max_distance(
similarity_search_with_score,
Expand All @@ -108,7 +108,7 @@ def test_call_with_max_distance(
assert post_filter_call_arg[0]["$match"]["score"]["$lte"] == 0.5

@patch(
'langchain_mongodb.MongoDBAtlasVectorSearch._similarity_search_with_score',
'langchain_community.vectorstores.mongodb_atlas.MongoDBAtlasVectorSearch._similarity_search_with_score',
)
def test_call_with_min_distance(
similarity_search_with_score,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"level": 50, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}
{"taskName": null, "level": 50, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"level": 10, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}
{"taskName": null, "level": 10, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"level": 40, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}
{"taskName": null, "level": 40, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"level": 20, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}
{"taskName": null, "level": 20, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"level": 30, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}
{"taskName": null, "level": 30, "msg": "Test log message", "time": 1628000000000, "pid": 1234, "hostname": "mocked_hostname"}