mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 07:13:00 +00:00
chore: add deprecation decorator to LiteAgent
This commit is contained in:
@@ -16,7 +16,6 @@ from typing import (
|
|||||||
get_origin,
|
get_origin,
|
||||||
)
|
)
|
||||||
import uuid
|
import uuid
|
||||||
import warnings
|
|
||||||
|
|
||||||
from pydantic import (
|
from pydantic import (
|
||||||
UUID4,
|
UUID4,
|
||||||
@@ -26,7 +25,7 @@ from pydantic import (
|
|||||||
field_validator,
|
field_validator,
|
||||||
model_validator,
|
model_validator,
|
||||||
)
|
)
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self, deprecated
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -173,9 +172,12 @@ def _kickoff_with_a2a_support(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@deprecated(
|
||||||
|
"LiteAgent is deprecated and will be removed in v2.0.0.",
|
||||||
|
category=FutureWarning,
|
||||||
|
)
|
||||||
class LiteAgent(FlowTrackable, BaseModel):
|
class LiteAgent(FlowTrackable, BaseModel):
|
||||||
"""
|
"""A lightweight agent that can process messages and use tools.
|
||||||
A lightweight agent that can process messages and use tools.
|
|
||||||
|
|
||||||
.. deprecated::
|
.. deprecated::
|
||||||
LiteAgent is deprecated and will be removed in a future version.
|
LiteAgent is deprecated and will be removed in a future version.
|
||||||
@@ -278,18 +280,6 @@ class LiteAgent(FlowTrackable, BaseModel):
|
|||||||
)
|
)
|
||||||
_memory: Any = PrivateAttr(default=None)
|
_memory: Any = PrivateAttr(default=None)
|
||||||
|
|
||||||
@model_validator(mode="after")
|
|
||||||
def emit_deprecation_warning(self) -> Self:
|
|
||||||
"""Emit deprecation warning for LiteAgent usage."""
|
|
||||||
warnings.warn(
|
|
||||||
"LiteAgent is deprecated and will be removed in a future version. "
|
|
||||||
"Use Agent().kickoff(messages) instead, which provides the same "
|
|
||||||
"functionality with additional features like memory and knowledge support.",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2,
|
|
||||||
)
|
|
||||||
return self
|
|
||||||
|
|
||||||
@model_validator(mode="after")
|
@model_validator(mode="after")
|
||||||
def setup_llm(self) -> Self:
|
def setup_llm(self) -> Self:
|
||||||
"""Set up the LLM and other components after initialization."""
|
"""Set up the LLM and other components after initialization."""
|
||||||
|
|||||||
@@ -1051,7 +1051,7 @@ def test_lite_agent_verbose_false_suppresses_printer_output():
|
|||||||
successful_requests=1,
|
successful_requests=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
with pytest.warns(DeprecationWarning):
|
with pytest.warns(FutureWarning):
|
||||||
agent = LiteAgent(
|
agent = LiteAgent(
|
||||||
role="Test Agent",
|
role="Test Agent",
|
||||||
goal="Test goal",
|
goal="Test goal",
|
||||||
|
|||||||
Reference in New Issue
Block a user