Skip to content

Commit

Permalink
chore: merge
Browse files Browse the repository at this point in the history
  • Loading branch information
leehanchung committed Sep 9, 2023
1 parent e50ddfe commit 7a2be0a
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 25 deletions.
27 changes: 14 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{
"name": "llm-pdf-qa-workshop",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"VARIANT": "3.10-bullseye",
"POETRY_VERSION": "1.6.1"
}
},
"remoteUser": "vscode",
"image": "mcr.microsoft.com/vscode/devcontainers/python:3.10-bullseye",
// Couldnt get github mounts to work. perhaps need to set that inside Dockerfile?
// "build": {
// "dockerfile": "../Dockerfile",
// "args": {
// "VARIANT": "3.10-bullseye",
// "POETRY_VERSION": "1.6.1"
// }
// },
// "remoteUser": "root",
"features": {
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {
"version": "latest"
}
},
"mounts": [
// Re-use local git and ssh configurations
"source=${env:HOME}/.gitconfig,target=/root/.gitconfig,type=bind",
"source=${env:HOME}/.ssh,target=/root/.ssh,type=bind"
// Re-use local git and ssh configurations. On container its at /workspaces/vscode
"source=${env:HOME}/.gitconfig,target=/home/vscode/.gitconfig,type=bind",
"source=${env:HOME}/.ssh,target=//home/vscode/.ssh,type=bind"
],
"postCreateCommand": ".devcontainer/post_create_command.sh",
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
Expand All @@ -32,4 +33,4 @@
]
}
}
}
}
9 changes: 1 addition & 8 deletions .devcontainer/post_create_command.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#!/bin/bash

# strict mode bash script
set -euo pipefail
set -euf -o pipefail
IFS=$'\n\t'

# allow git usage
git config --global --add safe.directory "*"

# install poetry
curl -sSL https://install.python-poetry.org | python3 -

# create python virtual environment
poetry install --no-root

# start virtual environment
poetry shell
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/python-3/.devcontainer/base.Dockerfile

# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
ARG VARIANT="3.10-bullseye"
ARG VARIANT

FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
Expand Down
7 changes: 7 additions & 0 deletions app/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Chroma compatibility issues, hacking per its documentation
# https://docs.trychroma.com/troubleshooting#sqlite
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')

from tempfile import NamedTemporaryFile

import chainlit as cl
Expand All @@ -13,6 +19,7 @@
from langchain.vectorstores.base import VectorStore
from prompts import EXAMPLE_PROMPT, PROMPT


WELCOME_MESSAGE = """\
Welcome to Introduction to LLM App Development Sample PDF QA Application!
To get started:
Expand Down
35 changes: 32 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ chainlit = "^0.6.402"
tiktoken = "^0.4.0"
pdfplumber = "^0.9.0"
chromadb = "^0.4.9"
pysqlite3-binary = "^0.5.1"

[tool.poetry.group.dev.dependencies]
ruff = "^0.0.287"
Expand Down

0 comments on commit 7a2be0a

Please sign in to comment.