partners[openai]: update the docstring of OpenAI, OpenAIEmbeddings and ChatOpenAI classes (#18908)

**Description:** Update the docstring of OpenAI, OpenAIEmbeddings and
ChatOpenAI classes
**Issue:** Update import module paths to the current LangChain API
**Dependencies:** None
**Lint and test**: `make format` and `make lint` were run

This incorporates the review comments from langchain-ai/langchain#18637
which I closed due to an issue I had in updating that pr branch

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
pull/16523/head
aditya thomas 7 months ago committed by GitHub
parent 11195cfa42
commit 5c2f7e6b2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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

@ -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:

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

Loading…
Cancel
Save