Skip to content

Commit

Permalink
Update config and output prints
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethleungty committed Jul 9, 2023
1 parent 37ab97e commit 7a96b02
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ DB_FAISS_PATH: 'vectorstore/db_faiss'
MODEL_TYPE: 'mpt'
MODEL_BIN_PATH: 'models/mpt-7b-instruct.ggmlv3.q8_0.bin'
MAX_NEW_TOKENS: 256
TEMPERATURE: 0.1
TEMPERATURE: 0.01
13 changes: 11 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@
response = dbqa({'query': args.input})
end = timeit.default_timer()

print(response['result'])
print(f'\nAnswer: {response["result"]}')
print('='*50)
print(response['source_documents'])

# Process source documents
source_docs = response['source_documents']
for i, doc in enumerate(source_docs):
print(f'\nSource Document {i+1}\n')
print(f'Source Text: {doc.page_content}')
print(f'Document Name: {doc.metadata["source"]}')
print(f'Page Number: {doc.metadata["page"]}\n')
print('='* 60)

print(f"Time to retrieve response: {end - start}")
5 changes: 2 additions & 3 deletions src/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
# as it is highly sensitive to whitespace changes. For example, it could have problems generating
# a summary from the pieces of context if the spacing is not done correctly

qa_template = """Use the following pieces of information to answer the user's question.
qa_template = """Use the following pieces of information to answer the user's question.
If you don't know the answer, just say that you don't know, don't try to make up an answer.
And remember to only return the helpful answer and nothing else.
Context: {context}
Question: {question}
Only return the helpful answer below and nothing else.
Helpful answer:
"""

0 comments on commit 7a96b02

Please sign in to comment.