Created
October 3, 2023 16:09
-
-
Save EnkrateiaLucca/578d9276bc422d5eb061ea5e29f12ec6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
persist_directory = "./" | |
pdf = "./Mental_Links_to_Excellence.pdf" | |
loader = PyPDFLoader(pdf) | |
pdf_doc = loader.load_and_split() | |
embeddings = OpenAIEmbeddings() | |
vectordb = Chroma.from_documents(pdf_doc, embedding=embeddings,\ | |
persist_directory=persist_directory) | |
vectordb.persist() | |
pdf_qa = ChatVectorDBChain.from_llm(OpenAI(temperature=0,\ | |
model_name="gpt-4"), vectordb, return_source_documents=True) | |
query = "What are the habits of high performers?" | |
result = pdf_qa({"question": query, "chat_history": ""}) | |
print("ANSWER") | |
print(result["answer"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment