community: replace deprecated davinci models (#14860)

This is technically a breaking change because it'll switch out default
models from `text-davinci-003` to `gpt-3.5-turbo-instruct`, but OpenAI
is shutting off those endpoints on 1/4 anyways.

Feels less disruptive to switch out the default instead.
This commit is contained in:
Erick Friis
2023-12-18 13:49:46 -08:00
committed by GitHub
parent 193f107cb5
commit 5f839beab9
29 changed files with 42 additions and 42 deletions

View File

@@ -173,7 +173,7 @@ class BaseOpenAI(BaseLLM):
client: Any = Field(default=None, exclude=True) #: :meta private:
async_client: Any = Field(default=None, exclude=True) #: :meta private:
model_name: str = Field(default="text-davinci-003", alias="model")
model_name: str = Field(default="gpt-3.5-turbo-instruct", alias="model")
"""Model name to use."""
temperature: float = 0.7
"""What sampling temperature to use."""
@@ -657,7 +657,7 @@ class BaseOpenAI(BaseLLM):
Example:
.. code-block:: python
max_tokens = openai.modelname_to_contextsize("text-davinci-003")
max_tokens = openai.modelname_to_contextsize("gpt-3.5-turbo-instruct")
"""
model_token_mapping = {
"gpt-4": 8192,
@@ -737,7 +737,7 @@ class OpenAI(BaseOpenAI):
.. code-block:: python
from langchain_community.llms import OpenAI
openai = OpenAI(model_name="text-davinci-003")
openai = OpenAI(model_name="gpt-3.5-turbo-instruct")
"""
@classmethod
@@ -763,7 +763,7 @@ class AzureOpenAI(BaseOpenAI):
.. code-block:: python
from langchain_community.llms import AzureOpenAI
openai = AzureOpenAI(model_name="text-davinci-003")
openai = AzureOpenAI(model_name="gpt-3.5-turbo-instruct")
"""
azure_endpoint: Union[str, None] = None