mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 07:13:00 +00:00
fix: use typing_extensions.TypedDict for Pydantic compatibility on Python < 3.12
This commit is contained in:
@@ -4,10 +4,11 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from collections.abc import Sequence
|
from collections.abc import Sequence
|
||||||
import logging
|
import logging
|
||||||
from typing import TYPE_CHECKING, Any, TypedDict, cast
|
from typing import TYPE_CHECKING, Any, cast
|
||||||
|
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
from pydantic.dataclasses import dataclass
|
from pydantic.dataclasses import dataclass
|
||||||
|
from typing_extensions import TypedDict
|
||||||
|
|
||||||
from crewai.a2a.extensions.a2ui.models import extract_a2ui_json_objects
|
from crewai.a2a.extensions.a2ui.models import extract_a2ui_json_objects
|
||||||
from crewai.a2a.extensions.a2ui.prompt import build_a2ui_system_prompt
|
from crewai.a2a.extensions.a2ui.prompt import build_a2ui_system_prompt
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import AsyncIterator
|
from collections.abc import AsyncIterator
|
||||||
from typing import TYPE_CHECKING, Any, TypedDict
|
from typing import TYPE_CHECKING, Any
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from a2a.client.errors import A2AClientHTTPError
|
from a2a.client.errors import A2AClientHTTPError
|
||||||
@@ -18,7 +18,7 @@ from a2a.types import (
|
|||||||
TaskStatusUpdateEvent,
|
TaskStatusUpdateEvent,
|
||||||
TextPart,
|
TextPart,
|
||||||
)
|
)
|
||||||
from typing_extensions import NotRequired
|
from typing_extensions import NotRequired, TypedDict
|
||||||
|
|
||||||
from crewai.events.event_bus import crewai_event_bus
|
from crewai.events.event_bus import crewai_event_bus
|
||||||
from crewai.events.types.a2a_events import (
|
from crewai.events.types.a2a_events import (
|
||||||
|
|||||||
@@ -7,12 +7,11 @@ from typing import (
|
|||||||
Any,
|
Any,
|
||||||
Literal,
|
Literal,
|
||||||
Protocol,
|
Protocol,
|
||||||
TypedDict,
|
|
||||||
runtime_checkable,
|
runtime_checkable,
|
||||||
)
|
)
|
||||||
|
|
||||||
from pydantic import BeforeValidator, HttpUrl, TypeAdapter
|
from pydantic import BeforeValidator, HttpUrl, TypeAdapter
|
||||||
from typing_extensions import NotRequired
|
from typing_extensions import NotRequired, TypedDict
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any, NamedTuple, Protocol, TypedDict
|
from typing import TYPE_CHECKING, Any, NamedTuple, Protocol
|
||||||
|
|
||||||
from pydantic import GetCoreSchemaHandler
|
from pydantic import GetCoreSchemaHandler
|
||||||
from pydantic_core import CoreSchema, core_schema
|
from pydantic_core import CoreSchema, core_schema
|
||||||
|
from typing_extensions import TypedDict
|
||||||
|
|
||||||
|
|
||||||
class CommonParams(NamedTuple):
|
class CommonParams(NamedTuple):
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from functools import wraps
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar, TypedDict, cast
|
from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar, cast
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from a2a.server.agent_execution import RequestContext
|
from a2a.server.agent_execution import RequestContext
|
||||||
@@ -38,6 +38,7 @@ from a2a.utils import (
|
|||||||
from a2a.utils.errors import ServerError
|
from a2a.utils.errors import ServerError
|
||||||
from aiocache import SimpleMemoryCache, caches # type: ignore[import-untyped]
|
from aiocache import SimpleMemoryCache, caches # type: ignore[import-untyped]
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
from typing_extensions import TypedDict
|
||||||
|
|
||||||
from crewai.a2a.utils.agent_card import _get_server_config
|
from crewai.a2a.utils.agent_card import _get_server_config
|
||||||
from crewai.a2a.utils.content_type import validate_message_parts
|
from crewai.a2a.utils.content_type import validate_message_parts
|
||||||
|
|||||||
Reference in New Issue
Block a user