doc: warning added for deprectaion of gpt-3.5 as default model for OpenAI generators (#8300)

* warning added for gpt3.5 usage

* Revert "warning added for gpt3.5 usage"

This reverts commit 035a0ab9eaa9306171439fe128a78b7898ffe486.

* update openaigenerator and openaichatgenerator with warnings

* if cond removed

* update description

* adding release notes

* linting

---------

Co-authored-by: David S. Batista <dsbatista@gmail.com>
This commit is contained in:
Alper 2024-08-29 09:31:59 +02:00 committed by GitHub
parent 51180e060e
commit 7dbc51a3e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View File

@ -5,6 +5,7 @@
import copy import copy
import json import json
import os import os
import warnings
from typing import Any, Callable, Dict, List, Optional, Union from typing import Any, Callable, Dict, List, Optional, Union
from openai import OpenAI, Stream from openai import OpenAI, Stream
@ -117,6 +118,11 @@ class OpenAIChatGenerator:
Maximum number of retries to contact OpenAI after an internal error. 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. 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.api_key = api_key
self.model = model self.model = model
self.generation_kwargs = generation_kwargs or {} self.generation_kwargs = generation_kwargs or {}

View File

@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
import os import os
import warnings
from typing import Any, Callable, Dict, List, Optional, Union from typing import Any, Callable, Dict, List, Optional, Union
from openai import OpenAI, Stream from openai import OpenAI, Stream
@ -102,6 +103,11 @@ class OpenAIGenerator:
from the `OPENAI_MAX_RETRIES` environment variable or set to 5. 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.api_key = api_key
self.model = model self.model = model
self.generation_kwargs = generation_kwargs or {} self.generation_kwargs = generation_kwargs or {}

View File

@ -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'.