Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(backend): Extract response from LLM response dictionary (#11262)

seer-by-sentry[bot]377657f8a182
diff --git a/autogpt_platform/backend/backend/blocks/llm.py b/autogpt_platform/backend/backend/blocks/llm.py
index f6c04f7644..6d92a6796f 100644
--- a/autogpt_platform/backend/backend/blocks/llm.py
+++ b/autogpt_platform/backend/backend/blocks/llm.py
@@ -1554,7 +1554,9 @@ class AIConversationBlock(AIBlockBase):
("prompt", list),
],
test_mock={
- "llm_call": lambda *args, **kwargs: "The 2020 World Series was played at Globe Life Field in Arlington, Texas."
+ "llm_call": lambda *args, **kwargs: dict(
+ response="The 2020 World Series was played at Globe Life Field in Arlington, Texas."
+ )
},
)
@@ -1583,7 +1585,7 @@ class AIConversationBlock(AIBlockBase):
),
credentials=credentials,
)
- yield "response", response
+ yield "response", response["response"]
yield "prompt", self.prompt
diff --git a/autogpt_platform/backend/backend/blocks/test/test_llm.py b/autogpt_platform/backend/backend/blocks/test/test_llm.py
index 07e8a7f732..baf691ac3e 100644
--- a/autogpt_platform/backend/backend/blocks/test/test_llm.py
+++ b/autogpt_platform/backend/backend/blocks/test/test_llm.py
@@ -362,7 +362,7 @@ class TestLLMStatsTracking:
assert block.execution_stats.llm_call_count == 1
# Check output
- assert outputs["response"] == {"response": "AI response to conversation"}
+ assert outputs["response"] == "AI response to conversation"
@pytest.mark.asyncio
async def test_ai_list_generator_with_retries(self):