Spaces:
Paused
Paused
Download modules/models/Azure.py from eggacheb/ChuanhuChatGPT: direct link, hf CLI and curl.
- Browser
- Download file 767 Bytes
-
https://huggingface.co/spaces/eggacheb/ChuanhuChatGPT/resolve/main/modules/models/Azure.py
- Command line
-
hf download hf://spaces/eggacheb/ChuanhuChatGPT/modules/models/Azure.py
-
curl -L -o Azure.py https://huggingface.co/spaces/eggacheb/ChuanhuChatGPT/resolve/main/modules/models/Azure.py
767 Bytes
| from langchain.chat_models import AzureChatOpenAI, ChatOpenAI | |
| import os | |
| from .base_model import Base_Chat_Langchain_Client | |
| # load_config_to_environ(["azure_openai_api_key", "azure_api_base_url", "azure_openai_api_version", "azure_deployment_name"]) | |
| class Azure_OpenAI_Client(Base_Chat_Langchain_Client): | |
| def setup_model(self): | |
| # inplement this to setup the model then return it | |
| return AzureChatOpenAI( | |
| openai_api_base=os.environ["AZURE_OPENAI_API_BASE_URL"], | |
| openai_api_version=os.environ["AZURE_OPENAI_API_VERSION"], | |
| deployment_name=os.environ["AZURE_DEPLOYMENT_NAME"], | |
| openai_api_key=os.environ["AZURE_OPENAI_API_KEY"], | |
| openai_api_type="azure", | |
| streaming=True | |
| ) | |