Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
habedi committed Mar 1, 2025
1 parent d745933 commit 68025bd
Show file tree
Hide file tree
Showing 19 changed files with 804 additions and 376 deletions.
17 changes: 17 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[run]
# Exclude test files and specific init files from the coverage report
omit =
*/tests/*
*/test_*.py
*/__init__.py # Good idea to exclude __init__.py files from the coverage report

# Include source files only from certain directories
source =
easy_letters
notebooks

# Set parallel to true if you run tests in parallel
parallel = True

# Enable branch coverage if set to True
branch = False
28 changes: 15 additions & 13 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@
# Top-most EditorConfig file
root = true

# Python specific settings, complying with PEP 8 style guide
# Global settings (applicable to all files unless overridden)
[*]
charset = utf-8 # Default character encoding
end_of_line = lf # Use LF for line endings (Unix-style)
indent_style = space # Use spaces for indentation
indent_size = 4 # Default indentation size
insert_final_newline = true # Make sure files end with a newline
trim_trailing_whitespace = true # Remove trailing whitespace

# Python specific settings, complying with PEP 8 style guide, except for the line length
[*.py]
indent_size = 4
max_line_length = 100

# Markdown files
[*.md]
trim_trailing_whitespace = false

# Bash scripts
[*.sh]
indent_size = 2

# SQL files
[*.sql]
indent_size = 2
trim_trailing_whitespace = false # Don't remove trailing whitespace in Markdown files
max_line_length = 120
# YAML files
[*.{yaml,yml}]
indent_size = 2
# JSON files
[*.json]
# Shell scripts
[*.sh]
indent_size = 2
indent_style = tab
70 changes: 66 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,11 +1,73 @@
# Adding the following lines to the .gitattributes file will tell Git to treat the files as binary data.
*.text filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
# Common document and text file formats
*.docx filter=lfs diff=lfs merge=lfs -text
*.doc filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.djvu filter=lfs diff=lfs merge=lfs -text
*.eps filter=lfs diff=lfs merge=lfs -text
*.odt filter=lfs diff=lfs merge=lfs -text
*.rtf filter=lfs diff=lfs merge=lfs -text
*.ps filter=lfs diff=lfs merge=lfs -text
*.xls filter=lfs diff=lfs merge=lfs -text
*.xlsx filter=lfs diff=lfs merge=lfs -text
*.ppt filter=lfs diff=lfs merge=lfs -text
*.pptx filter=lfs diff=lfs merge=lfs -text

# Common image formats
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.csv filter=lfs diff=lfs merge=lfs -text
*.bmp filter=lfs diff=lfs merge=lfs -text
*.tiff filter=lfs diff=lfs merge=lfs -text
*.tif filter=lfs diff=lfs merge=lfs -text
*.svgz filter=lfs diff=lfs merge=lfs -text

# Common compressed file formats
*.zip filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.7z filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text

# Common file formats in machine learning projects
*.bin filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.tfrecord filter=lfs diff=lfs merge=lfs -text
*.hdf5 filter=lfs diff=lfs merge=lfs -text
*.keras filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text

# Common audio and video formats
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.avi filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
*.flac filter=lfs diff=lfs merge=lfs -text
*.mkv filter=lfs diff=lfs merge=lfs -text
*.webm filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
*.ogv filter=lfs diff=lfs merge=lfs -text

# Common data transfer formats
#*.csv filter=lfs diff=lfs merge=lfs -text
#*.tsv filter=lfs diff=lfs merge=lfs -text
#*.json filter=lfs diff=lfs merge=lfs -text
#*.xml filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.feather filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.avro filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.orc filter=lfs diff=lfs merge=lfs -text

# Exclude files from language stats (GitHub Linguist)
*.ipynb linguist-vendored
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Run Tests

on:
workflow_dispatch: # Enable manual runs
Expand Down Expand Up @@ -27,14 +27,14 @@ jobs:
- name: Install Dependencies
run: |
poetry install --with dev
poetry install --with dev --no-root
- name: Run Tests
- name: Run Tests with Coverage
shell: bash
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
poetry run pytest tests/ --cov --doctest-modules --cov-report=xml
poetry run pytest
continue-on-error: false

