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(block): Disable LLM blocks parallel tool calls (#9834)
Zamil Majdyf6a4b036c74d
diff --git a/autogpt_platform/backend/backend/blocks/llm.py b/autogpt_platform/backend/backend/blocks/llm.pyindex e66922bbaa..00a5ffa9a2 100644--- a/autogpt_platform/backend/backend/blocks/llm.py+++ b/autogpt_platform/backend/backend/blocks/llm.py@@ -9,7 +9,6 @@ from typing import Any, Iterable, List, Literal, NamedTuple, Optionalimport anthropicimport ollamaimport openai-from anthropic import NotGivenfrom anthropic.types import ToolParamfrom groq import Groqfrom pydantic import BaseModel, SecretStr@@ -249,7 +248,7 @@ class LLMResponse(BaseModel):def convert_openai_tool_fmt_to_anthropic(openai_tools: list[dict] | None = None,-) -> Iterable[ToolParam] | NotGiven:+) -> Iterable[ToolParam] | anthropic.NotGiven:"""Convert OpenAI tool format to Anthropic tool format."""@@ -287,6 +286,7 @@ def llm_call(max_tokens: int | None,tools: list[dict] | None = None,ollama_host: str = "localhost:11434",+ parallel_tool_calls: bool | None = None,) -> LLMResponse:"""Make a call to a language model.@@ -332,6 +332,9 @@ def llm_call(response_format=response_format, # type: ignoremax_completion_tokens=max_tokens,tools=tools_param, # type: ignore+ parallel_tool_calls=(+ openai.NOT_GIVEN if parallel_tool_calls is None else parallel_tool_calls+ ),)if response.choices[0].message.tool_calls:@@ -487,6 +490,9 @@ def llm_call(messages=prompt, # type: ignoremax_tokens=max_tokens,tools=tools_param, # type: ignore+ parallel_tool_calls=(+ openai.NOT_GIVEN if parallel_tool_calls is None else parallel_tool_calls+ ),)# If there's no response, raise an errordiff --git a/autogpt_platform/backend/backend/blocks/smart_decision_maker.py b/autogpt_platform/backend/backend/blocks/smart_decision_maker.pyindex 539874d2bf..7e359df4ae 100644--- a/autogpt_platform/backend/backend/blocks/smart_decision_maker.py+++ b/autogpt_platform/backend/backend/blocks/smart_decision_maker.py@@ -491,6 +491,7 @@ class SmartDecisionMakerBlock(Block):max_tokens=input_data.max_tokens,tools=tool_functions,ollama_host=input_data.ollama_host,+ parallel_tool_calls=False,)if not response.tool_calls: