""" | |
Module to initialize the Azure GPT model. | |
""" | |
import os | |
from langchain_openai import AzureChatOpenAI | |
from dotenv import load_dotenv | |
load_dotenv() | |
AZURE_OPENAI_API_KEY = os.getenv("AZURE_OPENAI_API_KEY") | |
AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT") | |
class GPTModel(AzureChatOpenAI): | |
""" | |
GPTModel class that extends AzureChatOpenAI. | |
This class initializes a GPT model with specific deployment settings and a callback function. | |
Attributes: | |
callback (function): The callback function to be used with the model. | |
Methods: | |
__init__(callback): | |
Initializes the GPTModel with the specified callback function. | |
""" | |
def __init__(self): | |
super().__init__( | |
deployment_name="gpt-4.1-mini", | |
api_version="2024-12-01-preview", | |
azure_endpoint='https://openai-oe.openai.azure.com/', | |
api_key='b9135a15c242432cb20ddc43fea3a413', | |
streaming=True, | |
temperature=0 | |
) | |