Skip to content

Commit

Permalink
chore: rename repo to retrieval.ist
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Mar 7, 2024
1 parent 4204542 commit 654f195
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
zotero-3.11.0
retrieval.ist-3.11.0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
description = ""
include = ["src/**/*.so", "src/**/*.pyd", "src/**/*.dylib"]
license = "APGL-3.0"
name = "zotero-qa"
name = "retrieval.ist"
readme = "README.md"
version = "0.0.0-post.22+7cefc52"
packages = [
Expand Down
8 changes: 4 additions & 4 deletions src/cli/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import rich
import rich.progress

import zotero_qa
import retrievals


def cache(zotero_path: str, cache_path: str) -> None:
Expand All @@ -34,10 +34,10 @@ def cache(zotero_path: str, cache_path: str) -> None:
raise ValueError("The path to the vector database directory is required.")

rich.print("Getting the files to process...")
paths = zotero_qa.list_files(f"{zotero_path}/storage")
paths = retrievals.list_files(f"{zotero_path}/storage")

rich.print("Creating or loading the cache...")
cache = zotero_qa.Cache(f"{cache_path}/cache.json")
cache = retrievals.Cache(f"{cache_path}/cache.json")
cache.load()

print("Iterating over the files to cache their page numbers...")
Expand All @@ -51,7 +51,7 @@ def cache(zotero_path: str, cache_path: str) -> None:
continue

# Load the document.
doc = zotero_qa.DocLoader(abspath).doc
doc = retrievals.DocLoader(abspath).doc

rich.print(f"Caching: {abspath}...")
cache.set(abspath, {"pages": doc.page_count, "split": 0, "embedded": 0})
Expand Down
10 changes: 5 additions & 5 deletions src/cli/_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import rich
import rich.progress

import zotero_qa
import retrievals


def split(zotero_path: str, cache_path: str) -> None:
Expand All @@ -21,10 +21,10 @@ def split(zotero_path: str, cache_path: str) -> None:
raise ValueError("The path to the vector database directory is required.")

rich.print("Getting the files to process...")
paths = zotero_qa.list_files(f"{zotero_path}/storage")
paths = retrievals.list_files(f"{zotero_path}/storage")

rich.print("Creating or loading the cache...")
cache = zotero_qa.Cache(f"{cache_path}/cache.json")
cache = retrievals.Cache(f"{cache_path}/cache.json")
cache.load()

print("Iterating over the files to split and store them in chunks...")
Expand All @@ -42,10 +42,10 @@ def split(zotero_path: str, cache_path: str) -> None:
os.makedirs(f"{cache_path}/splits")

rich.print(f"Splitting: {abspath}...")
doc = zotero_qa.open_file(abspath)
doc = retrievals.open_file(abspath)

# Get the ids.
ids = zotero_qa.get_ids(abspath, doc)
ids = retrievals.get_ids(abspath, doc)

for i, page in enumerate(doc):
# Store the chunk in a text file.
Expand Down
4 changes: 2 additions & 2 deletions src/retrievals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

"""Zotero QA allows you to chat with your Zotero PDF collections."""

from zotero_qa._caching import Cache
from zotero_qa.domain.document_management._document import Document
from retrievals._caching import Cache
from retrievals.domain.document_management._document import Document

# from zotero_qa._pdf import DocLoader, Page, PageParser
# from zotero_qa._text import DocSplitter, TextSplitter
Expand Down
2 changes: 1 addition & 1 deletion src/retrievals/_text.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# cython: language_level=3

from zotero_qa import Page, PageParser
from retrievals import Page, PageParser

ctypedef object Page_t
ctypedef object PageParser_t
Expand Down
2 changes: 1 addition & 1 deletion src/retrievals/_text.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import re

from zotero_qa import Page, PageParser
from retrievals import Page, PageParser

ctypedef object Page_t
ctypedef object PageParser_t
Expand Down
2 changes: 1 addition & 1 deletion src/retrievals/_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import os
import dotenv

from zotero_qa cimport DocSplitter, TextSplitter
from zotero_qa import DocLoader, PageParser
from retrievals import DocLoader, PageParser

# It's necessary to call "import_array" if you use any part of the
# numpy PyArray_* API. From Cython 3, accessing attributes like
Expand Down
2 changes: 1 addition & 1 deletion src/retrievals/chain.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from langchain.chains import RetrievalQA
from langchain.prompts import PromptTemplate
from langchain_community.llms import Ollama

from zotero_qa import Store
from retrievals import Store

# The name of the Ollama model to use.
model_name = os.getenv("MODEL_NAME")
Expand Down
4 changes: 2 additions & 2 deletions src/retrievals/embed.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import os

import dotenv

from zotero_qa import Cache, helpers
from zotero_qa.store import Store
from retrievals import Cache, helpers
from retrievals.store import Store

# Load the environment variables.
dotenv.load_dotenv()
Expand Down
2 changes: 1 addition & 1 deletion src/retrievals/query.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import warnings

from zotero_qa.chain import Chain
from retrievals.chain import Chain

# Suppress warnings.
warnings.filterwarnings("ignore")
Expand Down
2 changes: 1 addition & 1 deletion src/retrievals/store.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ from chromadb.config import Settings
from langchain.text_splitter import Document
from langchain_community.vectorstores import Chroma

from zotero_qa.embeddings import Embeddings
from retrievals.embeddings import Embeddings

# Load the environment variables.
dotenv.load_dotenv()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,47 @@
# Licensed under the EUPL-1.2-or-later licence.
# For details: https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12

import zotero_qa
import retrievals


def test_a_document_is_a_unique_piece_of_knowledge():
# Arrange
document = zotero_qa.Document(
document = retrievals.Document(
authors=[{"first_name": "Mauko", "last_name": "Quiroga-Alvarado"}],
title="Practical Domain-Driven Design in the Public Sector",
date=2024,
summary="How to use domain-driven design in the public sector",
content="...",
)
different_author = zotero_qa.Document(
different_author = retrievals.Document(
authors=[{"first_name": "Brunildo", "last_name": "Soto"}],
title="Practical Domain-Driven Design in the Public Sector",
date=2024,
summary="How to use domain-driven design in the public sector",
content="...",
)
different_title = zotero_qa.Document(
different_title = retrievals.Document(
authors=[{"first_name": "Mauko", "last_name": "Quiroga-Alvarado"}],
title="Unpractical Feature-Driven Design in the Public Sector",
date=2024,
summary="How to use domain-driven design in the public sector",
content="...",
)
different_date = zotero_qa.Document(
different_date = retrievals.Document(
authors=[{"first_name": "Mauko", "last_name": "Quiroga-Alvarado"}],
title="Practical Domain-Driven Design in the Public Sector",
date=2027,
summary="How to use domain-driven design in the public sector",
content="...",
)
different_summary = zotero_qa.Document(
different_summary = retrievals.Document(
authors=[{"first_name": "Mauko", "last_name": "Quiroga-Alvarado"}],
title="Practical Domain-Driven Design in the Public Sector",
date=2024,
summary="How not to use feature-driven design in the public sector",
content="...",
)
different_content = zotero_qa.Document(
different_content = retrievals.Document(
authors=[{"first_name": "Mauko", "last_name": "Quiroga-Alvarado"}],
title="Practical Domain-Driven Design in the Public Sector",
date=2024,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest

from zotero_qa import Cache
from retrievals import Cache


@pytest.fixture()
Expand Down
2 changes: 1 addition & 1 deletion tests/zotero_qa/test_pdf.py → tests/embeds/test_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest

from zotero_qa import DocLoader, PageParser
from retrievals import DocLoader, PageParser


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/zotero_qa/test_text.py → tests/embeds/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pytest

from zotero_qa import DocLoader, DocSplitter, PageParser, TextSplitter
from retrievals import DocLoader, DocSplitter, PageParser, TextSplitter


@pytest.fixture()
Expand Down
6 changes: 3 additions & 3 deletions tests/zotero_qa/test_utils.py → tests/embeds/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
# Licensed under the EUPL-1.2-or-later licence.
# For details: https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12

import zotero_qa
import retrievals


def test_load_files():
# Arrange
path = "tests/files"

# Act
files = zotero_qa.list_files(path)
files = retrievals.list_files(path)

# Assert
assert len(files) == 4
Expand All @@ -25,7 +25,7 @@ def test_open_file():
path = "tests/files/10mb.pdf"

# Act
pages = zotero_qa.open_file(path)
pages = retrievals.open_file(path)

# Assert
assert len(pages) == 9

0 comments on commit 654f195

Please sign in to comment.