mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-27 17:18:13 +00:00
fix: reorganize type declarations
This commit is contained in:
@@ -3,12 +3,10 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import (
|
from typing import (
|
||||||
TYPE_CHECKING,
|
|
||||||
Annotated,
|
Annotated,
|
||||||
Any,
|
Any,
|
||||||
Literal,
|
Literal,
|
||||||
Protocol,
|
Protocol,
|
||||||
TypeAlias,
|
|
||||||
TypedDict,
|
TypedDict,
|
||||||
runtime_checkable,
|
runtime_checkable,
|
||||||
)
|
)
|
||||||
@@ -27,10 +25,6 @@ from crewai.a2a.updates import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from crewai.a2a.config import A2AClientConfig, A2AConfig, A2AServerConfig
|
|
||||||
|
|
||||||
|
|
||||||
TransportType = Literal["JSONRPC", "GRPC", "HTTP+JSON"]
|
TransportType = Literal["JSONRPC", "GRPC", "HTTP+JSON"]
|
||||||
|
|
||||||
http_url_adapter: TypeAdapter[HttpUrl] = TypeAdapter(HttpUrl)
|
http_url_adapter: TypeAdapter[HttpUrl] = TypeAdapter(HttpUrl)
|
||||||
@@ -87,6 +81,3 @@ HANDLER_REGISTRY: dict[type[UpdateConfig], HandlerType] = {
|
|||||||
StreamingConfig: StreamingHandler,
|
StreamingConfig: StreamingHandler,
|
||||||
PushNotificationConfig: PushNotificationHandler,
|
PushNotificationConfig: PushNotificationHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
A2AConfigTypes: TypeAlias = A2AConfig | A2AServerConfig | A2AClientConfig
|
|
||||||
A2AClientConfigTypes: TypeAlias = A2AConfig | A2AClientConfig
|
|
||||||
|
|||||||
@@ -2,13 +2,18 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TypeAlias
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, create_model
|
from pydantic import BaseModel, Field, create_model
|
||||||
|
|
||||||
from crewai.a2a.config import A2AClientConfig, A2AConfig, A2AServerConfig
|
from crewai.a2a.config import A2AClientConfig, A2AConfig, A2AServerConfig
|
||||||
from crewai.a2a.types import A2AClientConfigTypes, A2AConfigTypes
|
|
||||||
from crewai.types.utils import create_literals_from_strings
|
from crewai.types.utils import create_literals_from_strings
|
||||||
|
|
||||||
|
|
||||||
|
A2AConfigTypes: TypeAlias = A2AConfig | A2AServerConfig | A2AClientConfig
|
||||||
|
A2AClientConfigTypes: TypeAlias = A2AConfig | A2AClientConfig
|
||||||
|
|
||||||
|
|
||||||
def create_agent_response_model(agent_ids: tuple[str, ...]) -> type[BaseModel]:
|
def create_agent_response_model(agent_ids: tuple[str, ...]) -> type[BaseModel]:
|
||||||
"""Create a dynamic AgentResponse model with Literal types for agent IDs.
|
"""Create a dynamic AgentResponse model with Literal types for agent IDs.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user