openai[patch]: fix azure open lc serialization, release 0.1.5 (#21159)

This commit is contained in:
Bagatur
2024-05-01 18:03:29 -04:00
committed by GitHub
parent 94a838740e
commit 6fa8626e2f
6 changed files with 109 additions and 67 deletions

View File

@@ -72,6 +72,18 @@ class AzureOpenAI(BaseOpenAI):
"""Get the namespace of the langchain object."""
return ["langchain", "llms", "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 whether this model can be serialized by Langchain."""
return True
@root_validator()
def validate_environment(cls, values: Dict) -> Dict:
"""Validate that api key and python package exists in environment."""