The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
cleanup_azure_ft_models
Ishaan Jafff719743d4ad2
diff --git a/tests/batches_tests/test_openai_batches_and_files.py b/tests/batches_tests/test_openai_batches_and_files.pyindex 8f8b0e41e8b..3f24af0387d 100644--- a/tests/batches_tests/test_openai_batches_and_files.py+++ b/tests/batches_tests/test_openai_batches_and_files.py@@ -297,6 +297,7 @@ async def test_async_create_batch(provider):print("cancel_batch_response=", cancel_batch_response)cleanup_azure_files()+ cleanup_azure_ft_models()def cleanup_azure_files():@@ -317,6 +318,50 @@ def cleanup_azure_files():assert delete_file_response.id == _file.id+def cleanup_azure_ft_models():+ """+ Test CLEANUP: Delete all existing fine tuning jobs for Azure+ """+ try:+ from openai import AzureOpenAI+ import requests++ client = AzureOpenAI(+ api_key=os.getenv("AZURE_API_KEY"),+ azure_endpoint=os.getenv("AZURE_API_BASE"),+ api_version=os.getenv("AZURE_API_VERSION"),+ )++ _list_ft_jobs = client.fine_tuning.jobs.list()+ print("_list_ft_jobs=", _list_ft_jobs)++ # delete all ft jobs make post request to this+ # Delete all fine-tuning jobs+ for job in _list_ft_jobs:+ try:+ endpoint = os.getenv("AZURE_API_BASE").rstrip("/")+ url = f"{endpoint}/openai/fine_tuning/jobs/{job.id}?api-version=2024-10-21"+ print("url=", url)++ headers = {+ "api-key": os.getenv("AZURE_API_KEY"),+ "Content-Type": "application/json",+ }++ response = requests.delete(url, headers=headers)+ print(f"Deleting job {job.id}: Status {response.status_code}")+ if response.status_code != 204:+ print(f"Error deleting job {job.id}: {response.text}")++ except Exception as e:+ print(f"Error deleting job {job.id}: {str(e)}")+ except Exception as e:+ print(f"Error on cleanup_azure_ft_models: {str(e)}")+++cleanup_azure_ft_models()++@pytest.mark.asyncioasync def test_avertex_batch_prediction():load_vertex_ai_credentials()