diff --git a/autogpt_platform/backend/backend/blocks/exa/contents.py b/autogpt_platform/backend/backend/blocks/exa/contents.py index 663e4461d6a0..3250e6b9f9d9 100644 --- a/autogpt_platform/backend/backend/blocks/exa/contents.py +++ b/autogpt_platform/backend/backend/blocks/exa/contents.py @@ -82,7 +82,10 @@ def run( response = requests.post(url, headers=headers, json=payload) response.raise_for_status() data = response.json() - yield "results", data.get("results", []) + results = data.get("results", []) + if not results: + yield "error", "results are empty" + else: + yield "results", results except Exception as e: yield "error", str(e) - yield "results", [] diff --git a/autogpt_platform/backend/backend/blocks/exa/search.py b/autogpt_platform/backend/backend/blocks/exa/search.py index b11737de7474..ece5ffa7ea53 100644 --- a/autogpt_platform/backend/backend/blocks/exa/search.py +++ b/autogpt_platform/backend/backend/blocks/exa/search.py @@ -136,8 +136,10 @@ def run( response = requests.post(url, headers=headers, json=payload) response.raise_for_status() data = response.json() - # Extract just the results array from the response - yield "results", data.get("results", []) + results = data.get("results", []) + if not results: + yield "error", "results are empty" + else: + yield "results", results except Exception as e: yield "error", str(e) - yield "results", [] diff --git a/autogpt_platform/backend/backend/blocks/exa/similar.py b/autogpt_platform/backend/backend/blocks/exa/similar.py index 78c0ad5dacf9..af930b46b43a 100644 --- a/autogpt_platform/backend/backend/blocks/exa/similar.py +++ b/autogpt_platform/backend/backend/blocks/exa/similar.py @@ -122,7 +122,10 @@ def run( response = requests.post(url, headers=headers, json=payload) response.raise_for_status() data = response.json() - yield "results", data.get("results", []) + results = data.get("results", []) + if not results: + yield "error", "results are empty" + else: + yield "results", results except Exception as e: yield "error", str(e) - yield "results", []