Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint and format checks

on:
push:
branches: [main]
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install tools
run: |
pip install black isort ruff

- name: Run Black
run: black --check .

- name: Run Isort
run: isort --check-only .

- name: Run Ruff
run: ruff check .
6 changes: 3 additions & 3 deletions loaders/pdf.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import logging
from pathlib import Path
from typing import List

from config import Config
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_core.documents import Document
from langchain_community.document_loaders import PyPDFLoader
from langchain_core.documents import Document

import logging
from config import Config

logger = logging.getLogger(__name__)

Expand Down
7 changes: 3 additions & 4 deletions loaders/web.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import logging
from typing import List

from pathlib import Path
from langchain_core.documents import Document
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.document_loaders import WebBaseLoader
from langchain_core.documents import Document

from config import Config
import logging

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -55,7 +54,7 @@ def load(self, urls: List[str]) -> List[Document]:
try:
loader = WebBaseLoader(urls)
docs = loader.load()
except Exception as e:
except Exception:
logger.exception("Failed to load URLs via WebBaseLoader")
raise

Expand Down
2 changes: 1 addition & 1 deletion vector_db/db_provider.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from abc import ABC, abstractmethod
from typing import List

from langchain_huggingface import HuggingFaceEmbeddings
from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings
from langchain_huggingface import HuggingFaceEmbeddings


class DBProvider(ABC):
Expand Down
2 changes: 2 additions & 0 deletions vector_db/dryrun_provider.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from typing import List

from langchain_core.documents import Document

from vector_db.db_provider import DBProvider


Expand Down
1 change: 1 addition & 0 deletions vector_db/elastic_provider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import List

from langchain_core.documents import Document
from langchain_elasticsearch.vectorstores import ElasticsearchStore

Expand Down
4 changes: 3 additions & 1 deletion vector_db/pgvector_provider.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import List
from langchain_postgres import PGVector

from langchain_core.documents import Document
from langchain_postgres import PGVector

from vector_db.db_provider import DBProvider


Expand Down
2 changes: 1 addition & 1 deletion vector_db/redis_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, url: str, index: str, schema: str):
try:
self.redis_client = redis.from_url(self.url)
self.redis_client.ping()
except Exception as e:
except Exception:
logger.exception("Failed to connect to Redis at %s", self.url)
raise

Expand Down
2 changes: 1 addition & 1 deletion vector_db/sqlserver_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ def add_documents(self, docs: List[Document]) -> None:
batch = docs[i : i + batch_size]
try:
self.db.add_documents(batch)
except Exception as e:
except Exception:
logger.exception("Failed to insert batch starting at index %s", i)
raise