diff --git a/cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/acreate_structured_output.py b/cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/acreate_structured_output.py index 6ef27e51d..3069993e9 100644 --- a/cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/acreate_structured_output.py +++ b/cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/acreate_structured_output.py @@ -1,7 +1,15 @@ import asyncio from typing import Type -from cognee.shared.logging_utils import get_logger +from pydantic import BaseModel +from tenacity import ( + retry, + stop_after_delay, + wait_exponential_jitter, + retry_if_not_exception_type, + before_sleep_log, +) +from cognee.shared.logging_utils import get_logger from cognee.infrastructure.llm.config import get_llm_config from cognee.infrastructure.llm.structured_output_framework.baml.baml_src.extraction.create_dynamic_baml_type import ( create_dynamic_baml_type, @@ -10,12 +18,17 @@ from cognee.infrastructure.llm.structured_output_framework.baml.baml_client.type TypeBuilder, ) from cognee.infrastructure.llm.structured_output_framework.baml.baml_client import b -from pydantic import BaseModel - +import logging logger = get_logger() +@retry( + stop=stop_after_delay(128), + wait=wait_exponential_jitter(2, 128), + before_sleep=before_sleep_log(logger, logging.DEBUG), + reraise=True, +) async def acreate_structured_output( text_input: str, system_prompt: str, response_model: Type[BaseModel] ):