Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files- Dockerfile +2 -1
- trim_messages_hook.py +2 -4
Dockerfile
CHANGED
|
@@ -6,6 +6,7 @@ USER user
|
|
| 6 |
ENV HOME=/home/user \
|
| 7 |
PATH=/home/user/.local/bin:$PATH
|
| 8 |
WORKDIR $HOME/app
|
|
|
|
| 9 |
|
| 10 |
# Install LiteLLM
|
| 11 |
RUN pip install --no-cache-dir 'litellm[proxy]'
|
|
@@ -20,4 +21,4 @@ EXPOSE 7860
|
|
| 20 |
|
| 21 |
# PORT from env (Render); default 7860 for Hugging Face Spaces
|
| 22 |
ENTRYPOINT ["/bin/sh", "-c"]
|
| 23 |
-
CMD ["exec litellm --config config.yaml --port ${PORT:-7860} --host 0.0.0.0"]
|
|
|
|
| 6 |
ENV HOME=/home/user \
|
| 7 |
PATH=/home/user/.local/bin:$PATH
|
| 8 |
WORKDIR $HOME/app
|
| 9 |
+
ENV PYTHONPATH=/home/user/app
|
| 10 |
|
| 11 |
# Install LiteLLM
|
| 12 |
RUN pip install --no-cache-dir 'litellm[proxy]'
|
|
|
|
| 21 |
|
| 22 |
# PORT from env (Render); default 7860 for Hugging Face Spaces
|
| 23 |
ENTRYPOINT ["/bin/sh", "-c"]
|
| 24 |
+
CMD ["exec litellm --config /home/user/app/config.yaml --port ${PORT:-7860} --host 0.0.0.0"]
|
trim_messages_hook.py
CHANGED
|
@@ -8,8 +8,6 @@ import os
|
|
| 8 |
from typing import Any, Literal, Optional
|
| 9 |
|
| 10 |
from litellm.integrations.custom_logger import CustomLogger
|
| 11 |
-
from litellm.proxy.proxy_server import UserAPIKeyAuth
|
| 12 |
-
from litellm.types.utils import DualCache
|
| 13 |
|
| 14 |
# Max tokens allowed for the messages array (input). Leaves room for output + tools.
|
| 15 |
# Stay under 128k so common models don't hit context limit.
|
|
@@ -22,8 +20,8 @@ class TrimMessagesHandler(CustomLogger):
|
|
| 22 |
|
| 23 |
async def async_pre_call_hook(
|
| 24 |
self,
|
| 25 |
-
user_api_key_dict:
|
| 26 |
-
cache:
|
| 27 |
data: dict[str, Any],
|
| 28 |
call_type: Literal[
|
| 29 |
"completion",
|
|
|
|
| 8 |
from typing import Any, Literal, Optional
|
| 9 |
|
| 10 |
from litellm.integrations.custom_logger import CustomLogger
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Max tokens allowed for the messages array (input). Leaves room for output + tools.
|
| 13 |
# Stay under 128k so common models don't hit context limit.
|
|
|
|
| 20 |
|
| 21 |
async def async_pre_call_hook(
|
| 22 |
self,
|
| 23 |
+
user_api_key_dict: Any,
|
| 24 |
+
cache: Any,
|
| 25 |
data: dict[str, Any],
|
| 26 |
call_type: Literal[
|
| 27 |
"completion",
|