From 117a6e2e31c4f053baeef49afeaef93c683619fd Mon Sep 17 00:00:00 2001 From: Michael Dyer Date: Fri, 9 Aug 2024 08:24:46 -0500 Subject: [PATCH] Add hard limit on generated competencies to max_n --- app/pipeline/competency_extraction_pipeline.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/pipeline/competency_extraction_pipeline.py b/app/pipeline/competency_extraction_pipeline.py index 7716aff..99ac0a2 100644 --- a/app/pipeline/competency_extraction_pipeline.py +++ b/app/pipeline/competency_extraction_pipeline.py @@ -66,8 +66,8 @@ def __call__( generated_competencies: list[Competency] = [] - # Find all competencies in the response - competencies = response.split("\n\n") + # Find all competencies in the response up to the max_n + competencies = response.split("\n\n")[: dto.max_n] for i, competency in enumerate(competencies): logger.debug(f"Processing competency {i + 1}: {competency}") if "{" not in competency or "}" not in competency: