diff --git a/giskard/llm/client.py b/giskard/llm/client.py index 244f2dd46b..6305f0e7bd 100644 --- a/giskard/llm/client.py +++ b/giskard/llm/client.py @@ -116,6 +116,8 @@ def complete( max_tokens=max_tokens, ) + function_call = None + if fc := cc.get("function_call"): try: function_call = LLMFunctionCall( @@ -124,8 +126,6 @@ def complete( ) except (json.JSONDecodeError, KeyError) as err: raise LLMGenerationError("Could not parse function call") from err - else: - function_call = None return LLMOutput(message=cc.content, function_call=function_call)