diff --git a/src/Plugin/AiProvider/AzureProvider.php b/src/Plugin/AiProvider/AzureProvider.php
index ecfc8df..1e2a42d 100644
--- a/src/Plugin/AiProvider/AzureProvider.php
+++ b/src/Plugin/AiProvider/AzureProvider.php
@@ -350,14 +350,14 @@ class AzureProvider extends AiProviderClientBase implements
     ] + $this->configuration;
 
     // If we want to add tools to the input.
-    if (method_exists($input, 'getChatTools') && $input->getChatTools()) {
+    if (is_object($input) && method_exists($input, 'getChatTools') && $input->getChatTools()) {
       $payload['tools'] = $input->getChatTools()->renderToolsArray();
       foreach ($payload['tools'] as $key => $tool) {
         $payload['tools'][$key]['function']['strict'] = FALSE;
       }
     }
     // Check for structured json schemas.
-    if (method_exists($input, 'getChatStructuredJsonSchema') && $input->getChatStructuredJsonSchema()) {
+    if (is_object($input) && method_exists($input, 'getChatStructuredJsonSchema') && $input->getChatStructuredJsonSchema()) {
       $payload['response_format'] = [
         'type' => 'json_schema',
         'json_schema' => $input->getChatStructuredJsonSchema(),
