Skip to content

Commit

Permalink
Update prepdocs.py
Browse files Browse the repository at this point in the history
* Convert comment for read_files function to DocString
* Handing over `use_vectors` variable in the recursive call
  • Loading branch information
PfisterAn authored Aug 31, 2023
1 parent 5909e64 commit 9126146
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/prepdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,12 @@ def refresh_openai_token():
openai.api_key = token_cred.get_token("https://cognitiveservices.azure.com/.default").token
open_ai_token_cache[CACHE_KEY_CREATED_TIME] = time.time()

# recursively read the directory to allow for a subdirectory structure
def read_files(location, use_vectors):
for filename in glob.glob(location):
"""Readfile function
recursively read directory structure under `pathPattern` and execute indexing for the individual files
"""
def read_files(pathPattern, use_vectors):
for filename in glob.glob(pathPattern):
if args.verbose: print(f"Processing '{filename}'")
if args.remove:
remove_blobs(filename)
Expand All @@ -326,7 +329,7 @@ def read_files(location, use_vectors):
remove_from_index(None)
else:
if os.path.isdir(filename):
read_files(filename + "/*")
read_files(filename + "/*", use_vectors)
continue
try:
if not args.skipblobs:
Expand Down

0 comments on commit 9126146

Please sign in to comment.