Spaces:
Runtime error
Runtime error
Download app/models/AzureOpenAI.py from tongyi21/LLM_Powered_Legal_RAG: direct link, hf CLI and curl.
- Browser
- Download file 661 Bytes
-
https://huggingface.co/spaces/tongyi21/LLM_Powered_Legal_RAG/resolve/main/app/models/AzureOpenAI.py
- Command line
-
hf download hf://spaces/tongyi21/LLM_Powered_Legal_RAG/app/models/AzureOpenAI.py
-
curl -L -o AzureOpenAI.py https://huggingface.co/spaces/tongyi21/LLM_Powered_Legal_RAG/resolve/main/app/models/AzureOpenAI.py
661 Bytes
| import getpass | |
| import os | |
| from app.utils.handle_api import get_api | |
| from langchain_openai import AzureChatOpenAI | |
| api_key = get_api("AZURE_OPENAI_API_KEY") | |
| os.environ["AZURE_OPENAI_API_KEY"] = api_key | |
| os.environ["AZURE_OPENAI_ENDPOINT"] = "https://yijie-mawcud8g-eastus2.cognitiveservices.azure.com/" | |
| model_name = "gpt-4.1-mini" | |
| deployment = "gpt-4.1-mini-2" | |
| subscription_key = api_key | |
| api_version = "2024-12-01-preview" | |
| azure_llm = AzureChatOpenAI( | |
| model=model_name, | |
| azure_deployment=deployment, # or your deployment | |
| api_version=api_version, # or your api version | |
| temperature=0.2, | |
| max_tokens=2048, | |
| timeout=None, | |
| max_retries=2, | |
| ) |