Skip to content

Commit b8522dd

Browse files
adding summary_overlap config variable
1 parent 270633c commit b8522dd

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

configs/config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ generation:
5252
num_cot_enhance_examples: null # Maximum number of conversations to enhance (null = enhance all)
5353
batch_size: 32 # Number of requests to batch together (for create)
5454
max_context_length: 8000 # Context Length of the MODEL. Useful while Generating Summary
55-
55+
summary_overlap: 0 # Overlap between chunks to maintain context. Useful while Generating Summary
56+
5657
# Content curation parameters
5758
curate:
5859
threshold: 7.0 # Default quality threshold (1-10)

synthetic_data_kit/generators/qa_generator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,17 @@ def generate_summary(self,
3939
if verbose:
4040
print("Generating document summary...")
4141

42-
# Get summary prompt from config
42+
# Get summary prompt and params from config
4343
prompt = get_prompt(self.config, "summary")
4444
max_context_length = self.generation_config.get("max_context_length", 8000)
45+
summary_overlap = self.generation_config.get("summary_overlap", 0)
4546

4647
if rolling_summary:
4748
summary_per_chunk = []
4849
#split text into long chunks for summarization
4950
chunks = split_into_chunks(document_text,
5051
chunk_size=max_context_length,
51-
overlap=0)
52+
overlap=summary_overlap)
5253

5354
for chunk in chunks:
5455
messages = [

0 commit comments

Comments
 (0)