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:
Paul Kompfner
2026-04-23 14:35:59 -04:00
parent b90ea9bf6a
commit 092b1dcb0f

View File

@@ -12,6 +12,7 @@ adapters that handle tool format conversion and standardization.
import warnings
from abc import ABC, abstractmethod
from collections.abc import Mapping
from typing import Any, Generic, TypeVar
from loguru import logger
@@ -26,7 +27,7 @@ from pipecat.processors.aggregators.llm_context import (
)
# Should be a TypedDict
TLLMInvocationParams = TypeVar("TLLMInvocationParams", bound=dict[str, Any])
TLLMInvocationParams = TypeVar("TLLMInvocationParams", bound=Mapping[str, Any])
class BaseLLMAdapter(ABC, Generic[TLLMInvocationParams]):