Skip to content
Open
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
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python
{
"name": "RAG Chat API",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
80,
8000
],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Configure tool-specific properties.
"customizations": {
// "jetbrains" : {
// "backend" : "PyCharm"
// }
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
26 changes: 13 additions & 13 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.git
.gitignore
.github
.chat-env
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
.venv/
.env
.git
.gitignore
.github
.chat-env
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
.venv/
.env
*.log
46 changes: 23 additions & 23 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint api.py
name: Pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint api.py
45 changes: 25 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
.DS_Store
*.pyc
__pycache__/
# .chat-env/
*.env
*.env.*
*.ipynb_checkpoints
*.log
*.sqlite3
*.db
*.db-journal
*.db-wal
*.db-shm
*.egg-info/
*.egg
*.egg-info/
responses/
db/knowledge_base/*
db/chroma/*
*.md
.DS_Store
*.pyc
__pycache__/
.chat_env/
.chat-env/
*.env
*.env.*
*.ipynb_checkpoints
*.log
*.sqlite3
*.db
*.db-journal
*.db-wal
*.db-shm
*.egg-info/
*.egg
*.egg-info/
responses/
db/knowledge_base/*
db/chroma/*
*.md
.secrets/
.idea/
fine-tuning.ipynb

86 changes: 43 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
FROM python:3.12-slim

WORKDIR /app

# Set environment variables
ENV APP_NAME=rag_chat_api
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libmagic1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Create necessary directories with proper permissions
RUN mkdir -p db/chroma && \
chmod -R 755 db

# IMPORTANT: Copy and install requirements first
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy pre-built ChromaDB (if it exists locally)
COPY db/chroma /app/db/chroma

# Set proper permissions for the ChromaDB
RUN chmod -R 755 /app/db/chroma

# Copy configuration files
COPY .env.prod ./.env.prod
COPY docker-entrypoint.sh ./
RUN chmod +x ./docker-entrypoint.sh

# Copy source code
COPY embeddings.py api.py ./

# Expose the API port
EXPOSE 8000

# Command to run the application
ENTRYPOINT ["./docker-entrypoint.sh"]
FROM python:3.12-slim
WORKDIR /app
# Set environment variables
ENV APP_NAME=rag_chat_api
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libmagic1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Create necessary directories with proper permissions
RUN mkdir -p db/chroma && \
chmod -R 755 db
# IMPORTANT: Copy and install requirements first
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy pre-built ChromaDB (if it exists locally)
COPY db/chroma /app/db/chroma
# Set proper permissions for the ChromaDB
RUN chmod -R 755 /app/db/chroma
# Copy configuration files
COPY .env.prod ./.env
#COPY docker-entrypoint.sh ./app
#RUN chmod +x ./app/docker-entrypoint.sh
# Copy source code
COPY embeddings.py api.py ./
# Expose the API port
EXPOSE 8000
# Command to run the application
#ENTRYPOINT ["./app/docker-entrypoint.sh"]
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]
Loading