Fixes and added command line tool to run RAG
This commit is contained in:
parent
d2e0a29d42
commit
30678539e7
5 changed files with 32 additions and 10 deletions
|
|
@ -29,13 +29,15 @@ After that, you can run:
|
|||
|
||||
```docker compose up promethai_mem ```
|
||||
|
||||
``` poetry shell ```
|
||||
|
||||
Make sure to run
|
||||
|
||||
``` python scripts/create_database.py ```
|
||||
|
||||
After that, you can run:
|
||||
|
||||
``` python test_runner.py \
|
||||
``` python rag_test_manager.py \
|
||||
--url "https://www.ibiblio.org/ebooks/London/Call%20of%20Wild.pdf" \
|
||||
--test_set "example_data/test_set.json" \
|
||||
--user_id "666" \
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@
|
|||
"owner": "John Doe",
|
||||
"license": "MIT",
|
||||
"validity_start": "2023-08-01",
|
||||
"validity_end": "2024-07-31",
|
||||
"validity_end": "2024-07-31"
|
||||
}
|
||||
|
|
@ -436,14 +436,32 @@ async def main():
|
|||
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.test_set, "r") as file:
|
||||
test_set = json.load(file)
|
||||
try:
|
||||
with open(args.test_set, "r") as file:
|
||||
test_set = json.load(file)
|
||||
if not isinstance(test_set, list): # Expecting a list
|
||||
raise TypeError("Parsed test_set JSON is not a list.")
|
||||
except Exception as e:
|
||||
print(f"Error loading test_set: {str(e)}")
|
||||
return
|
||||
|
||||
with open(args.metadata, "r") as file:
|
||||
metadata = json.load(file)
|
||||
try:
|
||||
with open(args.metadata, "r") as file:
|
||||
metadata = json.load(file)
|
||||
if not isinstance(metadata, dict):
|
||||
raise TypeError("Parsed metadata JSON is not a dictionary.")
|
||||
except Exception as e:
|
||||
print(f"Error loading metadata: {str(e)}")
|
||||
return
|
||||
|
||||
if args.params:
|
||||
params = json.loads(args.params)
|
||||
try:
|
||||
params = json.loads(args.params)
|
||||
if not isinstance(params, dict):
|
||||
raise TypeError("Parsed params JSON is not a dictionary.")
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"Error parsing params: {str(e)}")
|
||||
return
|
||||
else:
|
||||
params = None
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from langchain.document_loaders import PyPDFLoader
|
||||
import sys, os
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
from level_3.shared.chunk_strategy import ChunkStrategy
|
||||
from shared.chunk_strategy import ChunkStrategy
|
||||
import re
|
||||
def chunk_data(chunk_strategy=None, source_data=None, chunk_size=None, chunk_overlap=None):
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
from io import BytesIO
|
||||
import fitz
|
||||
# sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from level_3.vectordb.chunkers.chunkers import chunk_data
|
||||
from vectordb.chunkers.chunkers import chunk_data
|
||||
from llama_hub.file.base import SimpleDirectoryReader
|
||||
|
||||
import requests
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue