Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ texts = text_splitter.split_documents(documents)
|
|
24 |
#vector embedding
|
25 |
embeddings = OpenAIEmbeddings()
|
26 |
vector_store = Chroma.from_documents(texts, embeddings)
|
27 |
-
retriever = vector_store.as_retriever(search_kwargs={"k":
|
28 |
|
29 |
|
30 |
from langchain.prompts.chat import (
|
@@ -33,8 +33,9 @@ from langchain.prompts.chat import (
|
|
33 |
HumanMessagePromptTemplate,
|
34 |
)
|
35 |
|
36 |
-
system_template="""
|
37 |
-
|
|
|
38 |
If you don't know the answer, just say that "I don't know", don't try to make up an answer.
|
39 |
----------------
|
40 |
{summaries}
|
@@ -53,7 +54,7 @@ from langchain.chains import RetrievalQAWithSourcesChain
|
|
53 |
|
54 |
chain_type_kwargs = {"prompt": prompt}
|
55 |
|
56 |
-
llm = ChatOpenAI(model_name="gpt-3.5", temperature=0) # Modify model_name if you have access to GPT-4
|
57 |
|
58 |
chain = RetrievalQAWithSourcesChain.from_chain_type(
|
59 |
llm=llm,
|
|
|
24 |
#vector embedding
|
25 |
embeddings = OpenAIEmbeddings()
|
26 |
vector_store = Chroma.from_documents(texts, embeddings)
|
27 |
+
retriever = vector_store.as_retriever(search_kwargs={"k": 3})
|
28 |
|
29 |
|
30 |
from langchain.prompts.chat import (
|
|
|
33 |
HumanMessagePromptTemplate,
|
34 |
)
|
35 |
|
36 |
+
system_template="""Your name is Sayno. You act like a successful rich man.
|
37 |
+
Never reveal that it is an AI. Use the following pieces of context to answer the users question shortly.
|
38 |
+
Given the following summaries of a long document and a question, create a final answer with references.
|
39 |
If you don't know the answer, just say that "I don't know", don't try to make up an answer.
|
40 |
----------------
|
41 |
{summaries}
|
|
|
54 |
|
55 |
chain_type_kwargs = {"prompt": prompt}
|
56 |
|
57 |
+
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0) # Modify model_name if you have access to GPT-4
|
58 |
|
59 |
chain = RetrievalQAWithSourcesChain.from_chain_type(
|
60 |
llm=llm,
|