Skip to content

Commit b2825cf

Browse files
committed
chore: fix type checking on implementation side
1 parent d8b9068 commit b2825cf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/f5_ai_gateway_sdk/processor.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from io import TextIOWrapper, StringIO
1313
from json import JSONDecodeError
1414
from typing import Generic, Any, TypeVar
15-
from collections.abc import Callable, Mapping
15+
from collections.abc import Awaitable, Callable, Mapping
1616
import warnings
1717

1818
from pydantic import JsonValue, ValidationError
@@ -1027,22 +1027,22 @@ def _is_method_overridden(self, method_name: str) -> bool:
10271027
# the method object directly from the Processor class, then it has been overridden.
10281028
return instance_class_method_obj is not base_class_method_obj
10291029

1030-
async def _process_fallback(self, **kwargs) -> Result | Reject:
1030+
def _process_fallback(self, **kwargs) -> Result | Reject:
10311031
warnings.warn(
10321032
f"{type(self).__name__} uses the deprecated 'process' method. "
10331033
"Implement 'process_input' and/or 'process_response' instead.",
10341034
DeprecationWarning,
10351035
stacklevel=2,
10361036
)
1037-
return await self._handle_process_function(self.process, **kwargs)
1037+
return self.process(**kwargs)
10381038

1039-
async def process_input(
1039+
def process_input(
10401040
self,
10411041
prompt: PROMPT,
10421042
metadata: Metadata,
10431043
parameters: PARAMS,
10441044
request: Request,
1045-
) -> Result | Reject:
1045+
) -> Result | Reject | Awaitable[Result | Reject]:
10461046
"""
10471047
This abstract method is for implementors of the processor to define
10481048
with their own custom logic. Errors should be raised as a subclass
@@ -1070,22 +1070,22 @@ def process_input(self, prompt, response, metadata, parameters, request):
10701070
f"{type(self).__name__} must implement 'process_input' or the "
10711071
"deprecated 'process' method to handle input."
10721072
)
1073-
return await self._process_fallback(
1073+
return self._process_fallback(
10741074
prompt=prompt,
10751075
response=None,
10761076
metadata=metadata,
10771077
parameters=parameters,
10781078
request=request,
10791079
)
10801080

1081-
async def process_response(
1081+
def process_response(
10821082
self,
10831083
prompt: PROMPT | None,
10841084
response: RESPONSE,
10851085
metadata: Metadata,
10861086
parameters: PARAMS,
10871087
request: Request,
1088-
) -> Result | Reject:
1088+
) -> Result | Reject | Awaitable[Result | Reject]:
10891089
"""
10901090
This abstract method is for implementors of the processor to define
10911091
with their own custom logic. Errors should be raised as a subclass
@@ -1117,7 +1117,7 @@ def process_response(self, prompt, response, metadata, parameters, request):
11171117
f"{type(self).__name__} must implement 'process_response' or the "
11181118
"deprecated 'process' method to handle input."
11191119
)
1120-
return await self._process_fallback(
1120+
return self._process_fallback(
11211121
prompt=prompt,
11221122
response=response,
11231123
metadata=metadata,

0 commit comments

Comments
 (0)