Skip to content

Commit

Permalink
Merge branch 'main' into fix_delete
Browse files Browse the repository at this point in the history
  • Loading branch information
whitead authored Mar 7, 2024
2 parents 0fe94f7 + 350225c commit 1116a92
Show file tree
Hide file tree
Showing 20 changed files with 2,704 additions and 867 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jobs:
pip install .
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ jobs:
- name: Run Test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
pytest tests
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ repos:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.3.0"
rev: v1.8.0
hooks:
- id: mypy
args: [--pretty, --ignore-missing-imports]
additional_dependencies: [types-requests]
additional_dependencies: [types-requests, types-setuptools]
- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
hooks:
Expand Down
4 changes: 2 additions & 2 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Allow lines to be as long as 120 characters.
line-length = 120
# Allow lines to be as longer.
line-length = 180
298 changes: 138 additions & 160 deletions README.md

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@ pyzotero
python-dotenv
pymupdf
build
types-setuptools
types-requests
numpy
langchain_openai
langchain_community
faiss-cpu
sentence_transformers
anthropic
39 changes: 37 additions & 2 deletions paperqa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
from .docs import Answer, Docs, PromptCollection, Doc, Text
from .docs import Answer, Docs, PromptCollection, Doc, Text, Context, print_callback
from .version import __version__
from .llms import (
LLMModel,
EmbeddingModel,
LangchainEmbeddingModel,
OpenAIEmbeddingModel,
LangchainLLMModel,
OpenAILLMModel,
AnthropicLLMModel,
LlamaEmbeddingModel,
NumpyVectorStore,
LangchainVectorStore,
SentenceTransformerEmbeddingModel,
LLMResult,
)

__all__ = ["Docs", "Answer", "PromptCollection", "__version__", "Doc", "Text"]
__all__ = [
"Docs",
"Answer",
"PromptCollection",
"__version__",
"Doc",
"Text",
"Context",
"LLMModel",
"EmbeddingModel",
"OpenAIEmbeddingModel",
"OpenAILLMModel",
"AnthropicLLMModel",
"LangchainLLMModel",
"LlamaEmbeddingModel",
"SentenceTransformerEmbeddingModel",
"LangchainEmbeddingModel",
"NumpyVectorStore",
"LangchainVectorStore",
"print_callback",
"LLMResult",
]
107 changes: 0 additions & 107 deletions paperqa/chains.py

This file was deleted.

5 changes: 2 additions & 3 deletions paperqa/contrib/zotero.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
except ImportError:
raise ImportError("Please install pyzotero: `pip install pyzotero`")
from ..paths import PAPERQA_DIR
from ..types import StrPath
from ..utils import count_pdf_pages
from ..utils import StrPath, count_pdf_pages


class ZoteroPaper(BaseModel):
Expand Down Expand Up @@ -129,7 +128,7 @@ def get_pdf(self, item: dict) -> Union[Path, None]:
if pdf_key is None:
return None

pdf_path: Path = Path(self.storage / (pdf_key + ".pdf")) # type: ignore
pdf_path: Path = Path(self.storage / (pdf_key + ".pdf")) # type: ignore[operator]

if not pdf_path.exists():
pdf_path.parent.mkdir(parents=True, exist_ok=True)
Expand Down
Loading

0 comments on commit 1116a92

Please sign in to comment.