Skip to content
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
31 changes: 31 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.git/
.gitignore
.github/
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
*.so
*.egg
*.egg-info/
dist/
build/
*.egg-info/
.eggs/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.log
.pytest_cache/
.env
.venv/
env/
venv/
ENV/
.idea/
.vscode/
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Build stage
FROM python:3.12-slim AS builder

# Define build argument with default value
ARG PORT=8000
# Make it available as env variable at runtime
ENV OPTILLM_PORT=$PORT

# Set working directory
WORKDIR /app

Expand Down Expand Up @@ -43,8 +48,8 @@ USER appuser
# Set environment variables
ENV PYTHONUNBUFFERED=1

# Expose the port the app runs on
EXPOSE 8000
# Use the ARG in EXPOSE
EXPOSE ${PORT}

# Run the application
CMD ["optillm"]
ENTRYPOINT ["python", "optillm.py"]
8 changes: 5 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ services:
dockerfile: Dockerfile
tags:
- optillm:latest
args:
- PORT=${OPTILLM_PORT:-8000}
image: optillm:latest
container_name: *name
hostname: *name
ports:
- "8000:8000"
- "${OPTILLM_PORT:-8000}:${OPTILLM_PORT:-8000}"
env_file:
- .env
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY:-""}
OPTILLM_PORT: ${OPTILLM_PORT:-8000}
# OPTILLM_BASE_URL: ${OPENAI_BASE_URL:-"https://openrouter.ai/api/v1"} # can be set to any OpenAI API compatible endpoint
# OPTILLM_API_KEY: ${OPTILLM_API_KEY:-} # optionally sets an API key for Optillm clients
# Uncomment and set values for other arguments (prefixed with OPTILLM_) as needed, e.g.:
Expand All @@ -29,11 +32,10 @@ services:
# OPTILLM_RSTAR_C: 1.4
# OPTILLM_N: 1
# OPTILLM_RETURN_FULL_RESPONSE: false
# OPTILLM_PORT: 8000
restart: on-failure
stop_grace_period: 2s
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8000/health"]
test: ["CMD", "curl", "-f", "http://127.0.0.1:${OPTILLM_PORT:-8000}/health"]
interval: 30s
timeout: 5s
retries: 3
Expand Down
2 changes: 1 addition & 1 deletion optillm/plugins/readurls_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def extract_urls(text: str) -> List[str]:
def fetch_webpage_content(url: str, max_length: int = 100000) -> str:
try:
headers = {
'User-Agent': 'optillm/0.0.20 (https://github.com/codelion/optillm)'
'User-Agent': 'optillm/0.0.21 (https://github.com/codelion/optillm)'
}

response = requests.get(url, headers=headers, timeout=10)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="optillm",
version="0.0.20",
version="0.0.21",
packages=find_packages(),
py_modules=['optillm'],
package_data={
Expand Down