diff --git a/haystack/components/generators/chat/openai.py b/haystack/components/generators/chat/openai.py index 35163504e..633449625 100644 --- a/haystack/components/generators/chat/openai.py +++ b/haystack/components/generators/chat/openai.py @@ -5,6 +5,7 @@ import copy import json import os +import warnings from typing import Any, Callable, Dict, List, Optional, Union from openai import OpenAI, Stream @@ -117,6 +118,11 @@ class OpenAIChatGenerator: Maximum number of retries to contact OpenAI after an internal error. If not set, it defaults to either the `OPENAI_MAX_RETRIES` environment variable, or set to 5. """ + warnings.warn( + "In the upcoming releases 'gpt-3.5-turbo' will be replaced by 'gpt-4o-mini' as the default model", + DeprecationWarning, + ) + self.api_key = api_key self.model = model self.generation_kwargs = generation_kwargs or {} diff --git a/haystack/components/generators/openai.py b/haystack/components/generators/openai.py index ee7c93b14..3b0ca999e 100644 --- a/haystack/components/generators/openai.py +++ b/haystack/components/generators/openai.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 import os +import warnings from typing import Any, Callable, Dict, List, Optional, Union from openai import OpenAI, Stream @@ -102,6 +103,11 @@ class OpenAIGenerator: from the `OPENAI_MAX_RETRIES` environment variable or set to 5. """ + warnings.warn( + "In the upcoming releases 'gpt-3.5-turbo' will be replaced by 'gpt-4o-mini' as the default model", + DeprecationWarning, + ) + self.api_key = api_key self.model = model self.generation_kwargs = generation_kwargs or {} diff --git a/releasenotes/notes/deprecated-gpt-3.5-as-default-model-d03cafe1fdc2ada2.yaml b/releasenotes/notes/deprecated-gpt-3.5-as-default-model-d03cafe1fdc2ada2.yaml new file mode 100644 index 000000000..6dd7ba5df --- /dev/null +++ b/releasenotes/notes/deprecated-gpt-3.5-as-default-model-d03cafe1fdc2ada2.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - | + The 'gpt-3.5-turbo' as the default model for the `OpenAIGenerator` and `OpenAIChatGenerator` will be replaced by 'gpt-4o-mini'.