Skip to content

Commit

Permalink
feat: devcontainer?
Browse files Browse the repository at this point in the history
  • Loading branch information
leehanchung committed Sep 9, 2023
1 parent acdd4f5 commit f9a559d
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 26 deletions.
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"image": "mcr.microsoft.com/vscode/devcontainers/universal",
"features": {
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {
"version": "latest"
}
},
"postCreateCommand": ".devcontainer/post_create_command.sh",
"postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}",
"customizations": {
"vscode": {
"extensions": [
"GitHub.copilot",
"ms-python.python",
"esbenp.prettier-vscode"
]
}
}
}
6 changes: 6 additions & 0 deletions .devcontainer/post_create_command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# do as little as possible in this script to keep the container creation fast.
# for more specific devcontainer use cases use the different devcontainer subfolders.

echo "done"
18 changes: 8 additions & 10 deletions app/app.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
from tempfile import NamedTemporaryFile

import chainlit as cl
from chainlit.types import AskFileResponse
from chromadb.config import Settings
from langchain.chains import RetrievalQAWithSourcesChain
from langchain.chains.base import Chain
from langchain.chat_models import ChatOpenAI
from langchain.document_loaders import PDFPlumberLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.vectorstores import Chroma
from langchain.vectorstores.base import VectorStore
from langchain.chains import RetrievalQAWithSourcesChain
from langchain.chains.base import Chain
from langchain.chat_models import ChatOpenAI

import chainlit as cl
from chainlit.types import AskFileResponse
from chromadb.config import Settings

from prompts import PROMPT, EXAMPLE_PROMPT
from prompts import EXAMPLE_PROMPT, PROMPT

WELCOME_MESSAGE = """\
Welcome to Introduction to LLM App Development Sample PDF QA Application!
Expand Down
19 changes: 18 additions & 1 deletion poetry.lock

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

43 changes: 28 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 88
target-version = ['py37', 'py38']
line-length = 120
target-version = ['py310']
include = '\.pyi?$'
extend-exclude = '''
/(
Expand All @@ -14,6 +14,16 @@ extend-exclude = '''
# this off.
preview = true

[tool.isort]
profile = "black"
filter_files = true
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 120

[tool.poetry]
name = "llm-pdf-qa-sample-app"
version = "0.1.0"
Expand All @@ -34,13 +44,21 @@ chromadb = "^0.4.9"
[tool.poetry.group.dev.dependencies]
ruff = "^0.0.287"
black = "^23.7.0"
isort = "^5.12.0"

[tool.ruff]
# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E", "F"]
ignore = []
target-version = "py310"
line-length = 120
select = [
"E", "W", # see: https://pypi.org/project/pycodestyle
"F", # see: https://pypi.org/project/pyflakes
]
ignore = [
"E501",
"E731",
"E741", # Ambiguous variable name: ...
"E999", # SyntaxError: invalid syntax. Got unexpected token Newline
]

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
Expand Down Expand Up @@ -70,17 +88,12 @@ exclude = [
"node_modules",
"venv",
]
ignore-init-module-imports = true
per-file-ignores = {}

# Same as Black.
line-length = 88

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
target-version = "py310"

[tool.ruff.isort]
case-sensitive = true
[tool.ruff.mccabe]
max-complexity = 10

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit f9a559d

Please sign in to comment.