Skip to content

Commit

Permalink
Agentic workflows, locally indexed search, and CLI (#309)
Browse files Browse the repository at this point in the history
* add agentic workflow module and cli

* update pyproject.toml and split google into its own import

* remove unused import

* update default search chain

* Update __init__.py

* Update search.py

* move reqs into pyproject.toml, addressing PR comments

* rename search_chain to openai_get_search_query

* remove get_llm_name

* move table_formatter to helpers.py

* Update paperqa/agents/main.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* Update paperqa/agents/main.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* Update paperqa/agents/main.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* Update paperqa/agents/docs.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* Update paperqa/types.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* rename compute_cost to compute_total_model_token_cost

* remove stream_answer

* rename to stub_manifest, and use Path for all paths

* Update paperqa/llms.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* move SKIP_AGENT_TESTS = False

* nix _ = assignments

* add test comments

* types in conftest.py

* split libs into llms

* link openai chat timeout to query.timeout

* Update paperqa/agents/__init__.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* logging revamp and renaming

* Update tests/test_cli.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* Update tests/test_cli.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* move vertex import to func call, add docstring to SupportsPickle

* docstring

* remove _ =

* remove bool return type from set

* update gitignore

* add config attribute to baase LLMModel class

* replace get_current_settings -> get_settings

* replace get_current_settings -> get_settings

* PR simplifications

* remove all stream_* functions

* avoid modifying the root logger

* re-organize logger import location

* move hashlib into utils

* refactor strip_answer into Answer object

* label circular imports

* ensure absolute paths are used in index name

* limit select to be used only when DOI is not present in crossref

* Update paperqa/agents/search.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* Update paperqa/agents/search.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* Update paperqa/agents/search.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* Update paperqa/agents/search.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* Update paperqa/agents/models.py

Co-authored-by: James Braza <jamesbraza@gmail.com>

* reconfigure logging to not prevent propagation

* remove newlines in the current year

* use required fields as a subset

* replace . with Path.cwd()

---------

Co-authored-by: James Braza <jamesbraza@gmail.com>
  • Loading branch information
mskarlin and jamesbraza authored Aug 29, 2024
1 parent eced4f3 commit 9cd976a
Show file tree
Hide file tree
Showing 26 changed files with 3,777 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
python-version: 3.11
cache: pip
- run: pip install .[dev]
- run: pip install .[agents,google,dev,llms]
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/ .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: pip
- run: pip install .[dev]
- run: pip install .[agents,google,dev,llms]
- name: Check pre-commit
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
- name: Run Test
Expand Down
176 changes: 171 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,138 @@
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon[\r]


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -20,7 +155,6 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
Expand Down Expand Up @@ -50,6 +184,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -72,6 +207,7 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
Expand All @@ -82,7 +218,9 @@ profile_default/
ipython_config.py

# pyenv
.python-version
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand All @@ -91,7 +229,24 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
Expand Down Expand Up @@ -128,12 +283,23 @@ dmypy.json
# Pyre type checker
.pyre/

# testing files generated
*.txt.json
# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

*.ipynb
env

# Matching pyproject.toml
paperqa/version.py
tests/example*
tests/test_index/*
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.6.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -41,6 +41,7 @@ repos:
- pydantic~=2.0 # Match pyproject.toml
- types-requests
- types-setuptools
- types-PyYAML
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.3.2
hooks:
Expand Down
22 changes: 0 additions & 22 deletions dev-requirements.txt

This file was deleted.

Loading

0 comments on commit 9cd976a

Please sign in to comment.