diff --git a/autogpt_platform/backend/backend/blocks/llm.py b/autogpt_platform/backend/backend/blocks/llm.py index d796b9f66c..af630c35cc 100644 --- a/autogpt_platform/backend/backend/blocks/llm.py +++ b/autogpt_platform/backend/backend/blocks/llm.py @@ -252,12 +252,12 @@ MODEL_METADATA = { LlmModel.COHERE_COMMAND_R_PLUS_08_2024: ModelMetadata("open_router", 128000, 4096), LlmModel.DEEPSEEK_CHAT: ModelMetadata("open_router", 64000, 2048), LlmModel.DEEPSEEK_R1_0528: ModelMetadata("open_router", 163840, 163840), - LlmModel.PERPLEXITY_SONAR: ModelMetadata("open_router", 127000, 127000), + LlmModel.PERPLEXITY_SONAR: ModelMetadata("open_router", 127000, 8000), LlmModel.PERPLEXITY_SONAR_PRO: ModelMetadata("open_router", 200000, 8000), LlmModel.PERPLEXITY_SONAR_DEEP_RESEARCH: ModelMetadata( "open_router", 128000, - 128000, + 16000, ), LlmModel.NOUSRESEARCH_HERMES_3_LLAMA_3_1_405B: ModelMetadata( "open_router", 131000, 4096 @@ -797,7 +797,7 @@ class AIStructuredResponseGeneratorBlock(AIBlockBase): default="", description="The system prompt to provide additional context to the model.", ) - conversation_history: list[dict] = SchemaField( + conversation_history: list[dict] | None = SchemaField( default_factory=list, description="The conversation history to provide context for the prompt.", ) @@ -904,7 +904,7 @@ class AIStructuredResponseGeneratorBlock(AIBlockBase): self, input_data: Input, *, credentials: APIKeyCredentials, **kwargs ) -> BlockOutput: logger.debug(f"Calling LLM with input data: {input_data}") - prompt = [json.to_dict(p) for p in input_data.conversation_history] + prompt = [json.to_dict(p) for p in input_data.conversation_history or [] if p] values = input_data.prompt_values if values: diff --git a/autogpt_platform/backend/backend/blocks/smart_decision_maker.py b/autogpt_platform/backend/backend/blocks/smart_decision_maker.py index a5b3959313..5f9d562e60 100644 --- a/autogpt_platform/backend/backend/blocks/smart_decision_maker.py +++ b/autogpt_platform/backend/backend/blocks/smart_decision_maker.py @@ -121,13 +121,16 @@ def _convert_raw_response_to_dict(raw_response: Any) -> dict[str, Any]: return json.to_dict(raw_response) -def get_pending_tool_calls(conversation_history: list[Any]) -> dict[str, int]: +def get_pending_tool_calls(conversation_history: list[Any] | None) -> dict[str, int]: """ All the tool calls entry in the conversation history requires a response. This function returns the pending tool calls that has not generated an output yet. Return: dict[str, int] - A dictionary of pending tool call IDs with their count. """ + if not conversation_history: + return {} + pending_calls = Counter() for history in conversation_history: for call_id in _get_tool_requests(history): @@ -173,7 +176,7 @@ class SmartDecisionMakerBlock(Block): "Function parameters that has no default value and not optional typed has to be provided. ", description="The system prompt to provide additional context to the model.", ) - conversation_history: list[dict] = SchemaField( + conversation_history: list[dict] | None = SchemaField( default_factory=list, description="The conversation history to provide context for the prompt.", ) @@ -605,10 +608,10 @@ class SmartDecisionMakerBlock(Block): tool_functions = await self._create_tool_node_signatures(node_id) yield "tool_functions", json.dumps(tool_functions) - input_data.conversation_history = input_data.conversation_history or [] - prompt = [json.to_dict(p) for p in input_data.conversation_history if p] + conversation_history = input_data.conversation_history or [] + prompt = [json.to_dict(p) for p in conversation_history if p] - pending_tool_calls = get_pending_tool_calls(input_data.conversation_history) + pending_tool_calls = get_pending_tool_calls(conversation_history) if pending_tool_calls and input_data.last_tool_output is None: raise ValueError(f"Tool call requires an output for {pending_tool_calls}") diff --git a/autogpt_platform/backend/poetry.lock b/autogpt_platform/backend/poetry.lock index 99cd853032..d5f35aacb3 100644 --- a/autogpt_platform/backend/poetry.lock +++ b/autogpt_platform/backend/poetry.lock @@ -5823,14 +5823,14 @@ files = [ [[package]] name = "sentry-sdk" -version = "2.42.1" +version = "2.44.0" description = "Python client for Sentry (https://sentry.io)" optional = false python-versions = ">=3.6" groups = ["main"] files = [ - {file = "sentry_sdk-2.42.1-py2.py3-none-any.whl", hash = "sha256:f8716b50c927d3beb41bc88439dc6bcd872237b596df5b14613e2ade104aee02"}, - {file = "sentry_sdk-2.42.1.tar.gz", hash = "sha256:8598cc6edcfe74cb8074ba6a7c15338cdee93d63d3eb9b9943b4b568354ad5b6"}, + {file = "sentry_sdk-2.44.0-py2.py3-none-any.whl", hash = "sha256:9e36a0372b881e8f92fdbff4564764ce6cec4b7f25424d0a3a8d609c9e4651a7"}, + {file = "sentry_sdk-2.44.0.tar.gz", hash = "sha256:5b1fe54dfafa332e900b07dd8f4dfe35753b64e78e7d9b1655a28fd3065e2493"}, ] [package.dependencies] @@ -5870,11 +5870,13 @@ launchdarkly = ["launchdarkly-server-sdk (>=9.8.0)"] litellm = ["litellm (>=1.77.5)"] litestar = ["litestar (>=2.0.0)"] loguru = ["loguru (>=0.5)"] +mcp = ["mcp (>=1.15.0)"] openai = ["openai (>=1.0.0)", "tiktoken (>=0.3.0)"] openfeature = ["openfeature-sdk (>=0.7.1)"] opentelemetry = ["opentelemetry-distro (>=0.35b0)"] opentelemetry-experimental = ["opentelemetry-distro"] pure-eval = ["asttokens", "executing", "pure_eval"] +pydantic-ai = ["pydantic-ai (>=1.0.0)"] pymongo = ["pymongo (>=3.1)"] pyspark = ["pyspark (>=2.4.4)"] quart = ["blinker (>=1.1)", "quart (>=0.16.1)"] @@ -7277,4 +7279,4 @@ cffi = ["cffi (>=1.11)"] [metadata] lock-version = "2.1" python-versions = ">=3.10,<3.14" -content-hash = "4d7134993527a5ff91b531a4e28b36bcab7cef2db18cf00702a950e34ae9ea1d" +content-hash = "d34d968002974be23e45ae755af676032114a2272a42f36157227ad976624533" diff --git a/autogpt_platform/backend/pyproject.toml b/autogpt_platform/backend/pyproject.toml index 7c517c8d67..e5f22c9ba5 100644 --- a/autogpt_platform/backend/pyproject.toml +++ b/autogpt_platform/backend/pyproject.toml @@ -58,7 +58,7 @@ python-multipart = "^0.0.20" redis = "^6.2.0" regex = "^2025.9.18" replicate = "^1.0.6" -sentry-sdk = {extras = ["anthropic", "fastapi", "launchdarkly", "openai", "sqlalchemy"], version = "^2.33.2"} +sentry-sdk = {extras = ["anthropic", "fastapi", "launchdarkly", "openai", "sqlalchemy"], version = "^2.44.0"} sqlalchemy = "^2.0.40" strenum = "^0.4.9" stripe = "^11.5.0"