Skip to content

Commit bcd260a

Browse files
committed
Initial commit with all features
0 parents  commit bcd260a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6897
-0
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
notebooks/
2+
data/
3+
.uploads/
4+
.venv/
5+
.mypy_cache/
6+
.ruff_cache/
7+
.env
8+
sqlite-db/

.env.example

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# YOUR LLM API KEYS
2+
OPENAI_API_KEY=API_KEY
3+
4+
# MODEL_CONFIGURATIONS
5+
# Only OpenAI models are supported for now
6+
DEFAULT_MODEL="gpt-4o-mini" # This is the default model used for all the features
7+
SUMMARIZATION_MODEL="gpt-4o-mini" # This is the model used for summarization, defaults to the DEFAULT_MODEL if empty
8+
RETRIEVAL_MODEL="gpt-4o-mini" # This is the model used for retrieval, defaults to the DEFAULT_MODEL if empty
9+
10+
11+
# CONNECTION DETAILS FOR YOUR SURREAL DB
12+
SURREAL_ADDRESS="ws://localhost:8000/rpc"
13+
SURREAL_USER="root"
14+
SURREAL_PASS="root"
15+
SURREAL_NAMESPACE="open_notebook"
16+
SURREAL_DATABASE="staging"
17+
18+
# This is used for the summarization feature when the content is to big to fit a single context window
19+
# It is measured in characters, not tokens.
20+
SUMMARY_CHUNK_SIZE=200000
21+
SUMMARY_CHUNK_OVERLAP=1000
22+
23+
# This is used for vector embeddings
24+
# It is measured in characters, not tokens.
25+
EMBEDDING_CHUNK_SIZE=1000
26+
EMBEDDING_CHUNK_OVERLAP=50
27+

.gitignore

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
notebooks/
2+
data/
3+
.uploads/
4+
sqlite-db/
5+
surreal-data/
6+
docker.env
7+
# Python-specific
8+
*.py[cod]
9+
__pycache__/
10+
*.so
11+
12+
# Distribution / packaging
13+
.Python
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
wheels/
26+
share/python-wheels/
27+
*.egg-info/
28+
.installed.cfg
29+
*.egg
30+
31+
# PyInstaller
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
53+
# Jupyter Notebook
54+
.ipynb_checkpoints
55+
56+
# IPython
57+
profile_default/
58+
ipython_config.py
59+
60+
# Environments
61+
.env
62+
.venv
63+
env/
64+
venv/
65+
ENV/
66+
env.bak/
67+
venv.bak/
68+
69+
# PyCharm
70+
.idea/
71+
72+
# VS Code
73+
.vscode/
74+
75+
# Spyder project settings
76+
.spyderproject
77+
.spyproject
78+
79+
# Rope project settings
80+
.ropeproject
81+
82+
# mkdocs documentation
83+
/site
84+
85+
# mypy
86+
.mypy_cache/
87+
.dmypy.json
88+
dmypy.json
89+
90+
# Pyre type checker
91+
.pyre/
92+
93+
# pytype static type analyzer
94+
.pytype/
95+
96+
# Cython debug symbols
97+
cython_debug/
98+
99+
# macOS
100+
.DS_Store
101+
102+
# Windows
103+
Thumbs.db
104+
ehthumbs.db
105+
desktop.ini
106+
107+
# Linux
108+
*~
109+
110+
# Log files
111+
*.log
112+
113+
# Database files
114+
*.db
115+
*.sqlite3
116+
117+
# Virtual environment
118+
.python-version

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.4.4
4+
hooks:
5+
- id: ruff
6+
args: ["--fix"]
7+
exclude: "templates"
8+
- id: ruff-format
9+
exclude: "templates"

.streamlit/config.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[server]
2+
3+
port = 8502
4+
maxMessageSize = 500
5+
6+
[browser]
7+
serverPort = 8502
8+
9+
# [theme]
10+
11+
# # The preset Streamlit theme that your custom theme inherits from.
12+
# # One of "light" or "dark".
13+
# base =
14+
15+
# # Primary accent color for interactive elements.
16+
# primaryColor =
17+
18+
# # Background color for the main content area.
19+
# backgroundColor =
20+
21+
# # Background color used for the sidebar and most interactive widgets.
22+
# secondaryBackgroundColor =
23+
24+
# # Color used for almost all text.
25+
# textColor =
26+
27+
# # Font family for all text in the app, except code blocks. One of "sans serif",
28+
# # "serif", or "monospace".
29+
# font =
30+

CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contributing to Open Notebook
2+
3+
First off, thank you for considering contributing to Open Notebook! What makes open source great is the fact that we can work together and accomplish things we would never do on our own. All suggestions are welcome.
4+
5+
## Code of Conduct
6+
7+
By participating in this project, you are expected to uphold our Code of Conduct (to be created separately).
8+
9+
## How Can I Contribute?
10+
11+
### Reporting Bugs
12+
13+
- Ensure the bug was not already reported by searching on GitHub under [Issues](https://github.com/yourusername/open-notebook/issues).
14+
- If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/yourusername/open-notebook/issues/new). Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.
15+
16+
### Suggesting Enhancements
17+
18+
- Open a new issue with a clear title and detailed description of the suggested enhancement.
19+
- Provide any relevant examples or mockups if applicable.
20+
21+
### Pull Requests
22+
23+
1. Fork the repo and create your branch from `main`.
24+
2. If you've added code that should be tested, add tests.
25+
3. Ensure the test suite passes.
26+
4. Make sure your code lints.
27+
5. Issue that pull request!
28+
29+
## Styleguides
30+
31+
### Git Commit Messages
32+
33+
- Use the present tense ("Add feature" not "Added feature")
34+
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
35+
- Limit the first line to 72 characters or less
36+
- Reference issues and pull requests liberally after the first line
37+
38+
### Python Styleguide
39+
40+
- Follow PEP 8 guidelines
41+
- Use type hints where possible
42+
- Write docstrings for all functions, classes, and modules
43+
44+
### Documentation Styleguide
45+
46+
- Use Markdown for documentation files
47+
- Reference functions and classes appropriately
48+
49+
## Additional Notes
50+
51+
52+
Thank you for contributing to Open Notebook!

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Use an official Python runtime as a base image
2+
FROM python:3.11.7-slim-bullseye
3+
4+
# Install system dependencies required for building certain Python packages
5+
RUN apt-get update && apt-get install -y \
6+
gcc \
7+
curl wget libmagic-dev \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
# Set the working directory in the container to /app
11+
WORKDIR /app
12+
13+
RUN pip install poetry --no-cache-dir
14+
RUN poetry self add poetry-plugin-dotenv
15+
RUN poetry config virtualenvs.create false
16+
COPY pyproject.toml poetry.lock* /app/
17+
18+
RUN poetry install --only main
19+
#--no-root
20+
COPY . /app
21+
WORKDIR /app
22+
23+
EXPOSE 8502
24+
25+
RUN mkdir -p /app/sqlite-db
26+
27+
CMD ["poetry", "run", "streamlit", "run", "app_home.py"]
28+

LICENSE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
MIT License
2+
Copyright (c) 2024 Luis Novo
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
The above copyright notice and this permission notice shall be included in all
10+
copies or substantial portions of the Software.
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17+
SOFTWARE.

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.PHONY: run check ruff database lint docker-build docker-push
2+
3+
# Get version from pyproject.toml
4+
VERSION := $(shell grep -m1 version pyproject.toml | cut -d'"' -f2)
5+
IMAGE_NAME := lfnovo/open_notebook
6+
database:
7+
docker compose up -d
8+
9+
run:
10+
poetry run streamlit run app_home.py
11+
12+
lint:
13+
poetry run python -m mypy .
14+
15+
ruff:
16+
ruff check . --fix
17+
18+
docker-build:
19+
docker build . -t $(IMAGE_NAME):$(VERSION)
20+
docker tag $(IMAGE_NAME):$(VERSION) $(IMAGE_NAME):latest
21+
22+
docker-push:
23+
docker push $(IMAGE_NAME):$(VERSION)
24+
docker push $(IMAGE_NAME):latest
25+
26+
# Combined build and push
27+
docker-release: docker-build docker-push

0 commit comments

Comments
 (0)