fix(types): widen TLLMInvocationParams bound to Mapping[str, Any]
TypedDict types are not subtypes of dict[...] in the type system (per PEP 589), so TypedDict-based invocation param classes could not satisfy the TypeVar bound. Mapping[str, Any] accepts TypedDicts while preserving the "string-keyed mapping" constraint.
This commit is contained in:
@@ -12,6 +12,7 @@ adapters that handle tool format conversion and standardization.
|
|||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
from collections.abc import Mapping
|
||||||
from typing import Any, Generic, TypeVar
|
from typing import Any, Generic, TypeVar
|
||||||
|
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
@@ -26,7 +27,7 @@ from pipecat.processors.aggregators.llm_context import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Should be a TypedDict
|
# Should be a TypedDict
|
||||||
TLLMInvocationParams = TypeVar("TLLMInvocationParams", bound=dict[str, Any])
|
TLLMInvocationParams = TypeVar("TLLMInvocationParams", bound=Mapping[str, Any])
|
||||||
|
|
||||||
|
|
||||||
class BaseLLMAdapter(ABC, Generic[TLLMInvocationParams]):
|
class BaseLLMAdapter(ABC, Generic[TLLMInvocationParams]):
|
||||||
|
|||||||
Reference in New Issue
Block a user