- name: Upload Coverage Reports to Codecov
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Hassan Abedi
Copyright (c) 2025 Hassan Abedi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
63 changes: 29 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
## Easy Letters

[![Tests](https://github.com/habedi/easy-letters/actions/workflows/tests.yml/badge.svg)](https://github.com/habedi/easy-letters/actions/workflows/tests.yml)
[![codecov](https://codecov.io/gh/habedi/easy-letters/graph/badge.svg?token=E47OPB2HVA)](https://codecov.io/gh/habedi/easy-letters)
[![CodeFactor](https://www.codefactor.io/repository/github/habedi/easy-letters/badge)](https://www.codefactor.io/repository/github/habedi/easy-letters)
[![python version](https://img.shields.io/badge/Python-%3E=3.10-blue)](https://github.com/habedi/easy-letters)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/habedi/easy-letters/blob/main/LICENSE)
[![PyPI version](https://badge.fury.io/py/easy-letters.svg)](https://badge.fury.io/py/easy-letters)
[![pip downloads](https://img.shields.io/pypi/dm/easy-letters.svg)](https://pypi.org/project/easy-letters/)

Easy Letters is a Python library that can help job seekers write application letters.
Currently, it proves the basic blocks for creating a simple retrieval augmented generation (RAG) pipeline
to generate application letter drafts.
The user can then edit the draft letter to suit their needs.
Easy Letters is a Python library that provides the basic building blocks for creating a naive retrieval augmented
generation (or RAG) pipeline
to generate application letter drafts that can be used as a starting point for writing application letters.

See the [notebooks/README.md](notebooks/README.md) file for how it works.
The diagram below shows the high-level workflow of how Easy Letters how can be used to generate draft application
letters.

### 🔧 Installation
![Easy Letters Workflow](assets/workflow.svg)

You can install Easy Letters using pip:
### Installation

```bash
pip install easy-letters
```

### 🚀 Getting Started
#### Installing from Source

You can also install Easy Letters from the source code in this repository.
The main benefit of this approach is that you might find it easier to run the sample notebooks and modify the code as
you wish this way.

After cloning this repository, you can navigate to the directory where you cloned the repository and install the
dependencies using [Poetry](https://python-poetry.org/):

```bash
git clone https://github.com/habedi/easy-letters.git && cd easy-letters

# Install the dependencies using Poetry
poetry install --with dev
```

### Getting Started

#### API Key Setup

Expand All @@ -36,7 +53,7 @@ So you need to set the following environment variables to be able to use Easy Le
You can find Jupyter notebooks with example code in the [notebooks](notebooks/) directory.
The notebooks demonstrate how to use Easy Letters to generate application letter drafts.

#### Supported Models
### Supported Models

Easy Letters currently supports the following models:

Expand All @@ -49,30 +66,8 @@ Easy Letters currently supports the following models:
| Text Embedding 3 (Small Variant) | Text Embedding |
| Text Embedding 3 (Large Variant) | Text Embedding |

#### Installing from Source

You can also install Easy Letters from the source code in this repository. The main benefit of this approach is that
you might find it easier to run the sample notebooks and modify the code as you wish this way.
### License

After cloning this repository, you can navigate to the directory where you cloned the repository and install the
dependencies using [Poetry](https://python-poetry.org/):

```bash
git clone https://github.com/habedi/easy-letters.git && cd easy-letters

# Assuming you have Poetry installed on your system
poetry install --with dev
```

#### Running Tests with Coverage

You can run the unit tests with coverage using the following command:

```bash
poetry run pytest tests/ --cov=easy_letters
```
Easy Letters is available under the MIT license ([LICENSE](LICENSE)).

### 📝 TODO

- [ ] Add support for Anthropic models and API
- [ ] Add support for locally served models via Ollama
9 changes: 9 additions & 0 deletions assets/make_figures.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# You need to have Graphviz installed to run this script
# On Debian-based systems, you can install it using: sudo apt-get install graphviz

# Make figures from .dot files
for f in *.dot; do
dot -Tsvg $f -o ${f%.dot}.svg
done
File renamed without changes.
Loading

0 comments on commit 68025bd

Please sign in to comment.