Chris Alexiuk commited on
Commit
eb19f80
1 Parent(s): 944828c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -31
app.py CHANGED
@@ -14,35 +14,6 @@ import arxiv
14
  import chainlit as cl
15
  from chainlit import user_session
16
 
17
- user_env = user_session.get("env")
18
-
19
- system_template = """Use the following pieces of context to answer the users question.
20
- If you don't know the answer, just say that you don't know, don't try to make up an answer.
21
- ALWAYS return a "SOURCES" part in your answer.
22
- The "SOURCES" part should be a reference to the source of the document from which you got your answer.
23
-
24
- Example of your response should be:
25
-
26
- ```
27
- The answer is foo
28
-
29
- SOURCES:
30
- Title: xyz
31
- Page Number: 1
32
- URL: https://arxiv.org/abs/X.Y.Z
33
- ```
34
-
35
- Begin!
36
- ----------------
37
- {summaries}"""
38
- messages = [
39
- SystemMessagePromptTemplate.from_template(system_template),
40
- HumanMessagePromptTemplate.from_template("{question}"),
41
- ]
42
- prompt = ChatPromptTemplate.from_messages(messages)
43
- chain_type_kwargs = {"prompt": prompt}
44
-
45
-
46
  @cl.langchain_factory
47
  def init():
48
  arxiv_query = None
@@ -76,7 +47,6 @@ def init():
76
  # Create a Chroma vector store
77
  embeddings = OpenAIEmbeddings(
78
  disallowed_special=(),
79
- openai_api_key=user_env.get("OPENAI_API_KEY")
80
  )
81
  docsearch = Chroma.from_documents(pdf_data, embeddings)
82
 
@@ -85,7 +55,6 @@ def init():
85
  ChatOpenAI(
86
  model_name="gpt-4",
87
  temperature=0,
88
- openai_api_key=user_env.get("OPENAI_API_KEY"),
89
  ),
90
  chain_type="stuff",
91
  retriever=docsearch.as_retriever(),
 
14
  import chainlit as cl
15
  from chainlit import user_session
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  @cl.langchain_factory
18
  def init():
19
  arxiv_query = None
 
47
  # Create a Chroma vector store
48
  embeddings = OpenAIEmbeddings(
49
  disallowed_special=(),
 
50
  )
51
  docsearch = Chroma.from_documents(pdf_data, embeddings)
52
 
 
55
  ChatOpenAI(
56
  model_name="gpt-4",
57
  temperature=0,
 
58
  ),
59
  chain_type="stuff",
60
  retriever=docsearch.as_retriever(),