KushwanthK commited on
Commit
71d9ba3
1 Parent(s): 5a477d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -116,6 +116,9 @@ def prompt_engineer(text, longtext, query):
116
  from langchain.chains.combine_documents import create_stuff_documents_chain
117
  from langchain.chains.llm import LLMChain
118
  from langchain_core.prompts import ChatPromptTemplate
 
 
 
119
 
120
  # Define prompt
121
  prompt = ChatPromptTemplate.from_messages(
@@ -126,7 +129,7 @@ def prompt_engineer(text, longtext, query):
126
  chain = create_stuff_documents_chain(llm, prompt)
127
 
128
  # Invoke chain
129
- summary = chain.invoke({"context": longtext})
130
 
131
  with st.sidebar:
132
  st.divider()
 
116
  from langchain.chains.combine_documents import create_stuff_documents_chain
117
  from langchain.chains.llm import LLMChain
118
  from langchain_core.prompts import ChatPromptTemplate
119
+ from langchain.docstore.document import Document
120
+
121
+ docs = Document(page_content=longtext, metadata={"source": "local"})
122
 
123
  # Define prompt
124
  prompt = ChatPromptTemplate.from_messages(
 
129
  chain = create_stuff_documents_chain(llm, prompt)
130
 
131
  # Invoke chain
132
+ summary = chain.invoke({"context": docs})
133
 
134
  with st.sidebar:
135
  st.divider()