Remove mentions of verbose

This commit is contained in:
EmptyCrown 2023-02-10 14:47:37 -08:00
parent 201f15d9ee
commit cd3219de68
7 changed files with 16 additions and 24 deletions

View File

@ -1,5 +1,6 @@
"""Simple reader that reads files of different formats from a directory."""
import logging
from pathlib import Path
from typing import Callable, Dict, List, Optional, Union
@ -60,10 +61,9 @@ class SimpleDirectoryReader(BaseReader):
file_extractor: Optional[Dict[str, Union[str, BaseReader]]] = None,
num_files_limit: Optional[int] = None,
file_metadata: Optional[Callable[[str], Dict]] = None,
verbose: bool = False,
) -> None:
"""Initialize with parameters."""
super().__init__(verbose=verbose)
super().__init__()
self.input_dir = Path(input_dir)
self.errors = errors
@ -103,10 +103,9 @@ class SimpleDirectoryReader(BaseReader):
new_input_files = new_input_files[0 : self.num_files_limit]
# print total number of files added
if self.verbose:
print(
f"> [SimpleDirectoryReader] Total files added: {len(new_input_files)}"
)
logging.debug(
f"> [SimpleDirectoryReader] Total files added: {len(new_input_files)}"
)
return new_input_files

View File

@ -19,7 +19,7 @@ index = GPTSimpleVectorIndex.load_from_disk('../vector_indices/index_simple.json
# query index
query_str = "What did the author do growing up?"
response = index.query(query_str, verbose=True)
response = index.query(query_str)
# Send response to Make.com webhook
wrapper = MakeWrapper()

View File

@ -23,9 +23,8 @@ class ObsidianReader(BaseReader):
"""
def __init__(self, input_dir: str, verbose: bool = False):
def __init__(self, input_dir: str):
"""Init params."""
self.verbose = verbose
self.input_dir = Path(input_dir)
def load_data(self, *args: Any, **load_kwargs: Any) -> List[Document]:

View File

@ -1,5 +1,6 @@
"""Read Arxiv Papers."""
import hashlib
import logging
import os
from typing import List, Optional
@ -16,10 +17,9 @@ class ArxivReader(BaseReader):
def __init__(
self,
verbose: bool = False,
):
"""Initialize with parameters."""
super().__init__(verbose)
super().__init__()
def _hacky_hash(self, some_string):
_hash = hashlib.md5(some_string.encode("utf-8")).hexdigest()
@ -50,8 +50,7 @@ class ArxivReader(BaseReader):
sort_by=arxiv.SortCriterion.Relevance,
)
search_results = list(arxiv_search.results())
if self.verbose:
print(f"> Successfully fetched {len(search_results)} paperes")
logging.debug(f"> Successfully fetched {len(search_results)} paperes")
if not os.path.exists(papers_dir):
os.makedirs(papers_dir)
@ -68,8 +67,7 @@ class ArxivReader(BaseReader):
# "summary": paper.summary
}
paper.download_pdf(dirpath=papers_dir, filename=filename)
if self.verbose:
print(f"> Downloading {filename}...")
logging.debug(f"> Downloading {filename}...")
def get_paper_metadata(filename):
return paper_lookup[filename]
@ -88,11 +86,9 @@ class ArxivReader(BaseReader):
try:
for f in os.listdir(papers_dir):
os.remove(os.path.join(papers_dir, f))
if self.verbose:
print(f"> Deleted file: {f}")
logging.debug(f"> Deleted file: {f}")
os.rmdir(papers_dir)
if self.verbose:
print(f"> Deleted directory: {papers_dir}")
logging.debug(f"> Deleted directory: {papers_dir}")
except OSError:
print("Unable to delete files or directory")

View File

@ -38,10 +38,9 @@ class QdrantReader(BaseReader):
api_key: Optional[str] = None,
prefix: Optional[str] = None,
timeout: Optional[float] = None,
verbose: bool = False,
):
"""Initialize with parameters."""
super().__init__(verbose)
super().__init__()
import qdrant_client # noqa: F401

View File

@ -13,7 +13,7 @@ from gpt_index import download_loader
S3Reader = download_loader("S3Reader")
loader = S3Reader(bucket='scrabble-dictionary', key='dictionary.txt')
loader = S3Reader(bucket='scrabble-dictionary', key='dictionary.txt', aws_access_id='[ACCESS_KEY_ID]', aws_access_secret='[ACCESS_KEY_SECRET]')
documents = loader.load_data()
```

View File

@ -24,10 +24,9 @@ class TwitterTweetReader(BaseReader):
self,
bearer_token: str,
num_tweets: Optional[int] = 100,
verbose: bool = False,
) -> None:
"""Initialize with parameters."""
super().__init__(verbose=verbose)
super().__init__()
self.bearer_token = bearer_token
self.num_tweets = num_tweets