From 634358db5e9d0f091c66c82b8ed1379ec6531f88 Mon Sep 17 00:00:00 2001 From: dev2049 <130488702+dev2049@users.noreply.github.com> Date: Fri, 14 Apr 2023 11:09:36 -0700 Subject: [PATCH] Fix OpenAI LLM docstring (#2910) --- langchain/llms/openai.py | 45 ++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/langchain/llms/openai.py b/langchain/llms/openai.py index ff99ee48..8a54c5d3 100644 --- a/langchain/llms/openai.py +++ b/langchain/llms/openai.py @@ -114,20 +114,7 @@ async def acompletion_with_retry( class BaseOpenAI(BaseLLM): - """Wrapper around 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. - - 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. - - Example: - .. code-block:: python - - from langchain.llms import OpenAI - openai = OpenAI(model_name="text-davinci-003") - """ + """Wrapper around OpenAI large language models.""" client: Any #: :meta private: model_name: str = "text-davinci-003" @@ -541,7 +528,20 @@ class BaseOpenAI(BaseLLM): class OpenAI(BaseOpenAI): - """Generic OpenAI class that uses model name.""" + """Wrapper around 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. + + 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. + + Example: + .. code-block:: python + + from langchain.llms import OpenAI + openai = OpenAI(model_name="text-davinci-003") + """ @property def _invocation_params(self) -> Dict[str, Any]: @@ -549,7 +549,20 @@ class OpenAI(BaseOpenAI): class AzureOpenAI(BaseOpenAI): - """Azure specific OpenAI class that uses deployment name.""" + """Wrapper around Azure-specific 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. + + 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. + + Example: + .. code-block:: python + + from langchain.llms import AzureOpenAI + openai = AzureOpenAI(model_name="text-davinci-003") + """ deployment_name: str = "" """Deployment name to use."""