AnatoliiG commited on
Commit ·
5c8b266
1
Parent(s): e5ebe08
fix docker + add check in app
Browse files- Dockerfile +3 -4
- app.py +3 -0
Dockerfile
CHANGED
|
@@ -3,9 +3,8 @@ FROM python:3.10-slim-bookworm
|
|
| 3 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 4 |
build-essential \
|
| 5 |
cmake \
|
| 6 |
-
|
| 7 |
libgomp1 \
|
| 8 |
-
git \
|
| 9 |
curl \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
@@ -19,8 +18,8 @@ WORKDIR /app
|
|
| 19 |
|
| 20 |
RUN pip install --no-cache-dir --upgrade pip
|
| 21 |
|
| 22 |
-
RUN pip install --
|
| 23 |
-
https://github.
|
| 24 |
|
| 25 |
COPY --chown=user requirements.txt .
|
| 26 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 4 |
build-essential \
|
| 5 |
cmake \
|
| 6 |
+
libopenblas-dev \
|
| 7 |
libgomp1 \
|
|
|
|
| 8 |
curl \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
|
|
|
| 18 |
|
| 19 |
RUN pip install --no-cache-dir --upgrade pip
|
| 20 |
|
| 21 |
+
RUN pip install llama-cpp-python \
|
| 22 |
+
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 23 |
|
| 24 |
COPY --chown=user requirements.txt .
|
| 25 |
RUN pip install --no-cache-dir -r requirements.txt
|
app.py
CHANGED
|
@@ -42,6 +42,9 @@ async def chat_completions(request: Request):
|
|
| 42 |
temperature = data.get("temperature", 0.2)
|
| 43 |
max_tokens = data.get("max_tokens", 2048)
|
| 44 |
|
|
|
|
|
|
|
|
|
|
| 45 |
output = llm.create_chat_completion(
|
| 46 |
messages=messages, max_tokens=max_tokens, temperature=temperature, stream=stream
|
| 47 |
)
|
|
|
|
| 42 |
temperature = data.get("temperature", 0.2)
|
| 43 |
max_tokens = data.get("max_tokens", 2048)
|
| 44 |
|
| 45 |
+
if not messages:
|
| 46 |
+
return JSONResponse(content={"error": "No messages provided"}, status_code=400)
|
| 47 |
+
|
| 48 |
output = llm.create_chat_completion(
|
| 49 |
messages=messages, max_tokens=max_tokens, temperature=temperature, stream=stream
|
| 50 |
)
|