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): Fix 4 (deprecation) warnings on startup (#10759)
Reinier van der Leerdf3c81a7a683
diff --git a/autogpt_platform/backend/backend/blocks/exa/websets.py b/autogpt_platform/backend/backend/blocks/exa/websets.pyindex bec57e01d9..37e0971d92 100644--- a/autogpt_platform/backend/backend/blocks/exa/websets.py+++ b/autogpt_platform/backend/backend/blocks/exa/websets.py@@ -93,11 +93,11 @@ class Webset(BaseModel):"""Set of key-value pairs you want to associate with this object."""- created_at: Annotated[datetime, Field(alias="createdAt")] | None = None+ created_at: Annotated[datetime | None, Field(alias="createdAt")] = None"""The date and time the webset was created"""- updated_at: Annotated[datetime, Field(alias="updatedAt")] | None = None+ updated_at: Annotated[datetime | None, Field(alias="updatedAt")] = None"""The date and time the webset was last updated"""diff --git a/autogpt_platform/backend/backend/blocks/wordpress/_api.py b/autogpt_platform/backend/backend/blocks/wordpress/_api.pyindex 070dbd898b..78f535947b 100644--- a/autogpt_platform/backend/backend/blocks/wordpress/_api.py+++ b/autogpt_platform/backend/backend/blocks/wordpress/_api.py@@ -4,6 +4,8 @@ from logging import getLoggerfrom typing import Any, Dict, List, Unionfrom urllib.parse import urlencode+from pydantic import field_serializer+from backend.sdk import BaseModel, Credentials, Requestslogger = getLogger(__name__)@@ -382,8 +384,9 @@ class CreatePostRequest(BaseModel):# Advancedmetadata: List[Dict[str, Any]] | None = None- class Config:- json_encoders = {datetime: lambda v: v.isoformat()}+ @field_serializer("date")+ def serialize_date(self, value: datetime | None) -> str | None:+ return value.isoformat() if value else Noneclass PostAuthor(BaseModel):diff --git a/autogpt_platform/backend/backend/server/integrations/models.py b/autogpt_platform/backend/backend/server/integrations/models.pyindex 68e89ea7c2..4d54a80739 100644--- a/autogpt_platform/backend/backend/server/integrations/models.py+++ b/autogpt_platform/backend/backend/server/integrations/models.py@@ -58,17 +58,13 @@ class ProviderConstants(BaseModel):default_factory=lambda: {name.upper().replace("-", "_"): name for name in get_all_provider_names()},- )-- class Config:- schema_extra = {- "example": {- "PROVIDER_NAMES": {- "OPENAI": "openai",- "ANTHROPIC": "anthropic",- "EXA": "exa",- "GEM": "gem",- "EXAMPLE_SERVICE": "example-service",- }+ examples=[+ {+ "OPENAI": "openai",+ "ANTHROPIC": "anthropic",+ "EXA": "exa",+ "GEM": "gem",+ "EXAMPLE_SERVICE": "example-service",}- }+ ],+ )diff --git a/autogpt_platform/frontend/src/app/api/openapi.json b/autogpt_platform/frontend/src/app/api/openapi.jsonindex 32d6184fb7..3c79764959 100644--- a/autogpt_platform/frontend/src/app/api/openapi.json+++ b/autogpt_platform/frontend/src/app/api/openapi.json@@ -6319,7 +6319,16 @@"additionalProperties": { "type": "string" },"type": "object","title": "Provider Names",- "description": "All available provider names as a constant mapping"+ "description": "All available provider names as a constant mapping",+ "examples": [+ {+ "ANTHROPIC": "anthropic",+ "EXA": "exa",+ "EXAMPLE_SERVICE": "example-service",+ "GEM": "gem",+ "OPENAI": "openai"+ }+ ]}},"type": "object",