Commit
·
8fd452b
1
Parent(s):
3cfd42f
Update document_questioner_app.py
Browse files
document_questioner_app.py
CHANGED
@@ -18,6 +18,9 @@ def question_document(Document, Question):
|
|
18 |
|
19 |
loader = PyPDFLoader(Document.name)
|
20 |
docs = loader.load()
|
|
|
|
|
|
|
21 |
|
22 |
# Create embeddings
|
23 |
embeddings = OpenAIEmbeddings()
|
@@ -26,7 +29,7 @@ def question_document(Document, Question):
|
|
26 |
docsearch = Chroma.from_documents(docs, embeddings, ids=["page" + str(d.metadata["page"]) for d in docs])
|
27 |
|
28 |
# Define LLM
|
29 |
-
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0.2
|
30 |
|
31 |
# Customize map_reduce prompts
|
32 |
question_template = """{context}
|
|
|
18 |
|
19 |
loader = PyPDFLoader(Document.name)
|
20 |
docs = loader.load()
|
21 |
+
|
22 |
+
# Set Open AI Key
|
23 |
+
openai_api_key = os.environ['OpenaiKey']
|
24 |
|
25 |
# Create embeddings
|
26 |
embeddings = OpenAIEmbeddings()
|
|
|
29 |
docsearch = Chroma.from_documents(docs, embeddings, ids=["page" + str(d.metadata["page"]) for d in docs])
|
30 |
|
31 |
# Define LLM
|
32 |
+
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0.2)
|
33 |
|
34 |
# Customize map_reduce prompts
|
35 |
question_template = """{context}
|