feat: add protocols file to properly import on LLM

This commit is contained in:
Eduardo Chiarotti
2025-02-13 20:40:00 -03:00
parent 1e140fc6d8
commit e41e2c1210
2 changed files with 13 additions and 13 deletions

View File

@@ -12,12 +12,10 @@ from typing import (
List, List,
Literal, Literal,
Optional, Optional,
Protocol,
Tuple, Tuple,
Type, Type,
Union, Union,
cast, cast,
runtime_checkable,
) )
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -35,6 +33,7 @@ from crewai.traces.unified_trace_controller import trace_llm_call
from crewai.utilities.exceptions.context_window_exceeding_exception import ( from crewai.utilities.exceptions.context_window_exceeding_exception import (
LLMContextLengthExceededException, LLMContextLengthExceededException,
) )
from crewai.utilities.protocols import AgentExecutorProtocol
load_dotenv() load_dotenv()
@@ -130,17 +129,6 @@ def suppress_warnings():
sys.stderr = old_stderr sys.stderr = old_stderr
@runtime_checkable
class AgentExecutorProtocol(Protocol):
"""Protocol defining the expected interface for an agent executor."""
@property
def agent(self) -> Any: ...
@property
def task(self) -> Any: ...
class LLM: class LLM:
def __init__( def __init__(
self, self,

View File

@@ -0,0 +1,12 @@
from typing import Any, Protocol, runtime_checkable
@runtime_checkable
class AgentExecutorProtocol(Protocol):
"""Protocol defining the expected interface for an agent executor."""
@property
def agent(self) -> Any: ...
@property
def task(self) -> Any: ...