Skip to content

Commit

Permalink
fix: Final Summary Prompt cause value error when final summary mode i…
Browse files Browse the repository at this point in the history
…s off.
  • Loading branch information
sean1832 committed Mar 25, 2023
1 parent ba92f8a commit e523b08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ async def summarize_experimental_concurrently(content: str, chunk_size: int = 10
chunks = convert_to_chunks(content, chunk_size)

REC_PROMPT = PromptTemplate(template=st.session_state['OPENAI_PERSONA_REC'], input_variables=['text'])
FINAL_PROMPT = PromptTemplate(template=st.session_state['OPENAI_PERSONA_SUM'], input_variables=['text'])
chain = LLMChain(llm=llm_rec, prompt=REC_PROMPT)

tasks = []
Expand All @@ -232,11 +231,12 @@ async def summarize_experimental_concurrently(content: str, chunk_size: int = 10
count += 1
rec_result = sorted(outputs_rec, key=lambda x: x['chunk_id'])
if st.session_state['FINAL_SUMMARY_MODE']:
FINAL_PROMPT = PromptTemplate(template=st.session_state['OPENAI_PERSONA_SUM'], input_variables=['text'])
chain = load_summarize_chain(llm_final, chain_type='stuff', prompt=FINAL_PROMPT)
docs = convert_to_docs(rec_result)
final_result = chain.run(docs)
else:
final_result = ''
final_result = None
return rec_result, final_result

@st.cache_data(show_spinner=False)
Expand Down

0 comments on commit e523b08

Please sign in to comment.