diff --git a/.gitignore b/.gitignore index 50fb8af..7374397 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,11 @@ # Byte-compiled / optimized / DLL files __pycache__/ +*. *.py[cod] *$py.class +temp_index/ + # C extensions *.so diff --git a/README.md b/README.md index 4d8b381..5557de0 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,6 @@ WandBot is a question-answering bot designed specifically for Weights & Biases M ## What's New ### wandbot v1.3.0 -Note that to trigger the final initalization after running `run.sh`, a request has to be made to the `/startup` endpoint, as tiggering the heavy initialzations during app startup causes replit to timeout: - -```bash -curl https://wandbot.replit.app/startup -``` **New:** - **Move to uv for package management**: Installs and dependency checks cut down from minutes to seconds diff --git a/download_vectordb_index.py b/download_vectordb_index.py index 8ef2ecc..e76dd64 100644 --- a/download_vectordb_index.py +++ b/download_vectordb_index.py @@ -28,6 +28,7 @@ class Config: api = wandb.Api() art = api.artifact(config.artifact_url) # Download vectordb index from W&B print(f"Downloading index to {config.index_dir}") +os.makedirs(config.index_dir, exist_ok=True) save_dir = art.download(config.index_dir) print(f"Downloaded index to {save_dir}") \ No newline at end of file diff --git a/e2b.Dockerfile b/e2b.Dockerfile index ed688a9..e8c5402 100644 --- a/e2b.Dockerfile +++ b/e2b.Dockerfile @@ -2,7 +2,7 @@ FROM e2bdev/code-interpreter:latest # Set working directory -WORKDIR /workspace +WORKDIR /home/user # Install Python 3.12 and set it as default RUN apt-get update && apt-get install -y \ @@ -23,32 +23,33 @@ RUN apt-get update && apt-get install -y \ # to invalidate the cache from here and trigger a fresh git pull and build from here ARG WANDBOT_COMMIT ARG CACHE_BUST=1 -RUN git clone https://github.com/wandb/wandbot.git /workspace/wandbot && \ - cd /workspace/wandbot && \ +RUN git clone https://github.com/wandb/wandbot.git /home/user/wandbot && \ + cd /home/user/wandbot && \ git checkout $WANDBOT_COMMIT RUN pip install uv # Set LD_LIBRARY_PATH before running build.sh -RUN cd /workspace/wandbot && \ +RUN cd /home/user/wandbot && \ export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH && \ (bash build.sh || true) -RUN cd /workspace/wandbot && . wandbot_venv/bin/activate && uv pip install . -RUN cd /workspace/wandbot && . wandbot_venv/bin/activate && uv pip install poetry -RUN cd /workspace/wandbot && . wandbot_venv/bin/activate && poetry install +RUN cd /home/user/wandbot && . wandbot_venv/bin/activate && uv pip install . +RUN cd /home/user/wandbot && . wandbot_venv/bin/activate && uv pip install poetry +RUN cd /home/user/wandbot && . wandbot_venv/bin/activate && poetry install -# Copy the index files to wandbot index_dir as defined in the vectorstore config -RUN cd /workspace/wandbot && \ - . wandbot_venv/bin/activate && \ - export INDEX_DIR=$(python -c """from wandbot.configs.vectorstore_config import VectorStoreConfig;\ -index_dir = VectorStoreConfig().index_dir;\ -print(index_dir, end='')""") && \ - mkdir -p $INDEX_DIR +# Copy in the vector index +COPY temp_index/* /home/user/temp_index/ -COPY temp_index /workspace/wandbot/$INDEX_DIR +RUN cd /home/user/wandbot && \ + . wandbot_venv/bin/activate && \ + export INDEX_DIR=$(python -c 'from wandbot.configs.vectorstore_config import VectorStoreConfig; \ +index_dir = VectorStoreConfig().index_dir; \ +print(index_dir, end="")') && \ + mkdir -p $INDEX_DIR && \ + cp -r /home/user/temp_index/* $INDEX_DIR/ # Ensure we're in the wandbot directory when container starts -WORKDIR /workspace/wandbot +WORKDIR /home/user