NicolasGaudemet commited on
Commit
d4b788f
1 Parent(s): 1e8280a

Update document_questioner_app.py

Browse files
Files changed (1) hide show
  1. document_questioner_app.py +2 -5
document_questioner_app.py CHANGED
@@ -18,18 +18,15 @@ def question_document(Document, Question):
18
 
19
  loader = PyPDFLoader(Document.name)
20
  docs = loader.load()
21
-
22
- # Set Open AI Key
23
- os.environ["OPENAI_API_KEY"] = os.environ['OpenaiKey']
24
 
25
  # Create embeddings
26
- embeddings = OpenAIEmbeddings()
27
 
28
  # Write in DB
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}
 
18
 
19
  loader = PyPDFLoader(Document.name)
20
  docs = loader.load()
 
 
 
21
 
22
  # Create embeddings
23
+ embeddings = OpenAIEmbeddings(openai_api_key = os.environ['OpenaiKey'])
24
 
25
  # Write in DB
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, openai_api_key = os.environ['OpenaiKey'])
30
 
31
  # Customize map_reduce prompts
32
  question_template = """{context}