Skip to content

Commit

Permalink
Fix delegate_inference.py (microsoft#1054)
Browse files Browse the repository at this point in the history
### Motivation and Context
microsoft#691 
microsoft#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.
  • Loading branch information
salmon131 authored and name committed Jul 5, 2023
1 parent 79be42a commit b034273
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/semantic_kernel/orchestration/delegate_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ def infer_in_string_out_task_string(signature: Signature, awaitable: bool) -> bo
@staticmethod
@_infers(DelegateTypes.InStringAndContext)
def infer_in_string_and_context(signature: Signature, awaitable: bool) -> bool:
matches = _first_param_is_str(signature)
matches = matches and _first_param_is_context(signature)
matches = _first_param_is_str(signature, only=False)
matches = matches and _has_two_params_second_is_context(signature)
matches = matches and _no_return(signature)
matches = matches and not awaitable
return matches
Expand Down Expand Up @@ -223,7 +223,7 @@ def infer_out_task(signature: Signature, awaitable: bool) -> bool:

@staticmethod
@_infers(DelegateTypes.Unknown)
def infer_unknown(signature: Signature) -> NoReturn:
def infer_unknown(signature: Signature, awaitable: bool) -> NoReturn:
raise KernelException(
KernelException.ErrorCodes.FunctionTypeNotSupported,
"Invalid function type detected, unable to infer DelegateType.",
Expand Down

0 comments on commit b034273

Please sign in to comment.