From d4875fb70a041dd7dd1543acff7531ec4552081b Mon Sep 17 00:00:00 2001 From: Shroominic Date: Sat, 17 Feb 2024 18:40:18 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20fix=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/funcchain/model/patches/azure.py | 18 +++++++++--------- src/funcchain/model/patches/openai.py | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/funcchain/model/patches/azure.py b/src/funcchain/model/patches/azure.py index fa6fb3a..50fba98 100644 --- a/src/funcchain/model/patches/azure.py +++ b/src/funcchain/model/patches/azure.py @@ -58,14 +58,14 @@ class AzureChatOpenAI(ChatOpenAI): azure_endpoint: Union[str, None] = None """Your Azure endpoint, including the resource. - + Automatically inferred from env var `AZURE_OPENAI_ENDPOINT` if not provided. - + Example: `https://example-resource.azure.openai.com/` """ deployment_name: Union[str, None] = Field(default=None, alias="azure_deployment") - """A model deployment. - + """A model deployment. + If given sets the base client URL to include `/deployments/{azure_deployment}`. Note: this means you won't be able to use non-deployment endpoints. """ @@ -75,15 +75,15 @@ class AzureChatOpenAI(ChatOpenAI): """Automatically inferred from env var `AZURE_OPENAI_API_KEY` if not provided.""" azure_ad_token: Optional[SecretStr] = None """Your Azure Active Directory token. - + Automatically inferred from env var `AZURE_OPENAI_AD_TOKEN` if not provided. - - For more: + + For more: https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id. """ # noqa: E501 azure_ad_token_provider: Union[Callable[[], str], None] = None """A function that returns an Azure Active Directory token. - + Will be invoked on every request. """ model_version: str = "" @@ -91,7 +91,7 @@ class AzureChatOpenAI(ChatOpenAI): openai_api_type: str = "" """Legacy, for openai<1.0.0 support.""" validate_base_url: bool = True - """For backwards compatibility. If legacy val openai_api_base is passed in, try to + """For backwards compatibility. If legacy val openai_api_base is passed in, try to infer if it is a base_url or azure_endpoint and update accordingly. """ diff --git a/src/funcchain/model/patches/openai.py b/src/funcchain/model/patches/openai.py index 00363f3..5b1c8fa 100644 --- a/src/funcchain/model/patches/openai.py +++ b/src/funcchain/model/patches/openai.py @@ -245,14 +245,14 @@ def is_lc_serializable(cls) -> bool: openai_api_key: Optional[SecretStr] = Field(default=None, alias="api_key") """Automatically inferred from env var `OPENAI_API_KEY` if not provided.""" openai_api_base: Optional[str] = Field(default=None, alias="base_url") - """Base URL path for API requests, leave blank if not using a proxy or service + """Base URL path for API requests, leave blank if not using a proxy or service emulator.""" openai_organization: Optional[str] = Field(default=None, alias="organization") """Automatically inferred from env var `OPENAI_ORG_ID` if not provided.""" # to support explicit proxy for OpenAI openai_proxy: Optional[str] = None request_timeout: Union[float, Tuple[float, float], Any, None] = Field(default=None, alias="timeout") - """Timeout for requests to OpenAI completion API. Can be float, httpx.Timeout or + """Timeout for requests to OpenAI completion API. Can be float, httpx.Timeout or None.""" max_retries: int = 2 """Maximum number of retries to make when generating.""" @@ -263,14 +263,14 @@ def is_lc_serializable(cls) -> bool: max_tokens: Optional[int] = None """Maximum number of tokens to generate.""" tiktoken_model_name: Optional[str] = None - """The model name to pass to tiktoken when using this class. - Tiktoken is used to count the number of tokens in documents to constrain - them to be under a certain limit. By default, when set to None, this will - be the same as the embedding model name. However, there are some cases - where you may want to use this Embedding class with a model name not - supported by tiktoken. This can include when using Azure embeddings or - when using one of the many model providers that expose an OpenAI-like - API but with different models. In those cases, in order to avoid erroring + """The model name to pass to tiktoken when using this class. + Tiktoken is used to count the number of tokens in documents to constrain + them to be under a certain limit. By default, when set to None, this will + be the same as the embedding model name. However, there are some cases + where you may want to use this Embedding class with a model name not + supported by tiktoken. This can include when using Azure embeddings or + when using one of the many model providers that expose an OpenAI-like + API but with different models. In those cases, in order to avoid erroring when tiktoken is called, you can specify a model name to use here.""" default_headers: Union[Mapping[str, str], None] = None default_query: Union[Mapping[str, object], None] = None