Make scripts executeable, add basic pre-commit setup

This commit is contained in:
MDW 2023-05-18 02:08:52 +02:00
parent 4cda348cf8
commit 7f918a9fa1
3 changed files with 50 additions and 4 deletions

7
privateGPT.py Normal file → Executable file
View file

@ -1,3 +1,4 @@
#!/usr/bin/env python3
from dotenv import load_dotenv
from langchain.chains import RetrievalQA
from langchain.embeddings import HuggingFaceEmbeddings
@ -37,9 +38,9 @@ def main():
query = input("\nEnter a query: ")
if query == "exit":
break
# Get the answer from the chain
res = qa(query)
res = qa(query)
answer, docs = res['result'], res['source_documents']
# Print the result
@ -47,7 +48,7 @@ def main():
print(query)
print("\n> Answer:")
print(answer)
# Print the relevant sources used for the answer
for document in docs:
print("\n> " + document.metadata["source"] + ":")