mirror of
https://github.com/BerriAI/litellm.git
synced 2025-12-06 11:33:26 +08:00
* Fix Bedrock guardrail apply_guardrail method and test mocks
Fixed 4 failing tests in the guardrail test suite:
1. BedrockGuardrail.apply_guardrail now returns original texts when guardrail
allows content but doesn't provide output/outputs fields. Previously returned
empty list, causing test_bedrock_apply_guardrail_success to fail.
2. Updated test mocks to use correct Bedrock API response format:
- Changed from 'content' field to 'output' field
- Fixed nested structure from {'text': {'text': '...'}} to {'text': '...'}
- Added missing 'output' field in filter test
3. Fixed endpoint test mocks to return GenericGuardrailAPIInputs format:
- Changed from tuple (List[str], Optional[List[str]]) to dict {'texts': [...]}
- Updated method call assertions to use 'inputs' parameter correctly
All 12 guardrail tests now pass successfully.
* fix: remove python3-dev from Dockerfile.build_from_pip to avoid Python version conflict
The base image cgr.dev/chainguard/python:latest-dev already includes Python 3.14
and its development tools. Installing python3-dev pulls Python 3.13 packages
which conflict with the existing Python 3.14 installation, causing file
ownership errors during apk install.
* fix: disable callbacks in vertex fine-tuning tests to prevent Datadog logging interference
The test was failing because Datadog logging was making an HTTP POST request
that was being caught by the mock, causing assert_called_once() to fail.
By disabling callbacks during the test, we prevent Datadog from making any
HTTP calls, allowing the mock to only see the Vertex AI API call.
* fix: ensure test isolation in test_logging_non_streaming_request
Add proper cleanup to restore original litellm.callbacks after test execution.
This prevents test interference when running as part of a larger test suite,
where global state pollution was causing async_log_success_event to be
called multiple times instead of once.
Fixes test failure where the test expected async_log_success_event to be
called once but was being called twice due to callbacks from previous tests
not being cleaned up.
32 lines
877 B
Docker
32 lines
877 B
Docker
FROM cgr.dev/chainguard/python:latest-dev
|
|
|
|
USER root
|
|
WORKDIR /app
|
|
|
|
ENV HOME=/home/litellm
|
|
ENV PATH="${HOME}/venv/bin:$PATH"
|
|
|
|
# Install runtime dependencies
|
|
# Note: The base image has Python 3.14, but python3-dev installs Python 3.13 which conflicts.
|
|
# The -dev variant should include Python headers, but if compilation fails, we may need
|
|
# to install python-3.14-dev specifically (if available in the repo)
|
|
RUN apk update && \
|
|
apk add --no-cache gcc openssl openssl-dev
|
|
|
|
RUN python -m venv ${HOME}/venv
|
|
RUN ${HOME}/venv/bin/pip install --no-cache-dir --upgrade pip
|
|
|
|
COPY docker/build_from_pip/requirements.txt .
|
|
RUN --mount=type=cache,target=${HOME}/.cache/pip \
|
|
${HOME}/venv/bin/pip install -r requirements.txt
|
|
|
|
# Copy Prisma schema file
|
|
COPY schema.prisma .
|
|
|
|
# Generate prisma client
|
|
RUN prisma generate
|
|
|
|
EXPOSE 4000/tcp
|
|
|
|
ENTRYPOINT ["litellm"]
|
|
CMD ["--port", "4000"] |