Skip to content

Commit

Permalink
fix issue 743 (#753)
Browse files Browse the repository at this point in the history
Co-authored-by: FelixFehse <[email protected]>
  • Loading branch information
FelixFehse and FelixFehseTNG authored Apr 18, 2024
1 parent 6b7fbe1 commit 7236a1c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Fixes
- fix: `ExpectedSearchOutput` has only relevant fields and supports generic document-`ID` rather than just str
- fix: `SearchEvaluationLogic` explicitly compares documents by ids
- fix: In `RecusrsiveSummarize.do_run`, `num_generated_tokens` not uninitialized anymore. [See Issue 743.](https://github.com/Aleph-Alpha/intelligence-layer/issues/743).


## 0.9.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def do_run(
num_partial_summaries = 0
text_to_summarize = input.text
summary = ""
num_generated_tokens = 0
while True:
summarize_output = self.long_context_summarize_task.run(
LongContextSummarizeInput(
Expand Down
11 changes: 11 additions & 0 deletions tests/use_cases/summarize/test_recursive_summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ def test_recursive_summarize_stops_when_num_partial_summaries_stays_same(
assert output.generated_tokens > 50


def test_recursive_summarize_stops_when_num_partial_summaries_stays_same_with_empty_text(
steerable_long_context_summarize: SteerableLongContextSummarize,
) -> None:
max_tokens = 2048
input = RecursiveSummarizeInput(text="", max_tokens=max_tokens)
task = RecursiveSummarize(steerable_long_context_summarize)
output = task.run(input, NoOpTracer())

assert output.generated_tokens == 0


def test_recursive_summarize_stops_after_one_chunk(
recursive_counting_client: RecursiveCountingClient,
) -> None:
Expand Down

0 comments on commit 7236a1c

Please sign in to comment.