feat(assistant): improve prompt summary (#2435)

This pull request improves the prompt summary in the assistant code. It
updates the map_template and reduce_template to provide clearer
instructions for identifying main themes, key points, and important
information in each section of a document. The reduce_template also
specifies that the final summary should include the main themes, key
points, and important information of the entire document.

<!--
ELLIPSIS_HIDDEN
-->


----

| <a href="https://ellipsis.dev" target="_blank"><img
src="https://avatars.githubusercontent.com/u/80834858?s=400&u=31e596315b0d8f7465b3ee670f25cea677299c96&v=4"
alt="Ellipsis" width="30px" height="30px"/></a> | 🚀 This PR
description was created by [Ellipsis](https://www.ellipsis.dev) for
commit 456736a41d. |
|--------|--------|

### Summary:
This PR enhances the document summarization process in the
`SummaryAssistant` class by providing clearer instructions for
identifying main themes, key points, and important information in each
section of a document.

**Key points**:
- Updated `map_template` and `reduce_template` in `process_assistant`
function of `SummaryAssistant` class.
- Changes provide clearer instructions for summarizing documents.
- Final summary should include main themes, key points, and important
information of the entire document.


----
Generated with ❤️ by [ellipsis.dev](https://www.ellipsis.dev)



<!--
ELLIPSIS_HIDDEN
-->
This commit is contained in:
Stan Girard 2024-04-16 14:03:36 -07:00 committed by GitHub
parent 1931848262
commit ed814de1c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -87,18 +87,19 @@ class SummaryAssistant(ITO):
llm = ChatLiteLLM(model="gpt-3.5-turbo")
map_template = """The following is a set of documents
map_template = """The following is one document to summarize that has been split into multiple sections:
{docs}
Based on this list of docs, please identify the main themes
Helpful Answer:"""
Based on the section, please identify the main themes, key points, and important information in each section.
Helpful Knowledge:"""
map_prompt = PromptTemplate.from_template(map_template)
map_chain = LLMChain(llm=llm, prompt=map_prompt)
# Reduce
reduce_template = """The following is set of summaries:
reduce_template = """The following is set of summaries for each section of the document:
{docs}
Take these and distill it into a final, consolidated summary of the main themes.
Helpful Answer:"""
Take these and distill it into a final, consolidated summary of the document. Make sure to include the main themes, key points, and important information.
Use markdown, headings, bullet points, or any other formatting to make the summary clear and easy to read.
Summary:"""
reduce_prompt = PromptTemplate.from_template(reduce_template)
# Run chain