11import logging
22import os
33from pathlib import Path
4+ from typing import Any
45
56import azure .identity
6- from azure .ai .evaluation import AzureOpenAIModelConfiguration , OpenAIModelConfiguration
77from dotenv import load_dotenv
88from evaltools .eval .evaluate import run_evaluate_from_config
99from rich .logging import RichHandler
1212
1313
1414def get_openai_config () -> dict :
15+ openai_config : dict [str , Any ]
1516 if os .environ .get ("OPENAI_CHAT_HOST" ) == "azure" :
1617 azure_endpoint = os .environ ["AZURE_OPENAI_ENDPOINT" ]
17- azure_deployment = os .environ . get ( "AZURE_OPENAI_EVAL_DEPLOYMENT" )
18+ azure_deployment = os .environ [ "AZURE_OPENAI_EVAL_DEPLOYMENT" ]
1819 if os .environ .get ("AZURE_OPENAI_KEY" ):
1920 logger .info ("Using Azure OpenAI Service with API Key from AZURE_OPENAI_KEY" )
20- openai_config : AzureOpenAIModelConfiguration = {
21+ openai_config = {
2122 "azure_endpoint" : azure_endpoint ,
2223 "azure_deployment" : azure_deployment ,
2324 "api_key" : os .environ ["AZURE_OPENAI_KEY" ],
@@ -29,7 +30,7 @@ def get_openai_config() -> dict:
2930 else :
3031 logger .info ("Authenticating to Azure using Azure Developer CLI Credential" )
3132 azure_credential = azure .identity .AzureDeveloperCliCredential (process_timeout = 60 )
32- openai_config : AzureOpenAIModelConfiguration = {
33+ openai_config = {
3334 "azure_endpoint" : azure_endpoint ,
3435 "azure_deployment" : azure_deployment ,
3536 "credential" : azure_credential ,
@@ -39,7 +40,7 @@ def get_openai_config() -> dict:
3940 openai_config ["model" ] = os .environ ["AZURE_OPENAI_EVAL_MODEL" ]
4041 else :
4142 logger .info ("Using OpenAI Service with API Key from OPENAICOM_KEY" )
42- openai_config : OpenAIModelConfiguration = {"api_key" : os .environ ["OPENAICOM_KEY" ], "model" : "gpt-4" }
43+ openai_config = {"api_key" : os .environ ["OPENAICOM_KEY" ], "model" : "gpt-4" }
4344 return openai_config
4445
4546
0 commit comments