diff --git a/libs/partners/openai/langchain_openai/chat_models/base.py b/libs/partners/openai/langchain_openai/chat_models/base.py index 74849ea3eee..a777c424130 100644 --- a/libs/partners/openai/langchain_openai/chat_models/base.py +++ b/libs/partners/openai/langchain_openai/chat_models/base.py @@ -225,8 +225,8 @@ class _AllReturnType(TypedDict): class ChatOpenAI(BaseChatModel): """`OpenAI` Chat large language models API. - To use, you should have the - environment variable ``OPENAI_API_KEY`` set with your API key. + To use, you should have the environment variable ``OPENAI_API_KEY`` + set with your API key, or pass it as a named parameter to the constructor. Any parameters that are valid to be passed to the openai.create call can be passed in, even if not explicitly saved on this class. @@ -234,8 +234,9 @@ class ChatOpenAI(BaseChatModel): Example: .. code-block:: python - from langchain_community.chat_models import ChatOpenAI - openai = ChatOpenAI(model_name="gpt-3.5-turbo") + from langchain_openai import ChatOpenAI + + model = ChatOpenAI(model_name="gpt-3.5-turbo") """ @property diff --git a/libs/partners/openai/langchain_openai/embeddings/base.py b/libs/partners/openai/langchain_openai/embeddings/base.py index 92a86cd570b..746123ec0c1 100644 --- a/libs/partners/openai/langchain_openai/embeddings/base.py +++ b/libs/partners/openai/langchain_openai/embeddings/base.py @@ -44,16 +44,15 @@ class OpenAIEmbeddings(BaseModel, Embeddings): environment variable ``OPENAI_API_KEY`` set with your API key or pass it as a named parameter to the constructor. + In order to use the library with Microsoft Azure endpoints, use + AzureOpenAIEmbeddings. + Example: .. code-block:: python from langchain_openai import OpenAIEmbeddings - openai = OpenAIEmbeddings(model="text-embedding-3-large") - - In order to use the library with Microsoft Azure endpoints, use - AzureOpenAIEmbeddings. - + model = OpenAIEmbeddings(model="text-embedding-3-large") """ client: Any = Field(default=None, exclude=True) #: :meta private: diff --git a/libs/partners/openai/langchain_openai/llms/base.py b/libs/partners/openai/langchain_openai/llms/base.py index 4b3b7d56d22..6c88f6eef42 100644 --- a/libs/partners/openai/langchain_openai/llms/base.py +++ b/libs/partners/openai/langchain_openai/llms/base.py @@ -603,8 +603,8 @@ class BaseOpenAI(BaseLLM): class OpenAI(BaseOpenAI): """OpenAI large language models. - To use, you should have the ``openai`` python package installed, and the - environment variable ``OPENAI_API_KEY`` set with your API key. + To use, you should have the environment variable ``OPENAI_API_KEY`` + set with your API key, or pass it as a named parameter to the constructor. Any parameters that are valid to be passed to the openai.create call can be passed in, even if not explicitly saved on this class. @@ -612,8 +612,9 @@ class OpenAI(BaseOpenAI): Example: .. code-block:: python - from langchain_community.llms import OpenAI - openai = OpenAI(model_name="gpt-3.5-turbo-instruct") + from langchain_openai import OpenAI + + model = OpenAI(model_name="gpt-3.5-turbo-instruct") """ @classmethod