mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-08 14:31:55 +00:00
openai[patch]: fix azure open lc serialization, release 0.1.5 (#21159)
This commit is contained in:
@@ -10,12 +10,12 @@ from langchain_core.outputs import ChatResult
|
||||
from langchain_core.pydantic_v1 import Field, SecretStr, root_validator
|
||||
from langchain_core.utils import convert_to_secret_str, get_from_dict_or_env
|
||||
|
||||
from langchain_openai.chat_models.base import ChatOpenAI
|
||||
from langchain_openai.chat_models.base import BaseChatOpenAI
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AzureChatOpenAI(ChatOpenAI):
|
||||
class AzureChatOpenAI(BaseChatOpenAI):
|
||||
"""`Azure OpenAI` Chat Completion API.
|
||||
|
||||
To use this class you
|
||||
@@ -100,6 +100,17 @@ class AzureChatOpenAI(ChatOpenAI):
|
||||
"""Get the namespace of the langchain object."""
|
||||
return ["langchain", "chat_models", "azure_openai"]
|
||||
|
||||
@property
|
||||
def lc_secrets(self) -> Dict[str, str]:
|
||||
return {
|
||||
"openai_api_key": "AZURE_OPENAI_API_KEY",
|
||||
"azure_ad_token": "AZURE_OPENAI_AD_TOKEN",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def is_lc_serializable(cls) -> bool:
|
||||
return True
|
||||
|
||||
@root_validator()
|
||||
def validate_environment(cls, values: Dict) -> Dict:
|
||||
"""Validate that api key and python package exists in environment."""
|
||||
|
Reference in New Issue
Block a user