diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..c3e015da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +# Use an official Python runtime as a parent image +FROM python:3.10-slim + +# Install build dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +# Set the working directory in the container +WORKDIR /app + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + gcc \ + git \ + && rm -rf /var/lib/apt/lists/* + +# Install Poetry +RUN pip install poetry + +# Copy the project files into the container +COPY pyproject.toml poetry.lock* README.md ./ +COPY gptme ./gptme +COPY static ./static +COPY media ./media + +# Install project dependencies including eval extras +RUN poetry config virtualenvs.create false \ + && poetry install --no-interaction --no-ansi -E server -E browser -E datascience + +# Make port 5000 available to the world outside this container +# (assuming your Flask server runs on port 5000) +EXPOSE 5000 + +# Set environment variable for eval +ENV PYTHONPATH=/app + +# Default command to run the server +CMD ["poetry", "run", "gptme-server"] + +# Add an entry point for running evals +ENTRYPOINT ["poetry", "run", "python", "-m", "gptme.eval.main"] diff --git a/Makefile b/Makefile index d174134c..5da1204e 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ SRCFILES = $(shell find ${SRCDIRS} -name '*.py' $(foreach EXCLUDE,$(EXCLUDES),-n build: poetry install +build-docker: + docker build -t gptme . + test: @# if SLOW is not set, pass `-m "not slow"` to skip slow tests poetry run pytest ${SRCDIRS} -v --log-level INFO --durations=5 \ @@ -77,7 +80,7 @@ release: dist/CHANGELOG.md clean: clean-docs clean-site clean-test -clean-site: +clean-site: rm -rf site/dist clean-docs: diff --git a/poetry.lock b/poetry.lock index b91bcf23..00bb73cd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "accessible-pygments" @@ -495,17 +495,6 @@ files = [ {file = "decorator-5.1.1.tar.gz", hash = "sha256:637996211036b6385ef91435e4fae22989472f9d571faba8927ba8253acbc330"}, ] -[[package]] -name = "diskcache" -version = "5.6.3" -description = "Disk Cache -- Disk and file backed persistent cache." -optional = true -python-versions = ">=3" -files = [ - {file = "diskcache-5.6.3-py3-none-any.whl", hash = "sha256:5e31b2d5fbad117cc363ebaf6b689474db18a1f6438bc82358b024abd4c2ca19"}, - {file = "diskcache-5.6.3.tar.gz", hash = "sha256:2c3a3fa2743d8535d832ec61c2054a1641f41775aa7c556758a109941e33e4fc"}, -] - [[package]] name = "distro" version = "1.9.0" @@ -1177,24 +1166,6 @@ files = [ {file = "kiwisolver-1.4.5.tar.gz", hash = "sha256:e57e563a57fb22a142da34f38acc2fc1a5c864bc29ca1517a88abc963e60d6ec"}, ] -[[package]] -name = "llama-cpp-python" -version = "0.1.85" -description = "A Python wrapper for llama.cpp" -optional = true -python-versions = ">=3.7" -files = [ - {file = "llama_cpp_python-0.1.85.tar.gz", hash = "sha256:9ad2269f47a5fac10e78565e0b4078ea6b8d56ddd3b78892967da4739684db2b"}, -] - -[package.dependencies] -diskcache = ">=5.6.1" -numpy = ">=1.20.0" -typing-extensions = ">=4.5.0" - -[package.extras] -server = ["fastapi (>=0.100.0)", "pydantic-settings (>=2.0.1)", "sse-starlette (>=1.6.1)", "uvicorn (>=0.22.0)"] - [[package]] name = "markdown-it-py" version = "3.0.0" @@ -1671,7 +1642,6 @@ optional = true python-versions = ">=3" files = [ {file = "nvidia_nvjitlink_cu12-12.3.101-py3-none-manylinux1_x86_64.whl", hash = "sha256:64335a8088e2b9d196ae8665430bc6a2b7e6ef2eb877a9c735c804bd4ff6467c"}, - {file = "nvidia_nvjitlink_cu12-12.3.101-py3-none-manylinux2014_aarch64.whl", hash = "sha256:211a63e7b30a9d62f1a853e19928fbb1a750e3f17a13a3d1f98ff0ced19478dd"}, {file = "nvidia_nvjitlink_cu12-12.3.101-py3-none-win_amd64.whl", hash = "sha256:1b2e317e437433753530792f13eece58f0aec21a2b05903be7bffe58a606cbd1"}, ] @@ -2432,7 +2402,6 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -3490,13 +3459,13 @@ files = [ ] [extras] -all = ["flask", "llama-cpp-python", "matplotlib", "numpy", "pandas", "pillow", "playwright", "torch", "transformers"] +all = ["flask", "matplotlib", "numpy", "pandas", "pillow", "playwright", "torch", "transformers"] browser = ["playwright"] datascience = ["matplotlib", "numpy", "pandas", "pillow"] -server = ["flask", "llama-cpp-python"] +server = ["flask"] training = ["torch", "transformers"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "3a70a3cbba9b00ce58e598953c71d5af5db72087311c2750d46bba4605695742" +content-hash = "5391ff22a43c920087bb50555c9f2060d243130d947007a37dc30e5e3a7e1bf3" diff --git a/pyproject.toml b/pyproject.toml index b5b8e2ec..b55470e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,6 @@ openai = "^1.0" anthropic = "^0.34.0" # optionals -llama-cpp-python = {version = "^0.1.57", optional=true} playwright = {version = "^1.37.0", optional=true} jedi = {version = "^0.19.0", optional=true} @@ -74,13 +73,13 @@ types-tabulate = "^0.9.0.20240106" pytest-retry = "^1.6.3" [tool.poetry.extras] -server = ["llama-cpp-python", "flask"] +server = ["flask"] browser = ["playwright"] datascience = ["matplotlib", "pandas", "numpy", "pillow"] training = ["torch", "transformers"] all = [ # server - "llama-cpp-python", "flask", + "flask", # browser "playwright", # datascience