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.

Update llm.py (#8513)

Nicholas Tindle74d8aa6d90be
diff --git a/autogpt_platform/backend/backend/blocks/llm.py b/autogpt_platform/backend/backend/blocks/llm.py
index d6373347c0..2262e50e77 100644
--- a/autogpt_platform/backend/backend/blocks/llm.py
+++ b/autogpt_platform/backend/backend/blocks/llm.py
@@ -519,18 +519,24 @@ class AITextGeneratorBlock(Block):
test_mock={"llm_call": lambda *args, **kwargs: "Response text"},
)
- def llm_call(self, input_data: AIStructuredResponseGeneratorBlock.Input) -> str:
+ def llm_call(
+ self,
+ input_data: AIStructuredResponseGeneratorBlock.Input,
+ credentials: APIKeyCredentials,
+ ) -> str:
block = AIStructuredResponseGeneratorBlock()
- response = block.run_once(input_data, "response")
+ response = block.run_once(input_data, "response", credentials=credentials)
self.merge_stats(block.execution_stats)
return response["response"]
- def run(self, input_data: Input, **kwargs) -> BlockOutput:
+ def run(
+ self, input_data: Input, *, credentials: APIKeyCredentials, **kwargs
+ ) -> BlockOutput:
object_input_data = AIStructuredResponseGeneratorBlock.Input(
**{attr: getattr(input_data, attr) for attr in input_data.model_fields},
expected_format={},
)
- yield "response", self.llm_call(object_input_data)
+ yield "response", self.llm_call(object_input_data, credentials)
class SummaryStyle(Enum):