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
|
||||
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]):
|
||||
|
||||
Reference in New Issue
Block a user