Skip to content

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]

test cancel ft jobs

Ishaan Jaff729f876f813a
diff --git a/tests/test_openai_fine_tuning.py b/tests/test_openai_fine_tuning.py
index 096aabea4a6..db41e45438b 100644
--- a/tests/test_openai_fine_tuning.py
+++ b/tests/test_openai_fine_tuning.py
@@ -10,36 +10,30 @@ async def test_openai_fine_tuning():
"""
client = AsyncOpenAI(api_key="sk-1234", base_url="http://0.0.0.0:4000")
- # file_name = "openai_batch_completions.jsonl"
- # _current_dir = os.path.dirname(os.path.abspath(__file__))
- # file_path = os.path.join(_current_dir, file_name)
+ file_name = "openai_batch_completions.jsonl"
+ _current_dir = os.path.dirname(os.path.abspath(__file__))
+ file_path = os.path.join(_current_dir, file_name)
- # response = await client.files.create(
- # extra_body={"custom_llm_provider": "azure"},
- # file=open(file_path, "rb"),
- # purpose="fine-tune",
- # )
-
- # print("response from files.create: {}".format(response))
+ response = await client.files.create(
+ extra_body={"custom_llm_provider": "azure"},
+ file=open(file_path, "rb"),
+ purpose="fine-tune",
+ )
- # # create fine tuning job
+ print("response from files.create: {}".format(response))
- # ft_job = await client.fine_tuning.jobs.create(
- # model="gpt-35-turbo-1106",
- # training_file=response.id,
- # extra_body={"custom_llm_provider": "azure"},
- # )
+ # create fine tuning job
- # print("response from ft job={}".format(ft_job))
+ ft_job = await client.fine_tuning.jobs.create(
+ model="gpt-35-turbo-1106",
+ training_file=response.id,
+ extra_body={"custom_llm_provider": "azure"},
+ )
- # # response from example endpoint
- # assert ft_job.id == "file-abc123"
+ print("response from ft job={}".format(ft_job))
- # get fine tuning job
- # specific_ft_job = await client.fine_tuning.jobs.retrieve(
- # fine_tuning_job_id="123",
- # extra_body={"custom_llm_provider": "azure"},
- # )
+ # response from example endpoint
+ assert ft_job.id == "file-abc123"
# list all fine tuning jobs
list_ft_jobs = await client.fine_tuning.jobs.list(
@@ -51,3 +45,5 @@ async def test_openai_fine_tuning():
fine_tuning_job_id="123",
extra_body={"custom_llm_provider": "azure"},
)
+
+ assert cancel_ft_job.id is not None