Skip to content

Commit a3d2224

Browse files
authored
Fix delegate_inference.py (#1054)
### Motivation and Context #691 #1053 ### Description 1. Added an argument to prevent TypeError when inferring an unknown type. 2. Fixed a bug in the process of checking parameters when inferring the InStringAndContext type.
1 parent ac6869f commit a3d2224

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎python/semantic_kernel/orchestration/delegate_inference.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def infer_in_string_out_task_string(signature: Signature, awaitable: bool) -> bo
147147
@staticmethod
148148
@_infers(DelegateTypes.InStringAndContext)
149149
def infer_in_string_and_context(signature: Signature, awaitable: bool) -> bool:
150-
matches = _first_param_is_str(signature)
151-
matches = matches and _first_param_is_context(signature)
150+
matches = _first_param_is_str(signature, only=False)
151+
matches = matches and _has_two_params_second_is_context(signature)
152152
matches = matches and _no_return(signature)
153153
matches = matches and not awaitable
154154
return matches
@@ -223,7 +223,7 @@ def infer_out_task(signature: Signature, awaitable: bool) -> bool:
223223

224224
@staticmethod
225225
@_infers(DelegateTypes.Unknown)
226-
def infer_unknown(signature: Signature) -> NoReturn:
226+
def infer_unknown(signature: Signature, awaitable: bool) -> NoReturn:
227227
raise KernelException(
228228
KernelException.ErrorCodes.FunctionTypeNotSupported,
229229
"Invalid function type detected, unable to infer DelegateType.",

0 commit comments

Comments
 (0)