Skip to content

Commit

Permalink
Merge pull request #92 from aurelio-labs/simonas/incompatible-with-py…
Browse files Browse the repository at this point in the history
…thon-312

feat: Compatible with Python 3.9
  • Loading branch information
simjak committed Jan 10, 2024
2 parents f8fcd43 + c8873e7 commit c122987
Show file tree
Hide file tree
Showing 28 changed files with 812 additions and 422 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ jobs:
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
# - "3.12"
steps:
- uses: actions/checkout@v4
- name: Cache Poetry
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ venv/
**/__pycache__
**/*.py[cod]


# local env files
.env*.local
.env
Expand All @@ -18,5 +19,11 @@ mac.env
.coverage
.coverage.*
.pytest_cache
coverage.xml
test.py
output
node_modules
package-lock.json
package.json

```
36 changes: 22 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.11.3
python: python3.9
repos:
- repo: meta
hooks:
Expand All @@ -17,14 +17,12 @@ repos:
- id: blacken-docs
additional_dependencies: [black==22.10.0]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.290
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.11.0
hooks:
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [ --fix ]
- id: ruff-format
types_or: [ python, pyi, jupyter ]
- id: commitlint
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional']

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
Expand All @@ -36,13 +34,11 @@ repos:
args: [ "--write-changes", "--ignore-words-list", "asend" ]
exclude: "poetry.lock"


- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-vcs-permalinks
- id: end-of-file-fixer
# exclude: "tests/((commands|data)/|test_).+"
- id: trailing-whitespace
args: [ --markdown-linebreak-ext=md ]
- id: debug-statements
Expand All @@ -62,8 +58,20 @@ repos:
- post-commit
- push

- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.11.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.290
hooks:
- id: ruff
types_or: [python, pyi, jupyter]

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.8.0
# hooks:
# - id: mypy
# args: [--ignore-missing-imports]

- repo: https://github.com/PyCQA/bandit
rev: 1.7.6
hooks:
- id: commitlint
stages: [commit-msg]
- id: bandit
args: ['-lll']
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
format:
poetry run black .
poetry run black --target-version py39 .
poetry run ruff --select I --fix .

PYTHON_FILES=.
lint: PYTHON_FILES=.
lint_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$')

lint lint_diff:
poetry run black $(PYTHON_FILES) --check
poetry run black --target-version py39 $(PYTHON_FILES) --check
poetry run ruff .
poetry run mypy $(PYTHON_FILES)

Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![Aurelio AI](https://pbs.twimg.com/profile_banners/1671498317455581184/1696285195/1500x500)](https://aurelio.ai)

# Semantic Router

<p>
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/semantic-router?logo=python&logoColor=gold" />
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/aurelio-labs/semantic-router" />
Expand All @@ -22,7 +23,7 @@ To get started with _semantic-router_ we install it like so:
pip install -qU semantic-router
```

❗️ _If wanting to use local embeddings you can use `FastEmbedEncoder` (`pip install -qU semantic-router[fastembed]`). To use the `HybridRouteLayer` you must `pip install -qU semantic-router[hybrid]`._
❗️ _If wanting to use local embeddings you can use `FastEmbedEncoder` (`pip install -qU "semantic-router[fastembed]`"). To use the `HybridRouteLayer` you must `pip install -qU "semantic-router[hybrid]"`._

We begin by defining a set of `Route` objects. These are the decision paths that the semantic router can decide to use, let's try two simple routes for now — one for talk on _politics_ and another for _chitchat_:

Expand Down Expand Up @@ -114,10 +115,3 @@ rl("I'm interested in learning about llama 2").name
In this case, no decision could be made as we had no matches — so our route layer returned `None`!

## 📚 [Resources](https://github.com/aurelio-labs/semantic-router/tree/main/docs)







Loading

0 comments on commit c122987

Please sign in to comment.