Spaces:
Build error
Build error
Update summ.py
Browse files
summ.py
CHANGED
@@ -9,7 +9,7 @@ from langchain.chains.combine_documents.stuff import StuffDocumentsChain
|
|
9 |
|
10 |
os.environ['OPENAI_API_KEY'] = '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'
|
11 |
|
12 |
-
llm = ChatOpenAI(temperature=0, model_name="gpt-4-
|
13 |
|
14 |
def get_summ(path):
|
15 |
|
@@ -27,6 +27,7 @@ def get_summ(path):
|
|
27 |
reduce_template = """The following is set of summaries:
|
28 |
{doc_summaries}
|
29 |
Take these and distill it into a final, consolidated summary of the main themes.
|
|
|
30 |
Helpful Answer:"""
|
31 |
reduce_prompt = PromptTemplate.from_template(reduce_template)
|
32 |
|
@@ -45,7 +46,7 @@ def get_summ(path):
|
|
45 |
# If documents exceed context for `StuffDocumentsChain`
|
46 |
collapse_documents_chain=combine_documents_chain,
|
47 |
# The maximum number of tokens to group documents into.
|
48 |
-
token_max=
|
49 |
)
|
50 |
|
51 |
# Combining documents by mapping a chain over them, then combining results
|
@@ -61,7 +62,7 @@ def get_summ(path):
|
|
61 |
)
|
62 |
|
63 |
text_splitter = CharacterTextSplitter.from_tiktoken_encoder(
|
64 |
-
chunk_size=
|
65 |
)
|
66 |
split_docs = text_splitter.split_documents(docs)
|
67 |
|
|
|
9 |
|
10 |
os.environ['OPENAI_API_KEY'] = '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'
|
11 |
|
12 |
+
llm = ChatOpenAI(temperature=0, model_name="gpt-4-0125-preview")
|
13 |
|
14 |
def get_summ(path):
|
15 |
|
|
|
27 |
reduce_template = """The following is set of summaries:
|
28 |
{doc_summaries}
|
29 |
Take these and distill it into a final, consolidated summary of the main themes.
|
30 |
+
Determine the genes relevant or irrelevant to the discussed disease, and incorporate any associated p-values if available.
|
31 |
Helpful Answer:"""
|
32 |
reduce_prompt = PromptTemplate.from_template(reduce_template)
|
33 |
|
|
|
46 |
# If documents exceed context for `StuffDocumentsChain`
|
47 |
collapse_documents_chain=combine_documents_chain,
|
48 |
# The maximum number of tokens to group documents into.
|
49 |
+
token_max=100000,
|
50 |
)
|
51 |
|
52 |
# Combining documents by mapping a chain over them, then combining results
|
|
|
62 |
)
|
63 |
|
64 |
text_splitter = CharacterTextSplitter.from_tiktoken_encoder(
|
65 |
+
chunk_size=100000, chunk_overlap=0
|
66 |
)
|
67 |
split_docs = text_splitter.split_documents(docs)
|
68 |
|