-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
3,798 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python: [ '3.10', '3.11', '3.12' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Setup PDM | ||
uses: pdm-project/setup-pdm@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
cache: true | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt update && sudo apt install --yes libgl1-mesa-dev | ||
pdm lock | ||
pdm install --dev | ||
- name: Set PYTHONPATH | ||
run: echo "PYTHONPATH=${{ github.workspace }}/src" >> $GITHUB_ENV | ||
|
||
- name: Test with pytest | ||
run: | | ||
pdm run make test-cicd | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4.0.2 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: sysid/prepembd | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python: [ '3.10', '3.11', '3.12' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Setup PDM | ||
uses: pdm-project/setup-pdm@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
cache: true | ||
|
||
- name: Install dependencies | ||
run: | | ||
pdm lock | ||
pdm install --dev | ||
# - name: mypy | ||
# run: | | ||
# pdm run mypy --python-version=${{ matrix.python }} src/ | ||
|
||
- name: lint | ||
run: | | ||
pdm run make lint | ||
- name: format | ||
run: | | ||
pdm run make format-check | ||
- name: isort | ||
run: | | ||
pdm run isort . --check --diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
# prepembd | ||
|
||
[![PyPi](https://img.shields.io/pypi/v/inka2)](https://pypi.org/project/prepembd) | ||
[![Tests CI](https://img.shields.io/github/actions/workflow/status/sysid/prepembd/test.yml?branch=main)](https://github.com/sysid/inka2/actions/workflows/prepembd.yml) | ||
[![Codecov](https://codecov.io/gh/sysid/prepembd/branch/main/graph/badge.svg?token=8IL9MN4FK5)](https://codecov.io/gh/sysid/prepembd) | ||
|
||
|
||
## Installation | ||
|
||
Install **prepembd**: | ||
|
||
```shell | ||
python3 -m pip install prepembd --upgrade | ||
``` | ||
|
||
### Requirements | ||
|
||
- [Python](https://www.python.org/) >= 3.10 | ||
|
||
## Why | ||
|
||
I've been using markdown now for a long time to take notes in every possible scenario. I even manage my Anki cards with markdown ([inka2](https://github.com/sysid/inka2)) so finding relevant information again is paramount. | ||
With the advent of semantic search via Embeddings search became so much more powerfull. However, to create the | ||
embeddings out of markdown the files have to be prepared in order to reduce noice and create the correct chunk sizes. | ||
|
||
This Python script automates the process and creates a json representation of all the markdown files which then can be fed into an embedding model. It is basically just a thin wrapper aroung LangChain combined with some bespoke filter to eliminated noise. | ||
|
||
|
||
## Usage | ||
```bash | ||
prepembd tokenize <directory> | tee -a output.ndjson | ||
``` | ||
|
||
This script integrates particularly well with [bkmr](https://github.com/sysid/bkmr). |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.