mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-03 12:07:36 +00:00
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>
This commit is contained in:
@@ -225,8 +225,8 @@ class _AllReturnType(TypedDict):
|
|||||||
class ChatOpenAI(BaseChatModel):
|
class ChatOpenAI(BaseChatModel):
|
||||||
"""`OpenAI` Chat large language models API.
|
"""`OpenAI` Chat large language models API.
|
||||||
|
|
||||||
To use, you should have the
|
To use, you should have the environment variable ``OPENAI_API_KEY``
|
||||||
environment variable ``OPENAI_API_KEY`` set with your 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
|
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.
|
in, even if not explicitly saved on this class.
|
||||||
@@ -234,8 +234,9 @@ class ChatOpenAI(BaseChatModel):
|
|||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain_community.chat_models import ChatOpenAI
|
from langchain_openai import ChatOpenAI
|
||||||
openai = ChatOpenAI(model_name="gpt-3.5-turbo")
|
|
||||||
|
model = ChatOpenAI(model_name="gpt-3.5-turbo")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@@ -44,16 +44,15 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
|
|||||||
environment variable ``OPENAI_API_KEY`` set with your API key or pass it
|
environment variable ``OPENAI_API_KEY`` set with your API key or pass it
|
||||||
as a named parameter to the constructor.
|
as a named parameter to the constructor.
|
||||||
|
|
||||||
|
In order to use the library with Microsoft Azure endpoints, use
|
||||||
|
AzureOpenAIEmbeddings.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain_openai import OpenAIEmbeddings
|
from langchain_openai import OpenAIEmbeddings
|
||||||
|
|
||||||
openai = OpenAIEmbeddings(model="text-embedding-3-large")
|
model = OpenAIEmbeddings(model="text-embedding-3-large")
|
||||||
|
|
||||||
In order to use the library with Microsoft Azure endpoints, use
|
|
||||||
AzureOpenAIEmbeddings.
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
client: Any = Field(default=None, exclude=True) #: :meta private:
|
client: Any = Field(default=None, exclude=True) #: :meta private:
|
||||||
|
@@ -603,8 +603,8 @@ class BaseOpenAI(BaseLLM):
|
|||||||
class OpenAI(BaseOpenAI):
|
class OpenAI(BaseOpenAI):
|
||||||
"""OpenAI large language models.
|
"""OpenAI large language models.
|
||||||
|
|
||||||
To use, you should have the ``openai`` python package installed, and the
|
To use, you should have the environment variable ``OPENAI_API_KEY``
|
||||||
environment variable ``OPENAI_API_KEY`` set with your 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
|
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.
|
in, even if not explicitly saved on this class.
|
||||||
@@ -612,8 +612,9 @@ class OpenAI(BaseOpenAI):
|
|||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
from langchain_community.llms import OpenAI
|
from langchain_openai import OpenAI
|
||||||
openai = OpenAI(model_name="gpt-3.5-turbo-instruct")
|
|
||||||
|
model = OpenAI(model_name="gpt-3.5-turbo-instruct")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Reference in New Issue
Block a user