From 32966bea11dc595d752f89502bbe7e0a2240ba28 Mon Sep 17 00:00:00 2001 From: ntohidi Date: Thu, 15 May 2025 10:09:19 +0200 Subject: [PATCH] fix(extraction): resolve `'str' object has no attribute 'choices'` error in LLMExtractionStrategy. Refs: #979 This patch ensures consistent handling of `response.choices[0].message.content` by avoiding redefinition of the `response` variable, which caused downstream exceptions during error handling. --- crawl4ai/extraction_strategy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crawl4ai/extraction_strategy.py b/crawl4ai/extraction_strategy.py index 245abc54..6be084b3 100644 --- a/crawl4ai/extraction_strategy.py +++ b/crawl4ai/extraction_strategy.py @@ -680,7 +680,7 @@ class LLMExtractionStrategy(ExtractionStrategy): block["error"] = False except Exception: parsed, unparsed = split_and_parse_json_objects( - response.choices[0].message.content + response ) blocks = parsed if unparsed: